Code: Select all
virtual state A_SCLook() //called in "Spawn"
{
A_Look();
if(CheckProximity("Doomplayer", 1000, 1, CPXF_SETMASTER) && !target)
{
A_Log("I set my master, and Im following him");
target = master;
return ResolveState("SeeFriend"); //when the actor acquires player, it'll set the player to target and will send to this special See state. Not associated with the bug. I tested it.
}
return State(null);
}
virtual State A_SCChase(bool is_melee_state_there = false) /called in "See"
{
A_Log("Hi, I'm new to A_SCChase.");
if(!target)
{
return ResolveState("Spawn");
} //For some reason, sending the actor to Spawn state from Pain state when the actor is following the player crashes. It's either this block's problem or the A_SCLook's Problem
if(target && master)
{
if((target == master))
{
A_Log("Im Chasing");
return ResolveState("Seefriend");
}
else if(target != master)
{
A_Log("Trying to pursuit enemy.");
}
}
A_Log("TEST");
bSTANDSTILL = false;
//A_LookEX(0, 1, MaxTargetRange, MaxTargetRange, 360, "Missile");
if(is_melee_state_there == true && Distance2D(target) <= MeleeRange && target)
{
return ResolveState("melee");
}
if(target && Distance2D(target) <= MaxTargetRange)
{
return ResolveState("Missile");
}
A_FaceTarget();
NewChaseDir();
return State(null);
}
Pain:
PLAY G 4
{
if(target)
{
if(master)
{
if(target == master) //when the actor is following the player...
{
A_Log("I cleared my target");
A_ClearTarget();
}
}
}
}
PLAY G 4;
Goto See;
Here's the issue. When player attacks the actor on purpose when the actor is following the player, the game just crashes without any crash logs. Any solutions?
