playMaker

Author Topic: Firing Event To FSM from script [SOLVED]  (Read 1927 times)

H3core

  • Playmaker Newbie
  • *
  • Posts: 4
Firing Event To FSM from script [SOLVED]
« 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 :)
« Last Edit: March 23, 2013, 01:37:46 PM by Alex Chouls »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3928
  • Official Playmaker Support
    • LinkedIn
Re: Firing Event To FSM from script
« Reply #1 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?

H3core

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Firing Event To FSM from script
« Reply #2 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 :)

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3928
  • Official Playmaker Support
    • LinkedIn
Re: Firing Event To FSM from script
« Reply #3 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...