A_RailAttack

From ZDoom Wiki
Jump to: navigation, search

A_RailAttack (int damage [, int spawnofs_xy [, 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 [, float spawnofs_z]]]]]]]]]]]]]]])


Fires a rail attack. Only works on weapons.

Parameters

  • damage: The damage to inflict on each target that is hit; this can be a fixed value or an expression.
  • spawnofs_xy: 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: It determines the color of the particles that form the spiral "ring" of the beam. You can use "none" to have no ring. The string can be a color defined in the X11R6RGB lump. If the string is invalid, the particles will be black.
  • corecolor: It determines the color of the particles that form the central "core" of the beam. You can use "none" to have no core. The string can be a color defined in the X11R6RGB lump. If the string is invalid, the particles will be black.
  • 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.
    • RGF_FULLBRIGHT — Full bright: Rail particles will be rendered at maximum brightness, ignoring sector lighting.
    • RGF_CENTERZ — (Need more info)
  • 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.
  • spread_z: Maximum angle of random vertical spread. Defaults to 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."
  • duration: Lifetime of spawned particles, in tics. Default is 35, and a value of zero means "use default."
  • sparsity: Distance between individial particles. Implemented as a float multiplier, with 1.0 as the default.
  • driftspeed: Speed at which particles "drift" away from their initial spawn point. Implemented as a float multiplier, with 1.0 as the default.
  • 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.
  • spawnofs_z: The vertical distance from the center of the screen at which the railgun tracer should originate. Negative values shift the tracer down, positive values shift it up. Default is 0. (New from 2.7.1)

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
    Stop
  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
  }
}