Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: amaranth on October 22, 2012, 02:12:14 PM

Title: Call an action (not on game object) from a non-FSM script?[SOLVED]
Post by: amaranth on October 22, 2012, 02:12:14 PM
Is there a way to call an action that isn't on a game object?

Here's my problem:
-I have 1000 creatures with different behaviors.
-1000 FSMs kills my game performance (even when disabled), so I believe I need to avoid them for the creatures.
-Having all 1000 creatures use the same FSM on a game monitor GO won't work because it's possible one creature will call the FSM before the FSM is finished for another creature.

Here's what I'm trying to do:
-I have an action called MorphCreature.
-I use this in an FSM on my game monitor GO.
-I'd like to use the same MorphCreature action in the C# script I've attached to each creature. Goal is not to duplicate code.

So if you had a non-FSM script and you wanted to reference an FSM action script, how would you do this?

Thanks for any help!
Title: Re: Call an action (not on game object) from a non-FSM script?
Post by: DARK_ETERNAL on October 22, 2012, 06:26:49 PM
You don't need to have every monster to send nothing to a manager FSM, if I got your issue correctly. Or, wait... Exactly, what does this MorphCreature action do? Does it somehow change your monsters (as the name would suggest)?

Now, to call a function from a custom script, you might want to use 'Invoke Method' action, although you would have to specify which GO has the script where the function you want to call is (I'd think is your monitor). If you, by the contrary, want to have a reference for an FSM, declare a public PlayMakerFSM variable in your script, so you can drag&drop the object containing that FSM to the inspector. You would have access to variables, events, and such data.

Hope this helps.
Title: Re: Call an action (not on game object) from a non-FSM script?
Post by: amaranth on October 22, 2012, 11:01:29 PM
Ended up just doing this:
http://hutonggames.com/playmakerforum/index.php?topic=2429.0

Thanks for your help!