playMaker

Author Topic: variable to SubFSM via RunFSM  (Read 4985 times)

_spring

  • Playmaker Newbie
  • *
  • Posts: 3
variable to SubFSM via RunFSM
« on: June 25, 2013, 10:35:54 AM »
Hi there,

i get a strange behavior of playmaker if i want to pass a variable to my subfsm via RunFSM.

For example: i have a template with a variable called subFloat.
In my HostFSM i use the RunFSM action, select the template and now see the input field subFloat.
So far so good.


If i setup a variable hostFloat and initialize the var via Set Float Value action to 10 before i call the RunFSM, the subFloat value in the template will still be 0.

If i change the hostFloat variable in the variables tab to 5, the subFloat is 5!
It seems the SubFSM can only receive "hard coded" variables. The Set Float Value action was completely ignored.


i'm using unity 3.5.7 and playmaker 1.6.1.


can some help or confirm that problem?

thx

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: variable to SubFSM via RunFSM
« Reply #1 on: June 25, 2013, 03:36:23 PM »
Hi,

 I have the opposite actually :) it seems that a subfsm variable that Is et within the fsm doesn't carry the value back to the parent fsm, so if I reference a variable in the run fsm variable, the value I set within the sub fsm doesn't make it to the parent fsm variable.

Also, when you find such issues, don't forget to report it using the bug report system found in the PlayMaker/tools menu.

Thanks,

bye,

 Jean

craigz

  • Beta Group
  • Full Member
  • *
  • Posts: 234
    • Haven Made
Re: variable to SubFSM via RunFSM
« Reply #2 on: July 17, 2016, 09:45:34 PM »
Hi Jean!

Sorry to bring this back up :)

Did you find/is a there a way to bring variables from sub-fsm's back up to the parent fsm?

best,

craigz

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: variable to SubFSM via RunFSM
« Reply #3 on: July 28, 2016, 09:20:01 AM »
Hi,

Yes, use "setfsmxxx" inside the template, leave "gameobject" to "owner", "fsm name" to nothing and "variable name" to the nsme of the variable on the fsm host.

Let me know if that doesn't work, i'll do a sample.

Bye,

Jean

craigz

  • Beta Group
  • Full Member
  • *
  • Posts: 234
    • Haven Made
Re: variable to SubFSM via RunFSM
« Reply #4 on: August 16, 2016, 08:36:23 PM »
Yes, use "setfsmxxx" inside the template, leave "gameobject" to "owner", "fsm name" to nothing and "variable name" to the nsme of the variable on the fsm host.


Hi Jean!

Sorry for such a late reply, was out of town for a bit :)

I've experimented with what you've said and it actually didnt work :(

To get it to work I manually had set the FSM name (which of course is a not very fun limitation  :-[  ;) )

Any other thoughts on this or should I sit tight?

thank YOU for being awesome!  ;D

craigz

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: variable to SubFSM via RunFSM
« Reply #5 on: August 17, 2016, 07:01:18 AM »
Hi,

 Ok, I'll work on a sample and I'll put it on the Ecosystem, cause this is an important pattern to master when working heavily with templates.

 Please remind me next monday, if nothing came up before :) Follow me on Twitter to not miss it, I always post ecosystem activities. I'll try to remember posting back here anyway.


 Bye,

 Jean

craigz

  • Beta Group
  • Full Member
  • *
  • Posts: 234
    • Haven Made
Re: variable to SubFSM via RunFSM
« Reply #6 on: August 17, 2016, 03:14:51 PM »
That would be fantastic! Thank you!  ;D

Ohhhhh Jean, I've been following you for almost a year! It's where I get all my Playmaker tips! :D  8) ;)

best,

craigz


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: variable to SubFSM via RunFSM
« Reply #7 on: August 29, 2016, 07:00:38 AM »
Hi,

 Ok, I made a quick sample, it's not on the Ecosystem yet, I'd like you to have a go at it first, and if it works for you, I'll push it officially.

SubFsmHostCom.unitypackage

Let me know how it goes.

 Bye,

 Jean

craigz

  • Beta Group
  • Full Member
  • *
  • Posts: 234
    • Haven Made
Re: variable to SubFSM via RunFSM
« Reply #8 on: September 13, 2016, 05:49:42 PM »
Hi,

 Ok, I made a quick sample, it's not on the Ecosystem yet, I'd like you to have a go at it first, and if it works for you, I'll push it officially.

SubFsmHostCom.unitypackage

Let me know how it goes.

 Bye,

 Jean

Sorry for the delay, this worked perfect! And was super helpful.

That Get Host action is where it's at ;) alleviated SO much user error on my part now.

Good to go Jean! You rock! :D

Now my weapon/equipment templates are working great! :D

-craigz




voxcat

  • Playmaker Newbie
  • *
  • Posts: 2
Re: variable to SubFSM via RunFSM
« Reply #9 on: September 20, 2016, 03:27:59 AM »
Hi Jean

Two quick questions about the template (subFSM):
1. for setting input, I simply tick a variable exposed to the Inspector, or by adding action "Get FSM xxx", both works, but which way is better ?

2. for setting output, it looks "Set FSM xxx" is the Only way ? is it ?
Inspector looks does Not work for output.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: variable to SubFSM via RunFSM
« Reply #10 on: October 25, 2016, 02:13:34 AM »
Hi,

1: if you tick, you won't get updates every frame, then you need to use GetFsmXXX, so it depends if your input is expected to change over time or not.

2: nop, there is no "output" from sub back to host, so you must use SetFsmXXX on the sub to set variables of the hosts.

Bye,

 Jean