|Joe||I've been trying to figure something out for hours now. How can I have multiple actors use one changeState method? I tried using (Actor:setMotion(MoveTo 50 50 (RoomScript:changeState()) and putting breaks in the cases I wanted them to finish at. Can you point me in the right direction? Would I have to use some other changeState method somewhere else in the script?|
|Joe||Meant to type: (Actor:setMotion(MoveTo 50 50 (RoomScript:changeState())) Actor is the actor. I didn't actually use 'actor' in the script. :)|
|Joe||Gah. Add one more ) to that. Sorry. :-|
You can't do:|
(Actor:setMotion(MoveTo 50 50 (RoomScript:changeState()))
(Actor:setMotion(MoveTo 50 50 RoomScript))
You can use changeState with as many actors as you want. I'm not sure exactly what you are trying to do, but you should read up on my tutorials about change state and it's use. There are examples in Volume I and II.
|Joe||*Hangs his head low* I've read it and re-read it. I'm trying to figure out how to have one actor use changeState, and then the other, etc.. I'm trying to figure out how to have actors be able to use changeCase individually and at any given time. Like, you could say "get room" and the actor would go to his desk, do something, walk somewhere and then say something to the ego. Or, in the same room, you can go to another guy, say something, he will walk somewhere, perform an animation, and then walk back and say something. Do you understand what I'm asking? I'm sorry to bug you with all these questions.|
With: (Actor:setMotion(MoveTo 50 50 (RoomScript:changeState(1))) - I was wondering if I could have the script go to a specific case, go through three or four cases, and then break from it in changeState and set another actor to start at the case after the first actor stopped at.|
|Joe||Actually, I guess what I'm asking is, how DO you use changeState with more than one actor?|
You simply do:|
(Actor1:setMotion(MoveTo 50 50 RoomScript))
(Actor2:setMotion(MoveTo 50 50 RoomScript))
(Actor3:setMotion(MoveTo 50 50 RoomScript))
When Actor1 reaches it's destination, it triggers a state. When Actor2 reaches it's destination, it triggers the next state, etc.
The game will be sequential, so there shouldn't be any times when actor3 before actor1 one time, and after actor1 the next time. If actor1 reaches it's destination first, triggering, say, state 3, and actor3 reaches it next, triggering state 4, that should always be the case. You can consider the states consistent.
The only times the state may not be executed, is, if for example, the ego blocks them and they can't get there.