Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: SeanC on July 29, 2012, 06:35:46 PM

Title: Float Switch[SOLVED]
Post by: SeanC on July 29, 2012, 06:35:46 PM
Hey all,

I've seen this question pop up a couple of times on the forums and thought i would just throw it out there again.

Im using float switch to send events based on the facing angle of the hero to an enemy. Currently, "Less than" is my only option, but man it would be great if I could set the operator (greater than, equal to). As it is, im still fiddling with the best way to handle that.

If anyone has found an elegant solution or, better yet, a custom action please pass it along!

Thanks a lot,
Sean
Title: Re: Float Switch
Post by: jeanfabre on July 30, 2012, 04:03:13 AM
Hi,

 have you tried "Float compare" action?

 bye,

 Jean
Title: Re: Float Switch
Post by: SamH on January 10, 2015, 12:24:24 PM
While I'm sure its been so long that this answer isn't relevant to the original user I was recently having the same issue so I thought I'd post another solution..

If you do want to compare your float to several other floats, you can use that 'less then' field to define ranges. Each additional field you add  (by increasing the number in the 'float switches' field) sets a range between it and the previous value you specified.

Just make sure you start with the smallest number and go higher as you move down the list.  This effectively mimics a 'less then or equal to' behavior, which you could work to just as easily be 'greater then or equal to' using the same ranges but ending with a super high float value.

So this is useful if like me you needed to check against a range of different float values, whereas the float compare will only check against one additional float value.
Title: Re: Float Switch
Post by: Fahrettin on January 10, 2015, 02:00:54 PM
I dont want to open new thread so i will ask here.
I can use Float Clamp action between states it works perfect in that way. When try to use with global event, it fires event but Float Clamp actions dont work. I tried on same FSM and on another gameobject with new FSM
Title: Re: Float Switch
Post by: jeanfabre on January 12, 2015, 08:12:18 AM
Hi,

 I am not sure I follow you, could you share your fsm or make screenshots? that will help.

 Bye,

 Jean
Title: Re: Float Switch
Post by: Fahrettin on January 12, 2015, 04:44:19 PM
I found my problem. I was making mistake by not using global variables.
When i hit a button, i was sending Broadcast Event to fire Float Clamp action. My variables were not global. So i thought it was not working. But i was being a noob again :D (sorry for my Eng)