Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: LordHorusNL on June 24, 2017, 10:49:14 AM
-
Hey guys, is it currently possible to find out which specific action in a state was the one that triggered a transition event?
I have one state that checks if a whole list of variables has changed and if any of them change i want to fire off the FINISHED event, however in the next state i need to know which specific action triggered the event so that i can know which variable i need to change.
So that when i'm checking 50 variables in one state, i don't also need 50 different transitions :P
-
Hi,
you can try with fsm log, you can find it in :
Playmaker/Editor windows. but you can only use this to check manually not to use ingame.
What actions are you using?
-
Bool Changed
I need one state with about 30 bool changed actions and one FINISHED transition.
So when one of the bool changed fires en moves to the next state, i need to know which specific action fired the transition event.
-
Hi,
I made 2 actions you could use
One is the same as the bool changed (Bool Changed Id) but now you can give it an id number and you can store the id result (set this the same variable on all the bool changed actions)
With that number you can know which bool was changed.
If you want to change it to a string instead of an int you can edit the action script, i have added some comments that explains what you need to do.
the 2nd one is a 'bool any true' action but it will also give the element index number.
-
This is just what i need, you are a life saver!
Thank you so much
-
Ok so i changed the action you made to ouput a string instead of a int, this works great.
However i just noticed that when using multiple bool changed events in one state, only the last action actually saves the "Store Result" (bool)
The actions above it do not seem to store the result (same for normal bool changed action btw)
Does anybody know how i could get around this?
Edit
Never mind i adjusted the action so i can run multiple versions in the same state.
Problem solved
-
Hi,
just out of curiosity (and maybe someone else can use it)
What did you change?
-
I have it set up now so that you can have multiple of these actions in the same state and if one of them changes you can continue, extract the name of the action that triggered the transition and loop back to start checking for a bool change again without the bool being reset.
I have one FSM that holds all my variables, and with this i can change any bool and through a loop the FSM sends the info to other FSM's. So i only need to set variables on one FSM during runtime.
Don't know if that makes sense :P But it works for me.
-
Hi,
I made a different one that will get the variable name from the bool variable,
So you do not need to place any name manually.
Also the 'storeResult' bool should work correctly now.
I will place this one on the ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181), but i am not sure yet how to name it.
boolChangedVariableName is a bit long, so i think i will use boolChagedName
-
Thanks that would be a bit easier!
If you're going to put it on the ecosystem, it might be a good idea to make the same action for floats also.
Edit: your action still flips the bool back to false like the normal bool changed, mine keeps the value so you can loop back and check for other bool changed events.
Example loop
(http://i.imgur.com/y5i3hAK.png)
-
Hi,
You can remove
if (storeResult.Value == true) storeResult.Value = false;
on line 45
But for Ecosystem i think this is fine.