Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: zhevas on November 12, 2016, 09:26:22 AM
-
How can I make Playmaker to enter a new state (or trigger variable) when certain sequence of states is executed.
For example, if after state 2 follows 1 and then 3, then it enters a new state (like a correct combination)
(https://s14.postimg.org/70e0ro4j5/SADASD.png)
Thanks in advance!
-
nobody?
-
Hi.
You could set a bool in a state between 'State 1' and '1' and also between 'State 1' and '2'
set one to true and the other to false then in 3 do a bool test.
if you have more than 2 combinations you could use an int and use an int switch.
Another way you could do is use a string (name it 'combo' for example)
use the action 'build string' and place it in 1,2 and 3
Set string parts to 2
Set element 0 to the string (combo)
Set Element 1 to 1 for state 1, 2 for state 2 and 3 for state 3
Leave Separator empty and uncheck Add To End
Set Store Result to the string (combo)
And then you can use a string switch and compare if it is 123 or 321 or 213 and so on
-
Hi,
I would not try to hard code this much, instead:
-- use dedicated transitions ( "MOVE TO STATE B") for example, and each state is responsible for knowing where to go next, but it has severe shortcomings...
-- use an array to describe the various paths and and have a sequence management that will control states transitions, use a convention that each state when finished has to call the sequence manager, which in turn will call the right state ( put a global transition above each state like "ENTER STATE A" and use "SendEventByString" to compose the event to send when you have to deduce it from your sequence manager.
- you could use templates and have several states/transitions for each different way and inside states you don't copy paste actions you run the right template.
Hope this shades some light on some ways