Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: tyb51 on July 29, 2013, 06:07:05 PM

Title: Multiple Bool Test help!
Post by: tyb51 on July 29, 2013, 06:07:05 PM

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.
Title: Re: Multiple Bool Test help!
Post by: jeanfabre on July 30, 2013, 07:47:52 AM

 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.