playMaker

Author Topic: Dynamically getting FSMs  (Read 2515 times)

Windfeld

  • Playmaker Newbie
  • *
  • Posts: 2
  • A not-so-technical Designer
Dynamically getting FSMs
« on: December 15, 2011, 02:26:56 PM »
Hello! First post here ...

I'm really impressed with the potential PM has so far - don't know how I have survived without it until now! Keep up the great work! Naturally, I have run into a small (learning) problem and it's starting to take a toll on my hair. Here goes:

I am trying to dynamically locate the player object in the scene (Find by tag) and assign the found gameobject to a go variable. This works, so far so good.

But the problem comes when I want to use that variable to establish a connection between the player game object and the current FSM (to send events). When I use a Send Event to the player variable, nothing happens, but if I hardwire the player directly into the Send event it works perfectly.

How do I avoid the hardwiring? Eventually this hardwiring solution is not an option. Am I missing a 'get FSM component' or something?

Thanks for your time!  ;D
W

A small plead: Update the documentation. Not enough examples (TODOs) and quite a few obsolete entries (Broadcast all/Send Event to FSM comes to mind). Not being a coder I rely heavily on tutorials and examples ... and paying additional money for 'basic' video tutorial feels a bit unfair.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Dynamically getting FSMs
« Reply #1 on: December 16, 2011, 12:34:37 AM »
Hi WindFeld and welcome to this forum :)

I think I know where you are having problems:

 You can't broadcast an event on start state, it doesn't work. The solution is to set a delay or to send that event on another state at a different time.

Few things to check: is your variable really filled with a Go. Find by tag could return nothing.
Are you really firing the event after the find by tag?

Hope that helps, if not, I'll make a working example and send it to you.

 Yes, documentation could have more examples. Have you studied the playmaker samples? they are very useful. Alex has also done a lot of screencasts on this forum you might want to look at, they are free.

Bye,

 Jean

Windfeld

  • Playmaker Newbie
  • *
  • Posts: 2
  • A not-so-technical Designer
Re: Dynamically getting FSMs
« Reply #2 on: December 17, 2011, 09:09:07 PM »
Hey Jean,

thanks for your answer! I finally got around to trying the 'starting' offset, and you were right - having a 1 second delay (just proving the theory) worked!

Merci!