News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Thread Tools Display Modes
Old 17th Aug 2005, 03:57 AM   #1
Registered User
Join Date: Jul. 13th, 2005
Posts: 6

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).

Cooban is offline   Reply With Quote
Old 17th Aug 2005, 12:27 PM   #2
Registered Monkey
SuperApe's Avatar
Join Date: Mar. 20th, 2004
Location: Inna Jungle
Posts: 333
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.
- SuperApe

SuperApe is offline   Reply With Quote
Old 17th Aug 2005, 07:28 PM   #3
Registered User
Join Date: Jul. 29th, 2005
Posts: 8
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:

enum StateList

var StateList lastState;
var StateList currentState;

function MyGotoState( StateList newState )
     switch newState
          case STATE_ATTACK:
               lastState = currentState;
               currentState = STATE_ATTACK;

          case STATE_SCOUT:
               lastState = currentState;
               currentState = STATE_SCOUT;

          case STATE_WHATEVER:
               lastState = currentState;
               currentState = STATE_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.
omegabyte is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 06:37 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2015, vBulletin Solutions, Inc.

Copyright ©1998 - 2015, BeyondUnreal
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer