![]() |
|
|
#1 |
|
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 |
|
|
|
|
|
#2 |
|
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 ![]() |
|
|
|
|
|
|
#3 |
|
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");
}
}
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. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|