The maximum safety for states

Alright so, let’s say for instance there is a state which is a state that is a state that you don’t ever want to leave it, instance dead state, which you don’t want pawns to ever leave it due to that you don’t want ragdolls moving around or some like that, any way to say to your class, this state is permanent?

As far as I’m aware, there should be no state changes called via native code, so only via unrealscript. So if it’s leaving it’s dead state, then that is essentially a bug in the code. Just drop some logging (and ScriptTrace()) in ExitState() and find where the bug is.

I guess you could create your own _SetState() and replace all calls with that, then exit if it’s in the dead state, but that feels like a hack rather than accounting for error calls elsewhere in script.

Thanks cold scooter for your help, sadly there is not such a thing Permanent states all one can do it’s blank functions inside the states.
GoToStateEatBanana(){self.GoToState(‘EatBanana’);}
state EatBanana
{
GoToStateEatBanana( ) {coolaccentLOG(“PermaState becareful”);}
}

@Neongho I may not be fully understanding, but in the EndState() function, you have NextStateName, so logging that would at least help you track down what’s calling the new state change.

I also believe you can just add:



event BeginState(name PreviousStateName)
{
    super.BeginState(PreviousStateName);
}
event EndState(name NextStateName)
{
    super.EndState(NextStateName);
}


outside of any state, and providing the state functions call the super function, these should be called. I haven’t fully tested this though.