A_RailAttack
From ZDoom Wiki
A_RailAttack (int damage [, int spawnofs_horz [, bool useammo [, color ringcolor [, color corecolor [, int flags [, int maxdiff [, str pufftype [, float spread_xy [, float spread_z [, fixed range [, int duration [, float sparsity [, float driftspeed [, str spawnclass]]]]]]]]]]]]]])
Fires a rail attack. Only works on weapons.
Parameters
- damage: The damage to inflict on each target that is hit.
- spawnofs_horz: The horizontal distance from the center of the screen at which the railgun tracer should originate.
- useammo: Whether or not ammo should be used up when firing.
- ringcolor: The color of the particles that make up the spiral of the railgun.
- corecolor: The color of the particles that make up the inner beam of the railgun.
- flags: The following flags can be combined by using the | character between the constant names:
- RGF_SILENT — Silent: The railgun will not play an attack sound when firing.
- RGF_NOPIERCING — Not piercing: The railgun will stop at the first enemy hit, rather than passing through.
- RGF_EXPLICITANGLE — Explicit angle: The spread parameters are taken as explicit angles rather than maximum random amplitude. (New from 2.5.0)
- RGF_FULLBRIGHT — Full bright: Rail particles will be rendered at maximum brightness, ignoring sector lighting. (development version r3529+ only)
- maxdiff: The higher the number, the less accurate the rail will be. Essentially, it will create a lightning-like effect in the way the aim varies.
- pufftype: The puff actor to use. By default, the puff will only spawn in rare circumstances (e.g. when hitting a dormant monster) unless the puff actor has the ALWAYSPUFF flag set. Even if not shown, the selected puff will still be used for applying custom damagetypes and other properties.
- spread_xy: Maximum angle of random horizontal spread. Defaults to 0. (New from 2.5.0)
- spread_z: Maximum angle of random vertical spread. Defaults to 0. (New from 2.5.0)
- range: Maximum distance (in map units, as fixed-point) the rail shot will travel before vanishing. Default is 8192 units, and a value of zero means "use default." (development version r3529+ only)
- duration: Lifetime of spawned particles, in tics. Default is 35, and a value of zero means "use default." (development version r3529+ only)
- sparsity: Distance between individial particles. Implemented as a float multiplier, with 1.0 as the default. (development version r3529+ only)
- driftspeed: Speed at which particles "drift" away from their initial spawn point. Implemented as a float multiplier, with 1.0 as the default. (development version r3529+ only)
- spawnclass: Actor to spawn in place of trail particles. If non-null, the specified actor will be spaced sparsity units apart instead of the usual trail. Particle-specific properties such as duration, driftspeed, and rail color are ignored in such a case. (development version r3529+ only)
Examples
This is a generic railgun for the player. This will work copy and pasted, but you'll need graphics. Notice that this example does not have a gunflash, you can still add one though
Actor PlayerRailgun : Weapon { Radius 24 Height 16 Obituary "%o got railgunned by %k." Weapon.SelectionOrder 100 Weapon.SlotNumber 6 Weapon.Kickback 500 Weapon.AmmoType "Clip" Weapon.AmmoUse 1 Weapon.AmmoGive 30 AttackSound "weapons/rbeam" +EXTREMEDEATH states { Spawn: RLGN A -1 loop Ready: RLGN B 1 A_WeaponReady loop Deselect: RLGN B 1 A_Lower loop Select: RLGN B 1 A_Raise loop Fire: RLGN C 4 RLGN D 0 A_RailAttack ( 2, 0, 1, "ff ff a0", "ff ff a0", 0, 0, "none") RLGN E 8 bright RLGN F 4 TNT1 A 0 A_ReFire goto Ready } }