Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: H3core on March 22, 2013, 10:00:27 PM

Title: Firing Event To FSM from script [SOLVED]
Post by: H3core on March 22, 2013, 10:00:27 PM
Hello, im trying to get the fsm to trigger an event from a script attached to the same gameobject, i used the examples from the API reference to no avail.

this is the method im using. Please correct me if im wrong

Code: [Select]
public PlayMakerFSM FSM1;
FSM1.Fsm.Event("gcol");

It is in c#

Any help would be great

Thnx
Cheers :)
Title: Re: Firing Event To FSM from script
Post by: Alex Chouls on March 22, 2013, 11:07:11 PM
Are you using GetComponent<PlayMakerFSM>() to get FSM1?
Is FSM1 in a state that responds to "gcol"?
Are you getting errors?
Title: Re: Firing Event To FSM from script
Post by: H3core on March 23, 2013, 06:50:19 AM
No actually as i stated i was using public PlayMakerFsm to get FSM1.

problem was even though i had declared gcol as a global event i wasnt aware i had to add it as a global transitions as well. Problem solved :)

Thnx for your reply

Cheers :)
Title: Re: Firing Event To FSM from script
Post by: Alex Chouls on March 23, 2013, 01:36:56 PM
Glad you got it working :)

Note, you should only use global transitions if you want to respond to that event regardless of the current state. Sometimes it's convenient to test with a global transition, but then later change it to a local transition for more control... But maybe this doesn't apply in your case...