playMaker

Author Topic: Multiple Bool Test help!  (Read 1474 times)

tyb51

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Multiple Bool Test help!
« on: July 29, 2013, 03:07:05 PM »
Hi,

I am having some trouble at using the Bool Test action multiple times in 1 state.
According to my observations if you have multiple it only tests one and skippes all others. Here you have an example:

In my game I'm trying to drag a skill icon (with NGUI) to the skill bar. To do this I check when dragging the icon if I am hovering over a skillslot. Now because of the restrictions that we currently have on implementing NGUI in playmaker, I didn't find a way to (bool)check if I'm hovering over a slot. The only way I found this working is to add an FSM to each and every skillslot where I can use the event 'NGUI OnHover' to flip a Global variable Bool like here:



Now When I have 9 of these global bools, I use them in the FSM where I drag the icon the check in which slot it has to be placed. The issue here is that only the first slot works (as it is the first Bool Test). If this returns true it does what it has to do. If i try to drag the icon to another slot, it directly returns false as it is not the first Bool Test.




Can anyone help with this problem, or give me a whole new direction to think about the icon drag thingy.

PS:Just for more clarification if someone had a better idea on fixing this icon drag problem: what I do when the hover returns true is activate a skill icon-game object. This GO has an fsm to trigger a spell on keypress (with raycast and such) and I assign the properties of the dragged skill to the properties of the docked skill with another fsm.
« Last Edit: July 29, 2013, 03:09:21 PM by tyb51 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15286
  • Official Playmaker Support
    • View Profile
Re: Multiple Bool Test help!
« Reply #1 on: July 30, 2013, 04:47:52 AM »
Hi,

 You should simply have an Fsm on each slot, and set it up to receive ngui events like on hover and then have the logic on each slot.

if I take the ngui example "Drag & Drop", it all works fine.

 I select the gameObject "DragDropSurface", then I add a "NGuiEventsToPlaymakerFsmEvents" component, then an fsm, and I add to that fsm a "NGUI / ON DROP" Global event ( double check that in "NGuiEventsToPlaymakerFsmEvents", that event turns green.

and when you press play, drag and drop an itemm and the fsm will received that drop event. NOTE that to know what gameObject was droped, you need to use the action "get event info", the dropped GameObject reference is in "gameObject Data"

 GOing this way, will definitly increase your flexibility and prevent having to mess with hardcoded bool variables and global variables.

Bye,

 Jean