News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

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

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
Cooban is offline   Reply With Quote
Old 17th Aug 2005, 11:27 AM   #2
SuperApe
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, 06:28 PM   #3
omegabyte
Registered User
 
Join Date: Jul. 28th, 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:

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.
omegabyte is offline   Reply With Quote
Reply

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 10:12 AM.


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

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