UZDoom's DECORATE features
Availability
ZandroX behaviour. These are UZDoom's DECORATE expressions, functions, parameters, properties and flags, under UZDoom's names, so a UZDoom mod's DECORATE uses them unchanged. Zandronum 3.3 has none of them, and stops loading a mod that uses one. They all work in netgames.
Expressions
| Kind | Names |
|---|---|
| Math | Min, Max, Clamp, Floor, Ceil, Round, Exp, Log, Log10, Tan, ACos, ASin, ATan, ATan2, VectorAngle, CosH, SinH, TanH |
| Actor queries | CountInv, GetCVar, GetDistance, GetAngle, GetZAt, GetSpawnHealth, GetGibHealth, GetMissileDamage, GetCrouchFactor, CountProximity, GetPlayerInput, OverlayX, OverlayY, OverlayAlpha, GetCVarString, GetSpriteAngle, GetSpriteRotation |
| Actor fields | threshold, DefThreshold, FloatSpeed, tics, gravity, floorclip, bouncefactor, wallbouncefactor, bouncecount, DamageFactor, DamageMultiply, MaxStepHeight, MaxDropOffHeight, projectilepassheight, PainThreshold, Friction, meleethreshold, maxtargetrange, DesignatedTeam, lastpush, lastbump, weaponspecial, StartHealth, PoisonDamage, PoisonDuration, PoisonPeriod, skillrespawncount |
User variables can be var float, arrays included, set with A_SetUserVarFloat and A_SetUserArrayFloat.
ACS reads and writes them as fixed point. A constant index past an array, as user_a[3] on var int user_a[3];,
stops the load with "Array index out of bounds", as in UZDoom.
A weapon's or a CustomInventory's states run with the player as self, so a variable declared on the weapon or item
itself, named in one of its states, gets UZDoom's load warning "Self pointer used in ambiguous context; VM execution
may abort!". It reads the player's own variable of that name and shape, or 0 when the player has none. States(Actor)
says a block's states run only for the class itself, as on a weapon's spawn states, and takes the warning away;
States(...) names any of Actor, Overlay, Weapon and Item, as in UZDoom.
// An imp whose throws spread wider the farther its target stands, and which wanders off when below half health.
actor SkirmishImp : DoomImp
{
var float user_spread;
States
{
Missile:
TROO E 0 A_JumpIf(health < GetSpawnHealth() / 2, "Retreat")
TROO E 0 A_SetUserVarFloat("user_spread", Clamp(GetDistance(false) / 128.0, 0, 8))
TROO EF 8 A_FaceTarget
TROO G 6 A_CustomMissile("DoomImpBall", 32, 0, frandom(-user_spread, user_spread))
Goto See
Retreat:
TROO AABBCCDD 3 A_Wander
Goto See
}
}
// A pack demon: it pounces only with two of its kind nearby, or always from the server's skill 3 up.
actor PackDemon : Demon
{
States
{
Melee:
SARG E 0 A_JumpIf(GetCVar("skill") >= 3 || CountProximity("PackDemon", 512) >= 2, "Pounce")
SARG EF 8 A_FaceTarget
SARG G 8 A_SargAttack
Goto See
Pounce:
SARG E 4 A_FaceTarget
SARG F 4 A_Recoil(-12)
SARG G 8 A_SargAttack
Goto See
}
}
// A rocket that hugs the ground, dipping whenever it is more than 24 units over the floor beneath it.
actor GroundHugger : Rocket
{
States
{
Spawn:
MISL A 1 Bright A_JumpIf(z - GetZAt() > 24, "Dip")
Loop
Dip:
MISL A 1 Bright A_ChangeVelocity(velx, vely, -2, CVF_REPLACE)
Goto Spawn
}
}
// A pistol whose spread halves while crouched, and which sprays while strafing.
actor SteadyPistol : Pistol
{
States
{
Fire:
PISG A 4
PISG B 0 A_JumpIf(GetPlayerInput(INPUT_SIDEMOVE) != 0, "Spray")
PISG B 6 A_FireBullets(5.6 * GetCrouchFactor(AAPTR_DEFAULT), 0, 1, 5, "BulletPuff")
PISG C 4
PISG B 5 A_ReFire
Goto Ready
Spray:
PISG B 6 A_FireBullets(11.2, 0, 1, 5, "BulletPuff")
PISG C 4
Goto Ready
}
}
// A lost soul that falls slower each time it is hurt, never below a tenth of normal gravity.
actor SlowFallSoul : LostSoul
{
-NOGRAVITY
States
{
Pain:
SKUL E 0 A_SetGravity(Max(gravity * 0.5, 0.1))
SKUL E 3
SKUL E 3 A_Pain
Goto See
}
}
GetCVarString("name") gives a CVar's value as text. A quoted string in an expression is a name, so == and !=
compare the CVar's text with one regardless of case, as they compare two quoted strings. A jump's target can be an
expression instead of a quoted label: a number of frames on from the jumping one, worked out when the jump runs.
// CVARINFO
server string zx_doc_huntmode = "Hunting";
// A zombieman that, while a server CVar says Hunting, counts its hunts and skips ahead one frame per hunt.
actor CountingZombie : ZombieMan
{
var int user_hunts;
States
{
See:
POSS A 0 A_JumpIf(GetCVarString("zx_doc_huntmode") != "Hunting", "Plain")
POSS A 0 A_SetUserVar("user_hunts", Min(user_hunts + 1, 3))
POSS A 0 A_Jump(256, user_hunts)
POSS AA 2 A_Chase
POSS BB 2 A_Chase
POSS CC 2 A_Chase
Plain:
POSS DD 2 A_Chase
Goto See
}
}
Functions and parameters
New functions: A_CheckSpecies, A_CheckProximity, A_CheckBlock, A_JumpIfHigherOrLower, A_SetSpecies,
A_SetFloatSpeed, A_SetPainThreshold, A_LogFloat, A_SetUserVarFloat, A_SetUserArrayFloat, and the weapon's
A_WeaponAlert, which wakes monsters that hear the player.
The MBF21 functions also go by UZDoom's MBF21_ names, with UZDoom's parameters: see
MBF21 in DECORATE, with A_WeaponAlert and MBF's movement flags.
// A summoner that calls an imp only where there is room, holds back among three of its own, and climbs after targets above it.
actor Summoner : DoomImp
{
Species "Summoner"
States
{
Missile:
TROO E 0 A_CheckProximity("See", "Summoner", 384, 3)
TROO E 0 A_CheckBlock("See", 0, AAPTR_DEFAULT, 64)
TROO E 0 A_JumpIfHigherOrLower("Climb", "Summon")
Summon:
TROO EF 8 A_FaceTarget
TROO G 6 A_SpawnItemEx("DoomImp", 64, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
Goto See
Climb:
TROO A 0 A_SetFloatSpeed(8)
TROO A 0 A_ChangeFlag("FLOAT", true)
TROO A 0 A_ChangeFlag("NOGRAVITY", true)
Goto See
Death:
TROO I 0 A_LogFloat(FloatSpeed, true)
Goto Super::Death
}
}
// A turncoat zombie: hurt by its own kind, it leaves the species and flinches far less from then on.
actor Turncoat : ZombieMan
{
Species "Zombie"
States
{
Pain:
POSS G 0 A_CheckSpecies("Betrayed", "Zombie", AAPTR_TARGET)
POSS G 3
POSS G 3 A_Pain
Goto See
Betrayed:
POSS G 3 A_SetSpecies("Traitor")
POSS G 3 A_SetPainThreshold(10)
Goto See
}
}
New parameters:
srcandinflicton theA_Damage*andA_Kill*family.damagetypeandnailrangeonA_Explode, which also takesXF_EXPLICITDAMAGETYPEandXF_NOSPLASH.nozonA_JumpIfCloser,A_JumpIfTargetCloser,A_JumpIfMasterCloserandA_JumpIfTracerCloser.usezeroonA_SetScale.SXF_ISTARGET,SXF_ISMASTERandSXF_ISTRACERonA_SpawnItemEx.localonA_LogandA_LogInt.
A_SetTranslation("None") clears the translation, as in UZDoom. A_fua_ResetTranslation()
(ZandroX only) gives back the class's own.
// A fire barrel: its blast is fire damage whatever burns it, and it raises no splash from liquid floors.
actor FireBarrel : ExplosiveBarrel
{
States
{
Death:
BEXP A 5 Bright
BEXP B 5 Bright A_Scream
BEXP C 5 Bright
BEXP D 10 Bright A_Explode(128, 128, XF_HURTSOURCE|XF_EXPLICITDAMAGETYPE|XF_NOSPLASH, false, 0, 0, 10, "BulletPuff", "Fire")
BEXP E 10 Bright
TNT1 A -1
Stop
}
}
// A familiar whose bites count as its master's, so a bitten monster turns on the master.
actor Familiar : LostSoul
{
States
{
Melee:
SKUL C 4 A_FaceTarget
SKUL D 4 A_DamageTarget(8, "Melee", 0, "None", "None", AAPTR_MASTER)
Goto See
}
}
// A spider that bites only what stands level with it, and shrinks to nothing as it dies.
actor LevelBiter : Arachnotron
{
States
{
See:
BSPI A 0 A_JumpIfCloser(64, "Bite", true)
BSPI AABBCCDDEEFF 3 A_BabyMetal
Goto See
Bite:
BSPI A 8 A_FaceTarget
BSPI G 8 A_CustomMeleeAttack(10)
Goto See
Death:
BSPI J 20 A_Scream
BSPI K 7 A_NoBlocking
BSPI LMNO 7 A_SetScale(scaleX - 0.25, scaleY - 0.25)
BSPI P 1 A_SetScale(0, 0, AAPTR_DEFAULT, true)
Stop
}
}
// A scout that keeps the beacon it drops as its tracer, and drops a fresh one whenever it strays 1024 units from the last.
actor BeaconScout : ZombieMan
{
States
{
See:
POSS A 0 MBF21_JumpIfTracerCloser("Chase", 1024)
POSS A 0 A_SpawnItemEx("ScoutBeacon", 0, 0, 0, 0, 0, 0, 0, SXF_ISTRACER)
Chase:
POSS AABBCCDD 4 A_Chase
Goto See
}
}
actor ScoutBeacon
{
+NOGRAVITY
+NOINTERACTION
States
{
Spawn:
TNT1 A 700
Stop
}
}
// A note that only its reader sees, and a chameleon imp that shows its true colours to attack and takes its disguise back in death.
actor SecretNote : CustomInventory
{
+INVENTORY.AUTOACTIVATE
States
{
Spawn:
BON1 A -1
Stop
Use:
TNT1 A 0 A_Log("The note reads: they come from below.", true)
Stop
}
}
actor ChameleonImp : DoomImp
{
Translation "64:79=112:127"
States
{
Missile:
TROO E 0 A_SetTranslation("None")
Goto Super::Missile
Death:
TROO I 0 A_fua_ResetTranslation
Goto Super::Death
}
}
Chasing, wandering, explosions and raising
A_Chase and A_Wander take UZDoom's CHF_NORANDOMTURN, CHF_NODIRECTIONTURN, CHF_NOPOSTATTACKTURN,
CHF_STOPIFBLOCKED, CHF_DONTIDLE and CHF_DONTLOOKALLAROUND, and CHF_DONTTURN for the first, third and fourth
together. A_Explode takes XF_THRUSTZ, XF_THRUSTLESS, XF_NOALLIES, XF_CIRCULAR and XF_CIRCULARTHRUST.
A_RadiusThrust takes RTF_THRUSTZ, RTF_CIRCULARTHRUST and a species, pushing that species alone. No explosion
pushes a +DONTTHRUST actor. A_RaiseMaster, A_RaiseChildren, A_RaiseSiblings, the new A_RaiseSelf and the
Thing_Raise special's second argument take RF_TRANSFERFRIENDLINESS and RF_NOCHECKPOSITION.
A_NoBlocking(false) leaves the drop items undropped.
// A zombie that keeps walking its line, turns only at walls, and wanders the map rather than standing idle.
actor StubbornZombie : ZombieMan
{
States
{
See:
POSS AABBCCDD 4 A_Chase("none", "Missile", CHF_NORANDOMTURN | CHF_DONTIDLE)
Loop
}
}
// A guard on its beat, sideways-shuffling past what it sees ahead.
actor SentryZombie : ZombieMan
{
States
{
Spawn:
POSS AABBCCDD 4 A_Wander(CHF_NORANDOMTURN | CHF_NODIRECTIONTURN)
Loop
See:
POSS AABBCCDD 4 A_Chase("none", "Missile", CHF_DONTLOOKALLAROUND)
Loop
}
}
// A rocket whose round blast lifts what it hits, and spares the shooter's friends.
actor ConcussionRocket : Rocket
{
States
{
Death:
MISL B 8 Bright A_Explode(128, 128, XF_HURTSOURCE | XF_CIRCULAR | XF_CIRCULARTHRUST | XF_NOALLIES)
MISL C 6 Bright
MISL D 4 Bright
Stop
}
}
// A charge that burns without a push, and a gust that throws imps alone into the air.
actor StickyCharge : Rocket
{
States
{
Death:
MISL B 8 Bright A_Explode(64, 96, XF_THRUSTLESS)
Stop
}
}
actor ImpGust : Rocket
{
Damage 0
States
{
Death:
MISL B 8 Bright A_RadiusThrust(400, 192, RTF_THRUSTZ, 0, "DoomImp")
Stop
}
}
// A totem that raises the zombie it called, on its own side, even where something stands on the corpse.
actor RaisingTotem
{
Health 200
Radius 16
Height 48
+SOLID
+SHOOTABLE
States
{
Spawn:
COLU A 0 NoDelay A_SpawnItemEx("ZombieMan", 64, 0, 0, 0, 0, 0, 0, SXF_SETMASTER)
Idle:
COLU A 175 A_RaiseChildren(RF_TRANSFERFRIENDLINESS | RF_NOCHECKPOSITION)
Loop
}
}
// An imp that gets back up each time its body has lain three seconds, and a zombie that drops nothing.
actor UndyingImp : DoomImp
{
States
{
Death:
TROO I 8
TROO J 8 A_Scream
TROO K 6
TROO L 6 A_NoBlocking
TROO M 105
TROO M -1 A_RaiseSelf
Stop
}
}
actor EmptyHandedZombie : ZombieMan
{
States
{
Death:
POSS H 5
POSS I 5 A_Scream
POSS J 5 A_NoBlocking(false)
POSS K 5
POSS L -1
Stop
}
}
Giving to everything around
A_RadiusGive(item, distance, flags, amount, filter, species, mindist, limit) takes UZDoom's last four arguments: a
class and a species each receiver must match (both, or either with RGF_EITHER; RGF_EXFILTER and
RGF_EXSPECIES turn each into "all but"), a distance a receiver must be past, and the most receivers to give to.
RGF_ITEMS gives to items lying around, RGF_KILLED to the dead, and RGF_CORPSES to corpses of any kind.
RGF_INCLUSIVE skips a receiver only when every pointer it fills is excluded. RGF_GIVESELF gives to the caller
whatever it is.
// Heals up to two imps beyond arm's reach, once a second.
actor ImpShrine
{
States
{
Spawn:
CEYE A 35 A_RadiusGive("Stimpack", 512, RGF_MONSTERS, 1, "DoomImp", "None", 64, 2)
Loop
}
}
// A war banner that rallies every monster but the zombies.
actor RallyBanner
{
States
{
Spawn:
BAR1 A 35 A_RadiusGive("PowerStrength", 384, RGF_MONSTERS | RGF_EXSPECIES, 1, "None", "ZombieMan")
Loop
}
}
// Marks the dead around it, whether they lie as corpses or were only killed, for a script to raise later.
actor SoulCollector
{
States
{
Spawn:
SKUL A 70 A_RadiusGive("SoulMark", 256, RGF_CORPSES | RGF_KILLED | RGF_NOSIGHT)
Loop
}
}
actor SoulMark : Inventory
{
Inventory.MaxAmount 1
}
Weapons and missiles
A_CustomPunch(damage, norandom, flags, pufftype, range, lifesteal, lifestealmax, armorbonustype, meleesound, misssound) caps what a punch steals at lifestealmax. CPF_STEALARMOR turns the steal into armour, given as
armorbonustype, and the last two sounds play on a hit and on a miss. A_ReFire(flash, autoswitch) with
autoswitch false keeps an empty weapon up rather than switching away. A_SelectWeapon(weapon, SWF_SELECTPRIORITY)
picks the best weapon the player holds when they lack the named one.
// A fist that turns half of each hit into armour, up to 150, with sounds of its own for a hit and a miss.
actor VampireFist : Fist
{
States
{
Fire:
PUNG B 4
PUNG C 4 A_CustomPunch(20, false, CPF_STEALARMOR, "BulletPuff", 0, 0.5, 150, "ArmorBonus", "*fist", "skeleton/swing")
PUNG D 5
PUNG C 4
PUNG B 5 A_ReFire
Goto Ready
}
}
// A revolver that stays in hand when its last round is gone, so the player chooses what to switch to.
actor Revolver : Pistol
{
States
{
Fire:
PISG A 4
PISG B 6 A_FirePistol
PISG C 4
PISG B 5 A_ReFire("", false)
Goto Ready
}
}
// A panic button that brings up the BFG, or the best weapon at hand without one.
actor PanicButton : CustomInventory
{
+INVENTORY.INVBAR
Inventory.Icon "BFUGA0"
States
{
Spawn:
BFUG A -1
Stop
Use:
TNT1 A 0 A_SelectWeapon("BFG9000", SWF_SELECTPRIORITY)
Stop
}
}
A_BFGSpray's last argument takes BFGF_MISSILEORIGIN, firing the rays from the ball rather than its shooter, and
BFGF_HURTSOURCE, which lets them hit the shooter. A spray with +MTHRUSPECIES passes over the shooter's own
species. A_Tracer2(traceang) turns a missile at most traceang degrees each call, 19.6875 by default.
A_CheckLOF's last argument, offsetforward, starts the line that far ahead, as offsetwidth moves it aside.
// A ball that bursts where it lands, its rays catching the one who fired it if they stand too close.
actor RecklessBFGBall : BFGBall
{
States
{
Death:
BFE1 AB 8 Bright
BFE1 C 8 Bright A_BFGSpray("BFGExtra", 40, 15, 90, 1024, 32, 0, BFGF_MISSILEORIGIN | BFGF_HURTSOURCE)
BFE1 DEF 8 Bright
Stop
}
}
// Rays that spare the shooter's own species, sprayed with A_BFGSpray("KinSafeExtra").
actor KinSafeExtra : BFGExtra
{
+MTHRUSPECIES
}
// A homing rocket that turns at most 5 degrees at a time.
actor LazyTracer : RevenantTracer
{
States
{
Spawn:
FATB AB 2 Bright A_Tracer2(5)
Loop
}
}
// A zombie whose rocket leaves 40 ahead of it, checking its line of fire from there.
actor BazookaZombie : ZombieMan
{
States
{
Missile:
POSS E 10 A_FaceTarget
POSS E 0 A_CheckLOF("Fire", 0, 0, 0, 0, 0, 0, 0, AAPTR_DEFAULT, 40)
Goto See
Fire:
POSS F 8 A_SpawnItemEx("Rocket", 40, 0, 32, 20, 0, 0, 0, SXF_NOCHECKPOSITION)
Goto See
}
}
A_WeaponReady's WRF_ALLOWUSER1 to WRF_ALLOWUSER4 let the Weapon State 1-4 keys (+user1 to +user4, in the
controls menu) jump to the weapon's User1 to User4 states. When several allowed keys are held at once, zoom wins
over reload, and reload over the user states, lowest first.
// A shotgun whose stock bashes on the Weapon State 1 key and whose Weapon State 2 key pumps it for show.
actor BashShotgun : Shotgun
{
States
{
Ready:
SHTG A 1 A_WeaponReady(WRF_ALLOWUSER1 | WRF_ALLOWUSER2)
Loop
User1:
SHTG A 4
SHTG A 6 A_CustomPunch(15, false, 0, "BulletPuff", 64)
SHTG A 4
Goto Ready
User2:
SHTG BC 5
SHTG D 4
SHTG CB 5
Goto Ready
}
}
A_RailAttack and A_CustomRailgun take two more arguments after spawnofs_z. spiraloffset is the angle, in
degrees, at which the trail's spiral starts (270 by default). limit is how many actors the rail hits before it
stops (0 for all). As in UZDoom, only A_RailAttack honours limit: A_CustomRailgun accepts it but still pierces
everything. The RGF_NORANDOMPUFFZ flag spawns the rail's puffs at the height of each hit, rather than up to 4
units above or below it. A_CustomRailgun's last argument, veleffect, sets how many tics of a moving target's
movement its aim trails behind. The default is 3; 0 aims where the target is, and a negative value leads it.
// A rail pistol whose slug stops in the second thing it hits, its puffs exactly where each hit landed.
actor PiercingRail : Pistol
{
States
{
Fire:
PISG A 4
PISG B 6 A_RailAttack(80, 0, true, "", "", RGF_NORANDOMPUFFZ, 0, "BulletPuff", 0, 0, 0, 0, 1.0, 1.0, "None", 0, 90, 2)
PISG C 4
PISG B 5 A_ReFire
Goto Ready
}
}
// A sniper zombie that fires at where its target stands rather than where it was a moment ago.
actor DeadeyeZombie : ZombieMan
{
States
{
Missile:
POSS E 10 A_FaceTarget
POSS F 8 A_CustomRailgun(15, 0, "ff 00 00", "ff ff ff", RGF_SILENT, 1, 0, "BulletPuff", 0, 0, 0, 0, 1.0, 1.0, "None", 0, 270, 0, 0)
Goto See
}
}
A_FireBullets and A_CustomBulletAttack take three more arguments: missile, spawnheight (32 by default) and
spawnofs_xy. With a missile named, each bullet also fires that missile from spawnheight above the shooter and
spawnofs_xy to its right, aimed at the bottom of the bullet's puff. Where a bullet leaves no puff, the missile
aims at where the puff would have been. The bullet still does the damage; the missile is for show unless it has
damage of its own. FBF_PUFFTARGET, FBF_PUFFMASTER and FBF_PUFFTRACER (and the CBAF_ flags of the same
names) make the puff the missile's target, master or tracer.
A_Face, A_FaceTarget, A_FaceMaster and A_FaceTracer now set pitch as UZDoom does. With a max_pitch of 180 or
less, a target above gives a negative pitch, which looks up. A caller shorter than 32 measures from its own middle.
// A chaingun whose every bullet trails a tracer from beside the barrel to where it hit.
actor TracerChaingun : Chaingun replaces Chaingun
{
States
{
Fire:
CHGG AB 4 A_FireBullets(5.6, 0, 1, 5, "BulletPuff", FBF_USEAMMO, 0, "TracerRound", 34, 6)
CHGG B 0 A_ReFire
Goto Ready
}
}
actor TracerRound
{
Projectile
Speed 60
Radius 2
Height 2
Damage 0
RenderStyle Add
+BRIGHT
States
{
Spawn:
PUFF A -1
Stop
Death:
TNT1 A 0
Stop
}
}
// A zombie whose rifle fires glowing slugs, each of which holds its puff as its tracer.
actor SlugZombie : ZombieMan
{
States
{
Missile:
POSS E 10 A_FaceTarget
POSS F 8 A_CustomBulletAttack(22.5, 0, 1, 9, "BulletPuff", 0, CBAF_PUFFTRACER, AAPTR_TARGET, "TracerRound", 32, 0)
Goto See
}
}
A weapon's layers turn with A_OverlayRotate about the point A_OverlayPivot
and A_OverlayPivotAlign set, which A_OverlayScale scales about
too. A_OverlayVertexOffset shifts one corner of a frame, and
A_OverlayTranslation recolours a layer by a TRNSLATE name. A_OverlayOffset's
WOF_RELATIVE moves a layer along its turn, A_OverlayScale's WOF_ZEROY keeps a 0 height, and OverlayAlpha reads
a layer's alpha. A layer starts with UZDoom's flags, PSPF_POWDOUBLE, PSPF_CVARFAST and PSPF_PIVOTPERCENT
included. In a netgame the player's client runs its own layers, and the server sends each layer's jumps.
// TRNSLATE
DocHotBarrel = "112:127=176:191"
// A pistol whose second layer tips back as it fires, its barrel glowing red until it cools.
actor TippingPistol : Pistol
{
States
{
Ready:
PISG A 0 A_Overlay(2, "Barrel", true)
PISG A 1 A_WeaponReady
Goto Ready+1
Fire:
PISG A 0 A_OverlayTranslation(2, "DocHotBarrel")
PISG A 0 A_OverlayRotate(2, 8, WOF_ADD)
PISG B 6 A_FirePistol
PISG C 4 A_OverlayRotate(2, -8, WOF_ADD)
PISG A 0 A_OverlayTranslation(2, "")
PISG B 5 A_ReFire
Goto Ready+1
Barrel:
PISF A 0 A_OverlayPivotAlign(OverlayID(), PSPA_CENTER, PSPA_BOTTOM)
PISF A 0 A_OverlayPivot(OverlayID(), 0, 0)
PISF A 1 A_JumpIf(OverlayAlpha(OverlayID()) < 1, "Fade")
Wait
Fade:
PISF A 1 A_OverlayAlpha(OverlayID(), 1)
Goto Barrel+2
}
}
Inventory, morphing and monsters
A_SetInventory(item, amount, ptr, beyondMax) sets how many of an item an actor holds, giving or taking the
difference. It stops at the item's most unless beyondMax is true, and 0 removes the item. A voodoo doll sets its
player's. A_Morph(type, duration, flags, enter_flash, exit_flash) morphs its caller: a player into a player class,
a monster into a MorphedMonster, with the MRF_ flags and flashes MorphActor takes.
// A pickup that leaves the player holding exactly 100 cells, whatever they had.
actor CellReset : CustomInventory
{
Inventory.PickupMessage "Cells reset to 100"
States
{
Spawn:
CELL A -1
Stop
Pickup:
TNT1 A 0 A_SetInventory("Cell", 100)
Stop
}
}
// A cursed skull that turns whoever picks it up into a chicken for 20 seconds.
actor ChickenCurse : CustomInventory
{
Inventory.PickupMessage "You feel feathery"
States
{
Spawn:
SKUL A -1
Stop
Pickup:
TNT1 A 0 A_Morph("ChickenPlayer", 700)
Stop
}
}
// An imp that hides as a pig for ten seconds each time it is hurt.
actor ShyImp : DoomImp
{
States
{
Pain:
TROO H 2
TROO H 2 A_Pain
TROO H 0 A_Morph("Pig", 350)
Goto See
}
}
A_RadiusDamageSelf(damage, distance, flags, flashtype) hurts the one who fired a missile, less the farther they
stand, up to distance away. RDSF_BFGDAMAGE rolls the damage as the BFG's rays do, and a flashtype appears on
them. A_PainShootSkull(spawntype, angle, flags, limit) shoots a skull at an absolute angle, with A_PainAttack's
PAF_ flags; a limit above 0 caps how many of that type the map holds. A_TossGib(gibtype, zofs) tosses a gib
of its own class from its own height, Strife's Meat (or Junk for a +NOBLOOD actor) 24 up by default.
// A shock grenade that jolts whoever threw it, flashing on them, when it bursts within 256 of them.
actor ShockGrenade : Rocket
{
States
{
Death:
MISL B 8 Bright A_RadiusDamageSelf(64, 256, RDSF_BFGDAMAGE, "BFGExtra")
MISL CD 6 Bright
Stop
}
}
// A pain elemental that always spits its skulls due east, at most 10 on the map.
actor CompassElemental : PainElemental
{
States
{
Missile:
PAIN D 5 A_FaceTarget
PAIN E 5 A_FaceTarget
PAIN F 5 Bright A_PainShootSkull("LostSoul", 0, 0, 10)
Goto See
}
}
// A zombie that sheds scrap from its chest as it falls.
actor ScrapZombie : ZombieMan
{
States
{
Death:
POSS H 5 A_TossGib("Junk", 40)
POSS I 5 A_Scream
POSS J 5 A_NoBlocking
POSS K 5 A_TossGib("Junk", 16)
POSS L -1
Stop
}
}
A_CheckForResurrection(state, sound) raises a corpse in reach as A_VileChase does, then enters state (its
Heal state when none is named) and plays sound. A_M_Refire(ignoremissile, jumpto) goes to jumpto rather
than the next state when a marine stops firing. A_SetChaseThreshold(threshold, def, ptr) sets how many steps a
monster chases its target before another can draw it off, or with def true what each new target resets that to.
DefThreshold reads the latter in an expression.
// A zombie medic that raises the corpses it walks over, lit up in its Heal state.
actor ZombieMedic : ZombieMan
{
States
{
See:
POSS A 0 A_CheckForResurrection
POSS AABBCCDD 4 A_Chase
Loop
Heal:
POSS E 10 Bright
Goto See
}
}
// A chaingunner that pauses in its Taunt state once its target dies or hides.
actor TauntingMarine : MarineChaingun
{
States
{
Missile:
PLAY E 4 A_FaceTarget
PLAY FF 4 Bright A_M_FireCGun(true)
PLAY E 0 A_M_Refire(false, "Taunt")
Loop
Taunt:
PLAY A 20
Goto See
}
}
// A hell knight that, once hurt, chases each new attacker twice as long before another can draw it off.
actor GrudgeKnight : HellKnight
{
States
{
Pain:
BOS2 H 2 A_SetChaseThreshold(200, true)
BOS2 H 2 A_Pain
Goto See
}
}
A_SetFriendly(set) makes its caller friendly or hostile and keeps the map's kill total right. Each argument of
A_ChangeCountFlags(kill, item, secret) sets or clears COUNTKILL, COUNTITEM or COUNTSECRET and moves the map's
totals with it; FLAG_NO_CHANGE (the default) leaves that flag alone. A_ChangeLinkFlags(blockmap, sector) does the
same for NOBLOCKMAP and NOSECTOR, relinking the actor. A_SetRenderStyle(alpha, style) sets any STYLE_ render
style (STYLE_AddStencil and STYLE_AddShaded are new) with its alpha, which A_SetTranslucent can only do for three.
A_FaceMovementDirection(offset, anglelimit, pitchlimit, flags, ptr) turns an actor to face where it is moving, plus
offset degrees, turning at most anglelimit (and pitchlimit for pitch) when above 0. FMDF_NOPITCH and
FMDF_NOANGLE leave one alone, and FMDF_INTERPOLATE smooths the turn. As in UZDoom, a pitch further off than
pitchlimit steps away from the direction of travel rather than towards it.
// An imp that, once hurt, turns on its own kind and stops counting towards the kill total.
actor TurncoatImp : DoomImp
{
States
{
Pain:
TROO H 2 A_SetFriendly(true)
TROO H 2 A_ChangeCountFlags(0)
TROO H 2 A_Pain
Goto See
}
}
// A rocket that fades into an additive glow as it flies, always pointing along its path.
actor GlowRocket : Rocket
{
+SEEKERMISSILE
States
{
Spawn:
MISL A 1 Bright A_SeekerMissile(5, 10)
MISL A 1 Bright A_FaceMovementDirection(0, 0, 0, FMDF_INTERPOLATE)
MISL A 0 A_SetRenderStyle(0.6, STYLE_Add)
Loop
}
}
// A secret marker that leaves the blockmap and the secret count once its player has found it.
actor SpentMarker : CustomInventory
{
+COUNTSECRET
States
{
Spawn:
BON1 A -1
Stop
Pickup:
TNT1 A 0 A_ChangeLinkFlags(1, FLAG_NO_CHANGE)
TNT1 A 0 A_ChangeCountFlags(FLAG_NO_CHANGE, FLAG_NO_CHANGE, 0)
Stop
}
}
A_DropInventory(type, amount) drops that many of an item, or all of it if it holds fewer; without an amount it
drops one, as it always did. Strife's gold drops one piece: the whole amount above 25, a 25 piece above 10, a 10
piece above 1, otherwise a coin.
// A clip that, when used, drops 10 bullets for a teammate.
actor ShareBullets : CustomInventory
{
+INVENTORY.INVBAR
Inventory.Icon "CLIPA0"
States
{
Spawn:
CLIP A -1
Stop
Use:
TNT1 A 0 A_DropInventory("Clip", 10)
Stop
}
}
Sounds, the view and the status bar
A_StopSounds(chanmin, chanmax) stops the caller's sounds on every slot from chanmin to chanmax (either order);
A_StopAllSounds(), or A_StopSounds(0, 0), stops all of them. A_SoundVolume(slot, volume) changes the volume of
what already plays on a slot, from 0 to 1 (-1 is every slot). A_StartSoundIfNotSame(sound, checkagainst, ...) is
A_StartSound unless the two sounds are the same for the caller, as a player class can alias *land to *grunt. In a
netgame the server sends each stop and volume change, and a client that joins later hears loops at their changed volume.
// A cacodemon that hums while it floats, quieter once hurt, and silent once dead.
actor HummingCaco : Cacodemon
{
States
{
See:
HEAD A 0 A_StartSound("misc/teleport", CHAN_BODY, CHANF_LOOPING)
HEAD A 3 A_Chase
Goto See+1
Pain:
HEAD E 3 A_SoundVolume(CHAN_BODY, 0.4)
HEAD E 3 A_Pain
HEAD F 6
Goto See+1
Death:
HEAD G 8 A_StopAllSounds
HEAD H 8 A_Scream
HEAD IJ 8
HEAD K 8 A_NoBlocking
HEAD L -1 A_SetFloorClip
Stop
}
}
// A key that plays its own pickup sound only when a mod has not made it the plain item sound.
actor ChimeKey : BlueCard
{
States
{
Pickup:
TNT1 A 0 A_StartSoundIfNotSame("misc/k_pkup", "misc/i_pkup", CHAN_ITEM)
Stop
}
}
// A lift's engine that stops its motor and brake slots together and leaves its alarm on slot 5 running.
actor LiftEngine
{
+NOBLOCKMAP
+NOGRAVITY
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_StartSound("plats/pt1_mid", CHAN_WEAPON, CHANF_LOOPING)
TNT1 A 0 A_StartSound("doors/dr1_clos", CHAN_VOICE, CHANF_LOOPING)
TNT1 A 0 A_StartSound("misc/spawn", 5, CHANF_LOOPING)
TNT1 A 105
TNT1 A -1 A_StopSounds(CHAN_WEAPON, CHAN_VOICE)
Stop
}
}
A_SoundPitch(slot, pitch) changes the pitch of what already plays on one slot, 1 being the sound's normal rate and 2
an octave up. A_StartSound and A_StartSoundIfNotSame take a last startTime argument, in seconds, to start the sound
that far in: a looping sound wraps around, and any other sound started past its end does not play. In a netgame the
server sends both, and a client that joins later hears loops at their changed pitch, from their start. A_PlaySound
takes local and pitch after its attenuation, as UZDoom's does: a local sound is heard, without attenuation, only
by whoever views from the caller, as ACS PlaySound's is, and pitch is A_StartSound's.
// A turret whose motor whines higher each time it is hurt, whose alarm picks up halfway through, and that dies with
// a low crunch.
actor WhiningTurret
{
Health 60
Radius 16
Height 32
+SHOOTABLE
+NOBLOOD
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_StartSound("plats/pt1_mid", CHAN_BODY, CHANF_LOOPING)
TNT1 A -1
Stop
Pain:
TNT1 A 0 A_SoundPitch(CHAN_BODY, 1.5)
TNT1 A 0 A_StartSound("misc/spawn", CHAN_VOICE, 0, 1.0, ATTN_NORM, 0, 0.5)
Goto Spawn+2
Death:
TNT1 A 0 A_StopAllSounds
TNT1 A 0 A_PlaySound("misc/gibbed", CHAN_VOICE, 1.0, false, ATTN_NORM, false, 0.8)
Stop
}
}
// A switch whose click only the player who pressed it hears.
actor QuietSwitch : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySound("switches/normbutn", CHAN_ITEM, 1.0, false, ATTN_NORM, true)
Stop
}
}
A_SetBlend(color1, alpha, tics, color2, alpha2) takes the alpha it fades to as its last argument, so a fade can come
in as well as go out; either way the view is clear when it ends, as in UZDoom. Given no color2 and no alpha2, the fade
keeps its colour as it goes out, as Zandronum's always did (UZDoom's turns it black on the way). A_WeaponOffset(x, y, flags) moves the weapon as A_OverlayOffset moves its layer, with the same WOF_ flags; A_WeaponReady sets it back
unless given WRF_NOBOB. A_SetMugshotState(name) sets the status bar face of whoever views from the caller. In a
netgame it reaches only that player, and so does ACS SetMugshotState, which no longer changes every player's face.
// A sphere that floods the view gold over a second, then lets it clear, and makes its finder grin.
actor GoldSphere : CustomInventory
{
+COUNTITEM
+INVENTORY.AUTOACTIVATE
States
{
Spawn:
SOUL ABCD 6 Bright
Loop
Pickup:
TNT1 A 0 A_SetBlend("Gold", 0, 35, "Gold", 0.4)
TNT1 A 0 A_SetMugshotState("Grin")
Stop
}
}
// A pistol that kicks up and right on each shot and settles back on its own.
actor KickPistol : Pistol
{
States
{
Ready:
PISG A 1 A_WeaponReady
Loop
Fire:
PISG A 4
PISG B 0 A_FireBullets(5.6, 0, 1, 5, "BulletPuff")
PISG B 6 A_WeaponOffset(4, 38)
PISG C 4 A_WeaponOffset(-2, -3, WOF_ADD | WOF_INTERPOLATE)
PISG B 5 A_ReFire
Goto Ready
}
}
A_CopySpriteFrame(from, to, flags) gives the to pointer's actor the sprite and frame the from pointer's
actor shows, CPSF_NOSPRITE keeping its own sprite and CPSF_NOFRAME its own frame. In a netgame the server sends
the copy. A_SprayDecal(decalname, dist) sprays a decal on the wall the caller faces, along its angle and pitch, if
the wall is within dist (172 by default). Each player's own game makes the mark, as it does a bullet's; a player
who joins later does not see it.
// A statue that takes on the look of whatever spawned it.
actor MimicStatue
{
+SOLID
States
{
Spawn:
TNT1 A 1
TNT1 A -1 A_CopySpriteFrame(AAPTR_TARGET, AAPTR_DEFAULT)
Stop
}
}
// A barrel that leaves a scorch on the nearest wall in front of it when it blows.
actor ScorchBarrel : ExplosiveBarrel
{
States
{
Death:
BEXP A 5 Bright
BEXP B 5 Bright A_Scream
BEXP C 5 Bright A_SprayDecal("Scorch", 128)
BEXP D 10 Bright A_Explode
BEXP E 10 Bright
TNT1 A 1050 Bright A_BarrelDestroy
TNT1 A 5 A_Respawn
Wait
}
}
A_SpriteOffset(ox, oy) draws the caller's sprite shifted by ox units right and oy units down, wherever it is
seen from; +FLIPSPRITEOFFSETX and +FLIPSPRITEOFFSETY turn either axis round. It moves only the picture, not where
the actor stands or is hit. A_SetViewAngle(angle, flags, ptr), A_SetViewPitch(pitch, flags, ptr) and
A_SetViewRoll(roll, flags, ptr) turn the view of whoever looks from the ptr actor, a player or a camera, by that
many degrees past the actor's own angles, while the actor itself keeps facing where it did; +ABSVIEWANGLES makes them
the view's own angles instead. SPF_INTERPOLATE turns the view smoothly over the tic, and SPF_FORCECLAMP holds the
pitch within 89 degrees up or down (a player's view pitch always stays within its own limits). In a netgame the server
sends each to every client, and a player who joins later sees them.
// A ghost that floats a little to one side of where it really is, so a player aiming at the picture misses.
actor OffsetGhost : LostSoul
{
States
{
Spawn:
SKUL A 1
SKUL AB 6 Bright A_SpriteOffset(12, 0)
Goto Spawn + 1
}
}
// A pistol whose shot kicks the view up and a little to the side, then settles it back, while the aim stays put.
actor RecoilPistol : Pistol
{
States
{
Fire:
PISG A 4
PISG B 0 A_FirePistol
PISG B 3 A_SetViewPitch(-3, SPF_INTERPOLATE)
PISG B 0 A_SetViewRoll(2, SPF_INTERPOLATE)
PISG C 4 A_SetViewPitch(0, SPF_INTERPOLATE)
PISG C 0 A_SetViewRoll(0, SPF_INTERPOLATE)
PISG B 5 A_ReFire
Goto Ready
}
}
// A security camera that keeps looking straight north and level, whichever way it is turned on the map.
actor FixedSecurityCamera
{
+NOGRAVITY
+NOINTERACTION
+ABSVIEWANGLES
States
{
Spawn:
TNT1 A 1
TNT1 A -1 A_SetViewAngle(90)
Stop
}
}
SpriteRotation turns which of an actor's rotations is drawn, as if the actor faced that many degrees further
counter-clockwise; models turn by it too, and the automap's arrow. +SPRITEANGLE draws the rotation for
SpriteAngle whatever the actor's own angle and the view's. A_SetSpriteAngle(angle, ptr) and
A_SetSpriteRotation(angle, ptr) change them, and GetSpriteAngle(ptr) and GetSpriteRotation(ptr) read them. In a
netgame the server sends each change, and a client that joins later gets them.
// A statue that always shows its front, and a turret whose drawn rotation lags a quarter turn behind its aim.
actor FacingStatue
{
Radius 16
Height 56
+SOLID
+SPRITEANGLE
SpriteAngle 0
States
{
Spawn:
POSS A -1
Stop
}
}
actor LaggingTurret
{
Radius 16
Height 56
+SOLID
SpriteRotation 90
States
{
Spawn:
POSS A 10 A_JumpIf(GetSpriteRotation() > 0, "Settle")
Loop
Settle:
POSS A 5 A_SetSpriteRotation(Max(GetSpriteRotation() - 15, 0))
Goto Spawn
}
}
Warping and particles
A_Warp takes UZDoom's last three parameters, heightoffset, radiusoffset and pitch:
A_Warp(ptr, xofs, yofs, zofs, angle, flags, success_state, heightoffset, radiusoffset, pitch). The height offset adds
that many of the reference's heights to zofs, the radius offset puts the caller that many of the reference's radii
further along the angle, and pitch sets or, with WARPF_COPYPITCH, adds to the pitch. WARPF_COPYVELOCITY gives the
caller the reference's velocity, and WARPF_USETID reads ptr as a TID (0 is the caller). AAPTR_LINETARGET is the
actor the caller aims at, for any function that takes a pointer.
A_SpawnParticle(color, flags, lifetime, size, angle, xoff, yoff, zoff, velx, vely, velz, accelx, accely, accelz, startalphaf, fadestepf, sizestep) spawns one particle: SPF_FULLBRIGHT, SPF_RELPOS, SPF_RELVEL, SPF_RELACCEL
and SPF_RELANG (or SPF_RELATIVE for all four turns) take the offsets and the angle from the caller's, and
SPF_NOTIMEFREEZE keeps it moving while time is frozen. A negative fadestepf fades it out over its lifetime. In a
netgame each client spawns its own, as for every particle; the server spawns none.
// A wisp that trails glowing sparks and stays at its master's eye level, a little ahead of it.
actor TrailWisp
{
Radius 4
Height 8
+NOINTERACTION
States
{
Spawn:
TNT1 A 1 A_SpawnParticle("Gold", SPF_FULLBRIGHT|SPF_RELATIVE, 20, 3, 0, -4, 0, 0, -1, 0, 0.5)
TNT1 A 0 A_Warp(AAPTR_MASTER, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION, "", 0.75, 1.5)
Loop
}
}
Anonymous functions
A frame's action can be a { } block of statements instead of one call, as in UZDoom.
| Kind | Allowed |
|---|---|
| Statements | if, else if, else, while, do ... while, for, break, continue, return; every body in braces |
| Calls | Action functions, with or without parentheses; line specials as functions |
| Assignments | =, +=, -=, *=, /=, %=, <<=, >>=, >>>=, &=, |=, ^=, ++ and -- before or after, on user variables, user array elements, and angle, pitch, roll, alpha, scalex and scaley |
| Expressions | bool(x), int(x) and float(x) casts; a bare word as a query's class or cvar or CheckClass's class, so GetCVar(name) is GetCVar("name") |
| Returns | return state("Label"), return state(N), return A_Jump(...) and other jumps, return true or false in an item's chain |
An action's jump is taken only when the block returns it; A_Jump(256, "Pain"); alone does nothing. An action that
UZDoom gives no state back from sets its state itself, as A_CountdownArg(0, "Expire"); and A_Overlay do. An action's
success is its value, so if (A_GiveInventory("Key")) asks whether the item was taken. In a weapon, a label is the
weapon's and a variable or inventory count is the player's. A native field is written as its action writes it, so
angle += 45; is A_SetAngle(angle + 45); and scalex *= 2; reaches every player as A_SetScale does; a pitch
reads signed, -10 for 10 degrees up.
As in UZDoom, every return in a block gives the same kind: nothing, a state, or a value. A block that does not end
in a return (or in an if and else that both do) ends in a bare one. So a block that returns a state on some
paths must return one on every path, or the load stops with "Return type mismatch". break or continue outside a
loop stops the load. An if with nothing on either side is dropped with its condition, so
if (A_GiveInventory("Key")) { } gives nothing. On a line of several frames, such as TNT1 AB 0 { ... }, the
block runs on each frame, and a jump offset or state(N) counts from the line's first frame.
// A cacodemon that bursts into a ring of eight balls when it dies.
actor RingCacodemon : Cacodemon
{
var int user_i;
States
{
Death:
HEAD G 8
{
for (user_i = 0; user_i < 8; user_i++)
{
A_SpawnItemEx("CacodemonBall", 0, 0, 24, 6, 0, 0, user_i * 45, SXF_NOCHECKPOSITION);
}
}
HEAD H 8 A_Scream
HEAD IJ 8
HEAD K 8 A_NoBlocking
HEAD L -1 A_SetFloorClip
Stop
}
}
// A zombie that stops to reload after every fifth shot.
actor ReloadingZombie : ZombieMan
{
var int user_shots;
States
{
Missile:
POSS E 10 A_FaceTarget
POSS F 8
{
A_PosAttack();
user_shots++;
if (user_shots >= 5)
{
user_shots = 0;
return state("Reload");
}
return state("See");
}
Reload:
POSS A 35
Goto See
}
}
// A pistol that fires three shots for each press of the trigger.
actor BurstCount : Inventory
{
Inventory.MaxAmount 3
}
actor BurstPistol : Pistol
{
States
{
Fire:
PISG A 4
PISG B 3
{
A_FireBullets(5.6, 0, 1, 5, "BulletPuff", FBF_USEAMMO);
A_PlaySound("weapons/pistol", CHAN_WEAPON);
A_GiveInventory("BurstCount");
if (CountInv("BurstCount") < 3)
{
return state("Fire");
}
A_TakeInventory("BurstCount", 3);
return state("Rest");
}
Rest:
PISG C 4
PISG B 5 A_ReFire
Goto Ready
}
}
// A field kit only a hurt player picks up, healing half of what they are missing.
actor FieldKit : CustomInventory
{
Inventory.PickupMessage "Picked up a field kit."
States
{
Spawn:
MEDI A -1
Stop
Pickup:
TNT1 A 0
{
if (health >= 100)
{
return false;
}
A_GiveInventory("Health", (100 - health) / 2);
return true;
}
Stop
}
}
// A spark that swells, fades and spins until it is gone, its size set by a cvar named without quotes.
actor SwellingSpark
{
+NOGRAVITY
+NOINTERACTION
RenderStyle Add
States
{
Spawn:
BAL1 A 0 NoDelay
{
scalex = 0.5 + float(GetCVar(sv_gravity) > 0) * 0.5;
scaley = scalex;
}
Swell:
BAL1 A 1 Bright
{
scalex *= 1.05;
scaley = scalex;
alpha -= 0.04;
angle += 10;
}
BAL1 A 0 A_JumpIf(alpha <= 0, "Null")
Loop
}
}
A player class may call A_Overlay from its own frames, as in UZDoom. Its layer runs the class's
states, with or without a weapon up, and stays through weapon changes. A_Overlay gives whether it set the layer and
A_ClearOverlays how many layers it cleared.
// A marine whose visor glows on a layer of their own, put up once and kept through every weapon switch.
actor VisorMarine : DoomPlayer
{
States
{
Spawn:
PLAY A 1
{
if (A_Overlay(-5, "Visor", true))
{
A_ClearOverlays(-9, -6);
}
}
Loop
Visor:
TNT1 A 35
TNT1 A 0 A_JumpIf(CheckClass(VisorMarine), "Visor")
Stop
}
}
Properties
Threshold, DefThreshold, InfightingGroup, ProjectileGroup, SplashGroup, MissileChanceMult,
SelfDamageFactor, StealthAlpha, FriendlySeeBlocks, MinRespawnTics, RespawnDice, ThruBits.
// An imp clan: no infighting, fireballs that pass one another, blasts that spare one another, half as trigger-happy,
// slow to drop a grudge, and back from the dead no sooner than 30 seconds on Nightmare.
actor ClanImp : DoomImp
{
InfightingGroup 1
ProjectileGroup 1
SplashGroup 1
MissileChanceMult 0.5
Threshold 100
DefThreshold 100
MinRespawnTics 1050
RespawnDice 2
}
// A stalking cyberdemon that fades to a fifth while it hunts, sees friendly monsters 20 blocks away, and takes a quarter of its own rockets' blast.
actor StalkerCyber : Cyberdemon
{
+STEALTH
StealthAlpha 0.2
FriendlySeeBlocks 20
SelfDamageFactor 0.25
}
Movement, items and powerups
| Property | Effect |
|---|---|
PushSound |
Played on the body channel when something pushes this +PUSHABLE actor, unless it is already playing. ACS PlayActorSound plays it as SOUND_Push (10). |
MaxSlopeSteepness |
The floor normal's height below which a slope is too steep to stand on: the actor slides down it and cannot walk up it. 0.7071 (46342/65536) by default; 0 makes every slope walkable. |
LandingSpeed |
How fast an actor must land, as a negative speed, for a player's view to squat and an Ice actor to stop dead. -8 by default. |
FloatBobStrength |
Scales a +FLOATBOB actor's bob. 1 by default, 0 for none. |
FloatBobFactor |
Scales how fast the bob runs. 1 by default; it must be above 0. |
Ammo.DropAmmoFactorMultiplier |
Scales the share of this ammo that a killed monster drops, on top of the skill's. 1 by default. |
PuzzleItem.FailSound |
Played when the item is used where nothing takes it, in place of the player's *puzzfail. |
Player.WaterClimbSpeed |
The upward speed of a player climbing out of water up a ledge. 3.5 by default; 0 means no climb. |
PowerMorph.MonsterClass |
A monster that gets this powerup turns into that class until it runs out. The class must come from MorphedMonster. |
PowerReflection.ReflectType |
Any value but 0 reflects an attack with its own damage type instead of Reflection. |
// A crate that scrapes when shoved, a lantern that bobs slowly and only a little, and a spider that climbs slopes no other monster can.
actor ScrapingCrate
{
Radius 24
Height 48
Mass 200
PushSound "crate/scrape"
+SOLID
+PUSHABLE
States
{
Spawn:
CRAT A -1
Stop
}
}
actor BobbingLantern
{
+NOGRAVITY
+FLOATBOB
FloatBobStrength 0.25
FloatBobFactor 0.5
States
{
Spawn:
LANT A -1 Bright
Stop
}
}
actor ClimbingSpider : Arachnotron
{
MaxSlopeSteepness 0
}
// An ice golem that slides on until it lands hard, and a diver who climbs out of water at twice the stock speed.
actor IceGolem : Demon
{
DamageType "Ice"
LandingSpeed -20
}
actor Diver : DoomPlayer
{
Player.WaterClimbSpeed 7
}
// Shells that monsters drop at twice the usual share, and a rune that grumbles when it does not fit.
actor RichShell : Shell
{
Ammo.DropAmmoFactorMultiplier 2
}
actor GrumbleRune : PuzzleItem
{
PuzzleItem.Number 3
PuzzleItem.FailSound "rune/grumble"
Inventory.Icon "RUNEA0"
States
{
Spawn:
RUNE A -1
Stop
}
}
// A curse that turns a monster into a chicken for ten seconds, and a mirror that throws fire back as fire.
actor Chicken : MorphedMonster
{
Health 10
Speed 8
Radius 12
Height 24
States
{
Spawn:
CHKN A 4 A_Look
Loop
See:
CHKN AB 3 A_Chase
Loop
}
}
actor PowerChickenHex : PowerMorph
{
PowerMorph.MonsterClass "Chicken"
Powerup.Duration 350
}
actor ChickenHex : PowerupGiver
{
+INVENTORY.AUTOACTIVATE
Powerup.Type "PowerChickenHex"
}
actor PowerFireMirror : PowerReflection
{
PowerReflection.ReflectType 1
}
A monster gets the curse from a projectile or a script, for example with A_GiveInventory("ChickenHex", 1, AAPTR_TRACER).
The view, weapons and drawing
| Property | Effect |
|---|---|
CameraFOV |
The field of view a player sees through this actor when it is their camera (ChangeCamera, Thing_SetCamera). 90 by default. |
Player.ViewBob |
Scales how high the view and the weapon bob, held between 0 and 1.5. 1 by default. |
Player.ViewBobSpeed |
How many tics one view bob takes. 20 by default; 0 stops the bob from moving. |
Player.FlyBob |
Scales how much a flying player's body bobs. 1 by default, 0 for none. |
Weapon.WeaponScaleX, Weapon.WeaponScaleY |
The scale the weapon's layers draw at, its flash and overlays included. 1.0 and 1.2 by default, Doom's aspect; the height grows up from the bottom of the view. |
Weapon.LookScale |
Scales how far the mouse and the joystick turn and look while the weapon is held, on top of any zoom's FOVScale. 0 (no change) by default. |
Inventory.AltHUDIcon |
The icon the alternative HUD (hud_althud) draws for the item, in place of its Inventory.Icon. |
DistanceCheck |
Names an int CVar: the actor is not drawn at that distance from the view or farther. 0 hides it always, a negative value never. Classes that inherit from it keep it. |
RenderRequired, RenderHidden |
Renderer features as a sum of bits: the actor is not drawn when the renderer lacks one it requires or has one it hides from. |
SpriteAngle |
The angle in degrees whose rotation a +SPRITEANGLE actor is drawn with. 0 by default. |
SpriteRotation |
Degrees added to the actor's angle when its rotation, model or automap arrow is picked. 0 by default. |
The features, as numbers, since DECORATE has no names for them: flat sprites 1, models 2, sloped 3D floors 4, full freelook 8,
roll sprites 16, unclipped sprites 32, material shaders 64, post-processing shaders 128, brightmaps 256, custom COLORMAP lumps 512,
polygon rendering 1024, truecolor 2048, voxels 4096. Our renderers have all but unclipped sprites (32) and custom COLORMAP
lumps (512), as UZDoom's hardware renderers do; voxels while r_drawvoxels is on. r_showcaps lists them.
// A security monitor that shows its room through a narrow 60-degree lens.
actor NarrowMonitorCam
{
CameraFOV 60
+NOGRAVITY
+NOINTERACTION
States
{
Spawn:
TNT1 A -1
Stop
}
}
// A heavy marine whose view bobs half as high and half as fast, and whose body hangs still while flying.
actor HeavyMarine : DoomPlayer
{
Player.ViewBob 0.5
Player.ViewBobSpeed 40
Player.FlyBob 0
}
// A wide cannon drawn twice as wide and tall as other weapons, slow to turn with, and a key whose alternative HUD icon is a plain glyph.
actor WideCannon : Weapon
{
Weapon.WeaponScaleX 2.0
Weapon.WeaponScaleY 2.4
Weapon.LookScale 0.5
Weapon.AmmoUse 0
States
{
Ready:
CANN A 1 A_WeaponReady
Loop
Deselect:
CANN A 1 A_Lower
Loop
Select:
CANN A 1 A_Raise
Loop
Fire:
CANN A 10
Goto Ready
}
}
actor GlyphKey : RedCard
{
Inventory.AltHUDIcon "GLYPA0"
}
A CVar the player sets in the options decides how far grass is drawn, in CVARINFO:
// CVARINFO
user int grass_drawdist = 1024;
// Grass tufts drawn only within the player's chosen distance, and a lamp drawn only by renderers that have models (2).
actor GrassTuft
{
DistanceCheck "grass_drawdist"
+NOINTERACTION
States
{
Spawn:
GRAS A -1
Stop
}
}
actor ModelLamp
{
RenderRequired 2
+NOINTERACTION
States
{
Spawn:
MLMP A -1
Stop
}
}
Flags
| Flag | Effect |
|---|---|
+LAXTELEFRAGDMG |
Telefrag damage is cut by damage factors, armour and protection like any other. |
+FORCEZERORADIUSDMG |
A blast of zero damage still reaches what it covers, for pain and its specials. |
+HITOWNER |
A missile can hit the actor that fired it. |
+STOPRAILS |
A rail stops at this actor. |
+NOSHIELDREFLECT |
A missile explodes on a shield instead of being turned aside. |
+ICESHATTER |
Ice damage from this inflictor shatters frozen corpses. |
+SMASHABLE |
Dies on landing. |
+NOINFIGHTSPECIES |
Never turns on its own species. |
+FORCEINFIGHTING |
Turns on whoever hurts it, whatever the map or skill says about infighting. |
+FRIGHTENING |
Monsters chasing this actor run from it, as from a player with the frightening cheat. |
+SEEFRIENDLYMONSTERS |
A hostile monster also goes after friendly monsters. |
+DONTFOLLOWPLAYERS |
A friendly monster with nothing to fight stays put. |
+MINVISIBLE |
Monsters cannot see this actor. |
+MVISBLOCKED |
Sight checks to this actor always fail. |
+DONTFACETALKER |
A conversation leaves this actor facing where it was. |
+RETARGETAFTERSLAM |
A charge that slams into something goes idle instead of chasing. A class can also give a Slam state. |
+ONLYSLAMSOLID |
A charge passes through what is neither solid nor shootable. |
+NOAUTOOFFSKULLFLY |
A charge does not end when the actor stops moving. |
+GETOWNER |
A fast projectile's trail takes the shooter as its target, not the projectile. |
+DONTBOUNCEONSHOOTABLES |
A bouncing projectile explodes on a shootable actor instead of bouncing. |
+SPRITEANGLE |
The actor is drawn with the rotation for its SpriteAngle, whichever way it and the view face. |
+BOUNCEONUNRIPPABLES |
A bouncing ripper bounces off actors it cannot rip; otherwise a ripper rips through shootable actors rather than bouncing. |
+DONTBOUNCEONSKY |
A bouncer vanishes into a sky floor, ceiling or wall. |
+KEEPBOUNCEANGLE |
A bounce leaves the actor's angle as it was. |
+ALLOWTHRUBITS |
Actors sharing a ThruBits group with this one pass through it. |
+ALLOWTHRUFLAGS |
A hitscan's puff passes actors by its own THRUACTORS, THRUSPECIES and ThruBits. |
+BOUNCEMODIFIESPITCH |
A bounce points the actor's pitch along its new velocity. |
+NOSECTORDAMAGE |
Damaging sectors, 3D floors and TERRAIN flats do not hurt this actor (crushers still do). |
+FORCESECTORDAMAGE |
A monster takes a sector's damage even where the sector does not hurt monsters. |
+MASTERNOSEE |
Not drawn in its master's own view (a chase camera still shows it). |
+ABSVIEWANGLES |
A_SetViewAngle, A_SetViewPitch and A_SetViewRoll set the view's own angles instead of turning it from the actor's. |
+NOSAVEGAME |
The actor is left out of savegames, and anything pointing at it points at nothing after a load. |
+PLAYERPAWN.MAKEFOOTSTEPS |
The player's steps sound, and splash, from the floor's TERRAIN while they walk. |
Monsters (and voodoo dolls) take a sector's damage, a damaging 3D floor's and a TERRAIN flat's where the sector, or the 3D floor's
control sector, hurts monsters (UDMF hurtmonsters).
// A fire imp that walks lava unharmed, and a zombie that burns in any damaging sector, hurtmonsters or not.
actor FireImp : DoomImp
{
+NOSECTORDAMAGE
}
actor FrailZombie : ZombieMan
{
+FORCESECTORDAMAGE
}
// Rising embers that are only for show, so a savegame does not keep them.
actor PassingEmber
{
RenderStyle Add
+NOINTERACTION
+NOSAVEGAME
States
{
Spawn:
PUFF AB 4 Bright A_FadeOut(0.1)
Loop
}
}
A MAKEFOOTSTEPS player steps on the floor's TERRAIN. StepSounds plays one sound for either foot; without it the
feet take turns between LeftStepSounds and RightStepSounds. A step comes every WalkStepTics tics, or
RunStepTics when running, or, with StepDistance set, each time the player covers that distance while moving
faster than StepDistanceMinVel. Each step plays at StepVolume times the player's snd_footstepvolume, and makes
the terrain's small splash (a full one for a player of Mass 200 or more). Every player hears every player's steps.
// TERRAIN
terrain StoneSteps
{
stepsounds footstep/stone
stepvolume 0.7
walksteptics 12
runsteptics 7
}
terrain GravelSteps
{
leftstepsounds footstep/gravelleft
rightstepsounds footstep/gravelright
stepvolume 0.8
stepdistance 56
stepdistanceminvel 3
}
floor FLAT5_4 StoneSteps
floor FLAT10 GravelSteps
// A marine whose steps sound from the floor.
actor SteppingMarine : DoomPlayer
{
+PLAYERPAWN.MAKEFOOTSTEPS
}
// A brute that turns on whoever hurts it even where infighting is off, but never on its own kind; a hunter of the
// player's friendly monsters; and a guard dog that stays put when idle and that monsters chasing it run from.
actor Brute : HellKnight
{
+FORCEINFIGHTING
+NOINFIGHTSPECIES
}
actor FriendHunter : Revenant
{
+SEEFRIENDLYMONSTERS
}
actor GuardDog : Demon
{
+FRIENDLY
+DONTFOLLOWPLAYERS
+FRIGHTENING
}
// A ghost monsters never notice, and a decoy no monster's sight check ever reaches.
actor UnseenGhost : ZombieMan
{
+MINVISIBLE
}
actor SightlessDecoy : ZombieMan
{
+MVISBLOCKED
}
// A boomerang that can hit its thrower on the way back, a rail-proof barrier, and a frost burst that shatters
// frozen corpses and, at zero damage, still makes everything in it flinch.
actor Boomerang : Rocket
{
+HITOWNER
}
actor RailBarrier
{
Radius 32
Height 64
Health 500
+SOLID
+SHOOTABLE
+NOBLOOD
+STOPRAILS
States
{
Spawn:
COL1 A -1
Stop
}
}
actor FrostBurst
{
+NOGRAVITY
+ICESHATTER
+FORCEZERORADIUSDMG
States
{
Spawn:
TNT1 A 1 A_Explode(0, 192, 0)
Stop
}
}
// A heavy rocket no shield turns aside, a boss a telefrag only wounds, a crate that breaks when it lands, a hitscan trail
// that credits the shooter, and an informant who keeps facing the wall while you talk.
actor HeavyRocket : Rocket
{
+NOSHIELDREFLECT
}
actor TeleproofBaron : BaronOfHell
{
+LAXTELEFRAGDMG
}
actor FallingCrate
{
Radius 16
Height 32
Health 20
+SHOOTABLE
+SMASHABLE
+NOBLOOD
States
{
Spawn:
CBRA A -1
Stop
Death:
CBRA A 1 A_NoBlocking
Stop
}
}
actor OwnerTrail : FastProjectile
{
Speed 120
Damage 3
MissileType "PlasmaBall"
+GETOWNER
}
actor Informant : ZombieMan
{
+DONTFACETALKER
}
// A grenade that explodes on monsters instead of bouncing off them, vanishes into the sky, keeps its heading as it
// bounces and tips its nose along each bounce; and a ripping disc that bounces off what it cannot rip.
actor ContactGrenade
{
Radius 4
Height 4
Speed 20
Damage 20
Projectile
-NOGRAVITY
BounceType "Doom"
+DONTBOUNCEONSHOOTABLES
+DONTBOUNCEONSKY
+KEEPBOUNCEANGLE
+BOUNCEMODIFIESPITCH
States
{
Spawn:
MISL A 1
Loop
Death:
MISL B 8 Bright A_Explode
Stop
}
}
actor RippingDisc
{
Radius 8
Height 8
Speed 25
Damage 4
Projectile
+RIPPER
RipperLevel 1
BounceType "Doom"
+BOUNCEONUNRIPPABLES
States
{
Spawn:
BAL7 AB 3 Bright
Loop
Death:
BAL7 CDE 4 Bright
Stop
}
}
UZDoom's render flags are on their own page, and MBF's movement flags on MBF21 in DECORATE.
+FULLVOLDEATH now also makes a monster's death scream full volume, as in UZDoom.
In a netgame, A_ChangeFlag on a render flag (such as INVISIBLE) or a bounce flag now reaches every client and
players who join later. Before, only the server's copy changed.
// A charger that stays put after a slam, passes through pickups, and cannot be hurt by its own kind.
actor Rammer : LostSoul
{
+RETARGETAFTERSLAM
+ONLYSLAMSOLID
+NOINFIGHTSPECIES
}
// A floating halo over whoever picks it up: everyone else sees it, and it is never in its wearer's own way.
actor HaloGiver : CustomInventory
{
Inventory.PickupMessage "A halo settles over you"
States
{
Spawn:
SOUL ABCD 6 Bright
Loop
Pickup:
TNT1 A 0 A_SpawnItemEx("Halo", 0, 0, 64, 0, 0, 0, 0, SXF_SETMASTER|SXF_NOCHECKPOSITION)
Stop
}
}
actor Halo
{
+NOGRAVITY
+NOINTERACTION
+MASTERNOSEE
RenderStyle Add
Alpha 0.6
States
{
Spawn:
SOUL A 1 Bright A_Warp(AAPTR_MASTER, 0, 0, 64, 0, WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE)
Loop
}
}
Item and weapon flags
| Flag | Effect |
|---|---|
+INVENTORY.ISHEALTH |
sv_nohealth removes the item from a deathmatch or team map, or from any map under alwaysapplydmflags. |
+INVENTORY.ISARMOR |
sv_noarmor does the same. |
+INVENTORY.ISKEYITEM |
Marks a key or puzzle item, for A_CheckFlag. |
+INVENTORY.NOSCREENBLINK |
A powerup's screen colour does not blink as it runs out. |
+INVENTORY.NOTELEPORTFREEZE |
While this powerup runs, a teleport does not freeze its owner. A powerup giver hands the flag on to its powerup. |
+WEAPON.NODEATHDESELECT |
The weapon stays up when its holder dies. |
+WEAPON.NODEATHINPUT |
A dead holder cannot fire the weapon, switch from it or use its buttons. Without it, a weapon left up still takes them. |
The stock items carry these flags as in UZDoom:
- Health items, the berserk pack and the megasphere are health.
- Armor and the megasphere are armor.
- Keys and puzzle items are key items.
- The speed boots and the Tome of Power never freeze a teleport.
sv_nohealth and sv_noarmor now go by these flags alone. An item a mod flags is removed too, and so are Hexen's and
Strife's carried health items.
| Property | Effect |
|---|---|
Player.TeleportFreezeTime |
Tics a teleport freezes the player for: 18 by default, 0 for none. |
PowerSpeed.NoTrail |
Any value but 0 leaves no speed trail, as +POWERSPEED.NOTRAIL does. |
// A light amplification visor that never flickers, and lets its wearer step off a teleporter running.
actor PowerSteadyVisor : PowerLightAmp
{
+INVENTORY.NOSCREENBLINK
+INVENTORY.NOTELEPORTFREEZE
}
actor SteadyVisor : PowerupGiver
{
+INVENTORY.AUTOACTIVATE
+INVENTORY.ALWAYSPICKUP
Inventory.PickupMessage "Steady visor"
Powerup.Type "PowerSteadyVisor"
States
{
Spawn:
PVIS A 6 Bright
PVIS B 6
Loop
}
}
// A ration pack that sv_nohealth removes like a stimpack, and a vault pass marked as a key item like the stock keys.
actor Ration : Inventory
{
+INVENTORY.ISHEALTH
Inventory.PickupMessage "Ration pack"
States
{
Spawn:
MEDI A -1
Stop
}
}
actor VaultPass : Inventory
{
+INVENTORY.ISKEYITEM
+INVENTORY.UNDROPPABLE
Inventory.PickupMessage "Vault pass"
States
{
Spawn:
BKEY A -1
Stop
}
}
// A deadman's pistol: still raised after its holder falls, and its trigger dead with them.
actor DeadmansPistol : Pistol
{
+WEAPON.NODEATHDESELECT
+WEAPON.NODEATHINPUT
}
// A runner who pauses only 5 tics after a teleport, and speed boots that leave no trail.
actor Sprinter : DoomPlayer
{
Player.TeleportFreezeTime 5
}
actor PowerQuietSpeed : PowerSpeed
{
PowerSpeed.NoTrail 1
}
Differences from UZDoom
GetZAtdoes not look through portals.A_CheckBlock'sCBF_DROPOFFstill tests lines and actors.- A
+NOSECTORDAMAGEplayer still finds a secret sector, where UZDoom skips the sector altogether. A_RadiusThrust's species matches an actor with noSpeciesby its class's own, asA_CheckSpeciesdoes; UZDoom matches it only once something has looked its species up.A_RadiusGivemeasures height from the caller's middle, as ZDoom always did; UZDoom measures from its feet. Spectators receive nothing.A_CheckForResurrection("Raise")names a state by its label here; UZDoom's DECORATE refuses a label for that parameter, so a mod meant for both calls it without one and usesHeal.A_SetBlendwith neithercolor2noralpha2fades out in its own colour; UZDoom's fades toward black.- A running-out powerup blinks on the other half of each 16-tic beat from UZDoom's.
- A monster turned by
PowerMorph.MonsterClassstays turned until the powerup runs out. In UZDoom it turns back on the next tic, because its morph time overflows. The class must come fromMorphedMonster, which UZDoom no longer requires. PowerReflection.ReflectTypefollows the first reflection powerup held. UZDoom follows the one that reflects the most damage, but here every one reflects the same three quarters.- Dropping Strife's gold never gives a piece worth more than the dropper holds, and an
amountof 0 drops none. UZDoom drops a 10 or 25 piece for less, such as a 10 for 5 gold, and a coin for 0. - A sprite shifted by
A_SpriteOffsetis drawn unshifted by the legacy OpenGL renderer; Vulkan and OpenGL shift it. - A particle from
A_SpawnParticlelives at most 255 tics. - A string or name parameter takes a call here, such as
A_SetUserVar(GetCVarString("myvar"), 1); UZDoom's DECORATE takes only a quoted string there and stops loading. GetSpriteAngleandGetSpriteRotationread in DECORATE here, as GZDoom's DECORATE read them before ZScript; UZDoom has them only in ZScript and stops loading DECORATE that calls them.- A view pitched past 90 degrees up or down by
A_SetViewPitch(a camera withoutSPF_FORCECLAMP) is drawn at 90. +INVENTORY.NEVERLOCALis not here: it serves UZDoom'ssv_nolocaldrops, which has no counterpart.- Footsteps: another player's walking and running are judged from their speed, since only the server has their
input. A savegame does not keep the step rhythm. TERRAIN's older
WalkingStepTimeandRunningStepTimestill load, in seconds, where UZDoom refuses them. A tic sounds at most 8 steps, however shortStepDistanceis. - Not here yet: the render flags not on their page, and the player-movement and shadow flags.
- An anonymous function that loops more than 1,048,576 times in one run stops with a console error; UZDoom's hangs.
- A weapon's or item's own variable read in a state that a weapon or pickup state chain reaches loads here, with the warning, and reads the player's variable. UZDoom stops loading with "Unsafe state call".
- An anonymous function may write only the native fields
angle,pitch,roll,alpha,scalexandscaley; writing another, such asspeed = 5;, stops the load with the action to use instead (A_SetSpeed).