|
Note: Wait! Stop! You do not need to copy this actor's code into your project! Here's why:
- This actor is already defined in GZDoom, there's no reason to define it again.
- In fact, trying to define an actor with the same name will cause an error (because it already exists).
- If you want to make your own version of this actor, use inheritance.
- Definitions for existing actors are put on the wiki for reference purpose only.
|
Cacodemon
|
Actor type
|
Monster
|
Game
|
(Doom)
|
DoomEd Number
|
3005
|
Class Name
|
Cacodemon
|
Spawn ID
|
19
|
Identifier
|
T_CACODEMON
|
Classes: Cacodemon
→DeadCacodemon
→StealthCacodemon
The Cacodemon has nothing better to do than to fly around and shoot purple balls at you through their mouth. They like biting up close so it's a good idea to keep your distance.
|
Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub.
|
class Cacodemon : Actor
{
Default
{
Health 400;
Radius 31;
Height 56;
Mass 400;
Speed 8;
PainChance 128;
Monster;
+FLOAT +NOGRAVITY
SeeSound "caco/sight";
PainSound "caco/pain";
DeathSound "caco/death";
ActiveSound "caco/active";
Obituary "$OB_CACO";
HitObituary "$OB_CACOHIT";
Tag "$FN_CACO";
}
States
{
Spawn:
HEAD A 10 A_Look;
Loop;
See:
HEAD A 3 A_Chase;
Loop;
Missile:
HEAD B 5 A_FaceTarget;
HEAD C 5 A_FaceTarget;
HEAD D 5 BRIGHT A_HeadAttack;
Goto See;
Pain:
HEAD E 3;
HEAD E 3 A_Pain;
HEAD F 6;
Goto See;
Death:
HEAD G 8;
HEAD H 8 A_Scream;
HEAD I 8;
HEAD J 8;
HEAD K 8 A_NoBlocking;
HEAD L -1 A_SetFloorClip;
Stop;
Raise:
HEAD L 8 A_UnSetFloorClip;
HEAD KJIHG 8;
Goto See;
}
}
extend class Actor
{
void A_HeadAttack()
{
let targ = target;
if (targ)
{
if (CheckMeleeRange())
{
int damage = random[pr_headattack](1, 6) * 10;
A_StartSound (AttackSound, CHAN_WEAPON);
int newdam = target.DamageMobj (self, self, damage, "Melee");
targ.TraceBleed (newdam > 0 ? newdam : damage, self);
}
else
{
// launch a missile
SpawnMissile (targ, "CacodemonBall");
}
}
}
}
|
Note: This is legacy code, kept for archival purposes only. DECORATE is deprecated in GZDoom and is completely superseded by ZScript. GZDoom internally uses the ZScript definition above.
|
ACTOR Cacodemon
{
Health 400
Radius 31
Height 56
Mass 400
Speed 8
PainChance 128
Monster
+FLOAT
+NOGRAVITY
SeeSound "caco/sight"
PainSound "caco/pain"
DeathSound "caco/death"
ActiveSound "caco/active"
Obituary "$OB_CACO"
HitObituary "$OB_CACOHIT"
States
{
Spawn:
HEAD A 10 A_Look
Loop
See:
HEAD A 3 A_Chase
Loop
Missile:
HEAD BC 5 A_FaceTarget
HEAD D 5 Bright A_HeadAttack
Goto See
Pain:
HEAD E 3
HEAD E 3 A_Pain
HEAD F 6
Goto See
Death:
HEAD G 8
HEAD H 8 A_Scream
HEAD IJ 8
HEAD K 8 A_NoBlocking
HEAD L -1 A_SetFloorClip
Stop
Raise:
HEAD L 8 A_UnSetFloorClip
HEAD KJIHG 8
Goto See
}
}