Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Grezod on April 03, 2016, 07:21:36 AM
-
i need use script to start my fsm function
but i don't know what code i can use to do this
can some one answer me thanks a lot!
-
A simple way that I know, as a non coder, is:
Make a public bool in the script and turn it on in the script every time you want the fsm to run.
In the first state of the fsm, drag the script from the game object's inspector to the action list of the fsm and choose 'get property'. In the 'get property' action that should appear, chose to store the public bool from the script into a local bool in the fsm (do this every frame).
Then add a bool test (click 'every frame') and send to the next state if the bool is true.
In all subsequent events add the same actions but in the bool test action send back to the initial state if the bool is not true.
It is certainly not the most elegant way of doing it, but should work until a coder comes along and gives you the real solution...
Good luck with it!
-
thank you Zeldag!
i'll try it
-
There's a code example on the wiki here
https://hutonggames.fogbugz.com/default.asp?W329