playMaker

Author Topic: Float Switch[SOLVED]  (Read 4756 times)

SeanC

  • Junior Playmaker
  • **
  • Posts: 61
Float Switch[SOLVED]
« 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
« Last Edit: January 13, 2015, 02:39:27 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Float Switch
« Reply #1 on: July 30, 2012, 04:03:13 AM »
Hi,

 have you tried "Float compare" action?

 bye,

 Jean

SamH

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Float Switch
« Reply #2 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.

Fahrettin

  • Junior Playmaker
  • **
  • Posts: 62
  • Noob
Re: Float Switch
« Reply #3 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

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Float Switch
« Reply #4 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

Fahrettin

  • Junior Playmaker
  • **
  • Posts: 62
  • Noob
Re: Float Switch
« Reply #5 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)