- Code: Select all • Expand view
States
{
Spawn:
BKAM A 0 A_StopSoundEx ("soundslot5")
BKAM AB 10 A_LookEx (0, 0, 0, 1024)
loop
Idle:
BKAM A 0 A_StopSoundEx ("soundslot5")
BKAM AB 10 A_LookEx (0, 0, 0, 1024)
BKAM A 0 A_Jump (8, "IdleNoise")
loop
IdleNoise:
BKAM A 0 A_PlaySound ("kamikazi/idle")
goto Idle
See:
BKAM A 0 A_PlaySoundEx ("kamikazi/scream", "soundslot5", 1)
BKAM A 2
TNT1 A 0 A_FaceTarget
TNT1 A 0 A_Recoil(-4.5)
TNT1 A 0 A_CheckSight("Navigate")
TNT1 A 0 A_JumpIfCloser(60, "Melee")
BKAM B 2
TNT1 A 0 A_FaceTarget
TNT1 A 0 A_Recoil(-4.5)
TNT1 A 0 A_CheckSight("Navigate")
TNT1 A 0 A_JumpIfCloser(60, "Melee")
BKAM C 2
TNT1 A 0 A_FaceTarget
TNT1 A 0 A_Recoil(-4.5)
TNT1 A 0 A_CheckSight("Navigate")
TNT1 A 0 A_JumpIfCloser(60, "Melee")
BKAM D 2
TNT1 A 0 A_FaceTarget
TNT1 A 0 A_Recoil(-4.5)
TNT1 A 0 A_CheckSight("Navigate")
TNT1 A 0 A_JumpIfCloser(60, "Melee")
Loop
CheckSee:
BKAM D 0 A_CheckSight ("Navigate")
goto See
Navigate:
BKAM AABBCCDD 2 A_Chase
goto CheckSee
Melee:
BKAM A 0 A_Die
stop
Death:
BMBE M 0 bright A_SpawnItem ("KamikaziDamage", 0, 40)
BMBE M 0 bright A_Stop
BMBE M 0 bright A_StopSoundEx ("soundslot5")
BMBE M 5 bright A_PlaySound ("weapons/rocklx")
BMBE N 5 bright
BMBE O 5 A_NoBlocking
BMBE PQRST 5
BMBE U -1
stop
}
}
The only important part is the "See" state. It constantly checks if the target is on sight, it recoils him towards the player and if close enough, he explodes. but there is a problem, if he is chasing the player and ends up in something of low height, like those MAP01 Doom 2 lamps on the imp area, he will try to chase the player using the A_Recoil method, but will be stuck to the lamp, because he tries to launch himself straight-on a lamp, as he can see the player.
There's a few ways i've thought to implement a fix to this, but i'm a bit at a loss of the decorate expressions or Zscript vars to use. A_CheckProximity could be one, maybe A_JumpIfCloser? Or maybe using Zscript to compare the distance, and if he is not making a distance progress, assume he is stuck and change to the Navigate state.
Sorry if i was a bit wordy, thanks!