states

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Cooban

New Member
Jul 13, 2005
6
0
0
Hello, does anyone know if there is a function which will return character back to their previous state. For example if a character is in scout state and then suddenly changes to attack state I need a function or way of returning to the scout state again therefore having virtual memory (sort of).

Thanks
 

SuperApe

Registered Monkey
Mar 20, 2004
333
0
16
Inna Jungle
wiki.beyondunreal.com
A function to do this? I don't know of one.
There is a Actor -> bBadStateCode which should cause an Event called RecoverFromBadStateCode(). I don't know how reliable that is.
But, it seems you could use the Event EndState() to set a BACKUP_State var so you can switch it back with your own function.
 

omegabyte

New Member
Jul 28, 2005
8
0
0
You could try creating an enumeration that contains IDs for each state you have, then have a variable lastState. Then you could create your own GotoState function like this:

Code:
enum StateList
{
     STATE_ATTACK,
     STATE_SCOUT,
     STATE_WHATEVER
}

var StateList lastState;
var StateList currentState;

function MyGotoState( StateList newState )
{
     switch newState
     { 
          case STATE_ATTACK:
               lastState = currentState;
               currentState = STATE_ATTACK;
               gotostate("Attack");

          case STATE_SCOUT:
               lastState = currentState;
               currentState = STATE_SCOUT;
               gotostate("Scout");

          case STATE_WHATEVER:
               lastState = currentState;
               currentState = STATE_WHATEVER;
               gotostate("Whatever");
     }
}

Then, after you've switched to attack mode, when you're ready to switch back to whatever the previous state was, just go MyGotoState( lastState );

I don't think there's any explicit function built into UT that keeps track of the last state entered. You'll probably have to keep track of the state changes yourself.