Below is my zscript:
Code: Select all
class MarineChatty : ScriptedMarine
{
Default
{
Health 100;
Radius 16;
Height 56;
Mass 100;
Speed 8;
Painchance MARINE_PAIN_CHANCE;
MONSTER;
-COUNTKILL;
Translation 2;
Damage 100;
DeathSound "*death";
PainSound "*pain50";
}
States
{
Spawn:
PLAY A 4 A_MarineLook;
PLAY A 4 A_MarineNoise;
PLAY A 4 setPost;
Goto Idle;
Idle:
PLAY A 4 A_MarineLook;
PLAY A 4 A_MarineNoise;
PLAY A 4 A_MarineLook;
PLAY B 4 A_MarineNoise;
PLAY B 4 A_MarineLook;
PLAY B 4 A_MarineNoise;
Loop;
See:
PLAY ABC 4 A_MarineChase;
PLAY D 4 A_JumpIf(LookForEnemies(true) == 0, "ReturnToPost");
Loop;
ReturnToPost:
PLAY A 4 A_ClearTarget;
PLAY BCD 4 A_MarineLook;
Travelling:
PLAY A 1 A_JumpIf(travelToPost() == 0, "Idle");
PLAY BCD 4 A_MarineLook;
Loop;
Missile:
PLAY E 3 A_M_CheckAttack;
PLAY F 7 BRIGHT A_M_FireShotgun;
Goto See;
Death:
PLAY H 1
PLAY I 10 A_Scream;
PLAY J 10 A_NoBlocking;
PLAY KLM 10;
PLAY N -1;
Stop;
}
Vector3 postPosition;
void setPost()
{
postPosition.x = self.Pos.x;
postPosition.Y = self.Pos.Y;
postPosition.Z = self.Pos.Z;
}
bool travelToPost()
{
if(postPosition.x == self.Pos.x && postPosition.Y == self.Pos.Y)
{
return FALSE;
}
Vector2 v;
v.X = postPosition.X;
v.Y = postPosition.Y;
if(CheckMove(v))
{
SetOrigin(postPosition, TRUE);
return TRUE;
}
return FALSE;
}
}