Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Fat Pug Studio on November 15, 2017, 09:10:24 AM

Title: Check if a game object has an FSM named "Banana" [SOLVED]
Post by: Fat Pug Studio on November 15, 2017, 09:10:24 AM
Hi guys,

i have an FSM which is present in some object and in some not (let's call that FSM "Banana"), but every object has an FSM which needs to check if the object has FSM named "Banana" or not on itself so it can continue doing it's stuff.

Any idea on how to do this? I suppose Has Component should do, but i probably got some more stuff to write in the component field since there are few FSM's on that object.
Title: Re: Check if a game object has an FSM named "Banana"
Post by: djaydino on November 15, 2017, 10:06:55 AM
Hi,
Get component will get the fsm component but not the fsm name.
So maybe a different way can be used.

I have tested a bit with "get/set fsm" actions, and "send event" actions here is my result.

If the Fsm "Banana" exists it will get the variable if the variable name is available.
If the variable name is not on the fsm, there is no result.

If the Fsm "Banana" does not exists it will check only to the 1st Fsm.
If the variable exists the other fsms are ignored.
If the variable exists it will get the value.


For 'Send event by name' :
If an fsm name is set then it will only send the event to the named fsm.
If fsm name is empty it will send to all fsms (can be helpful is some cases)

same goes for 'Send Event' but you 1st need to select one Fsm to set the Variable and then erase the fsm name.
Title: Re: Check if a game object has an FSM named "Banana"
Post by: Gustav on November 15, 2017, 10:51:49 AM
There is also a GetFsmName action on the Ecosystem. :)
Title: Re: Check if a game object has an FSM named "Banana"
Post by: Fat Pug Studio on November 15, 2017, 11:31:28 AM
Hmmm, i just checked it out on ecosystem. Ok, i can get an fsm name, but  how will that help me? I'm afk btw so i'm a bit senseless :D
Title: Re: Check if a game object has an FSM named "Banana"
Post by: Fat Pug Studio on November 24, 2017, 10:31:57 AM
I figured it out in the end, thanks for directions and help  ;D