Code: Select all
class TestGuy : Actor
{
int cooldown;
property cooldown : cooldown;
override void Tick()
{
Super.Tick();
//decrement once per tic till you reach 0
if (cooldown > 0)
cooldown--;
}
Default
{
TestGuy.cooldown 39; //define default cooldown for the unit
Health 100;
Radius 20;
Height 30;
MeleeRange 50;
Speed 5;
PainChance 0;
PainChance "Hammer", 256;
Monster;
+FLOORCLIP
+THRUACTORS
//+DONTTHRUST
+NOBOUNCESOUND
SeeSound "guy/spawn";
//PainSound "guy/attack";
//attack sound will be called in attack state
DeathSound "guy/die";
//ActiveSound "imp/active";
Tag "TestGuy";
}
States
{
Spawn:
TNT1 A 1; //A_PlaySound("guy/spawn")
Goto See;
See:
POSS AABBCCDD 4 A_Chase("Coolcheck","null", CHF_NOPLAYACTIVE|CHF_NORANDOMTURN|CHF_NOPOSTATTACKTURN);
Loop;
Coolcheck:
POSS B 1
{
//check cooldown
if (cooldown < 1) //check if the integer is 0
{
return ResolveState("Attackin"); //go to state Attackin
}
return ResolveState("See");
}
Loop;
Attackin:
POSS E 10
{
cooldown += 49; //increase cooldown to max
}
POSS F 10 A_CustomMeleeAttack(8,"guy/attack","");
Goto See;
Pain.Hammer:
TNT1 A 0 ThrustThing(angle * 256 / 360 + 128, 6, 0, 0);
POSS H 2;
POSS H 2 A_Pain;
Goto See;
Death:
POSS H 50
{
ThrustThingZ(0, 50, 0, 1);
ThrustThing(angle * 256 / 360 + 128, 6, 0, 0);
A_ChangeFlag("BOUNCEONFLOORS", true);
A_NoBlocking;
}
TNT1 A 0 A_Scream;
Stop;
}
}Code: Select all
POSS AABBCCDD 4 A_Chase("Coolcheck","null", CHF_NOPLAYACTIVE|CHF_NORANDOMTURN|CHF_NOPOSTATTACKTURN);However, this removes my ability to add the flags I need for proper functionality, namely 'CHF_NOPLAYACTIVE|CHF_NORANDOMTURN|CHF_NOPOSTATTACKTURN'.
May I get some help with this, namely, fixing A_Chase so that it doesn't delete the character out of nowhere? Many thanks. This is my first time with ZScript.