Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Splankton on September 05, 2013, 03:44:59 PM

Title: [SOLVED]Compare Int Problem
Post by: Splankton on September 05, 2013, 03:44:59 PM
Hi,
I have a FSM on start that generates a random number into a variable (randomNumber) with a FINISHED event. That goes to the next FSM, that has a compare int action, that compares (randomNumber) to a Global variable (pickups).  Problem is, because (pickups) starts from 0 and increments +1 everytime the player picks up, the (randomNumber) is always greater than (pickups)
So, how can I compare the (randomNumber) against a variable, that can change?
By the way, the random number is set between 5-10.  I have set the compare Int to send an event when it is equal to pickup.
Can anyone help?
Title: Re: Compare Int Problem
Post by: Lane on September 05, 2013, 04:19:53 PM
What are you trying to make happen?

When is pickups int increased? The randomNumber int would only always be greater if pickups int was not increased independently. What's to correlation between the two?

Seems like it's comparing them fine, but is pickups int depending on randomNumber int somehow to increase? Otherwise you simply wait until pickups int has reached 5 or more to begin throwing the equal compare. Weird chance setup.
Title: Re: Compare Int Problem
Post by: Splankton on September 05, 2013, 05:24:32 PM
All I need is when the player picks up items which is (pickups) that value is counted from 0.  I have this working, so when the randomNumber is generated, I want to wait until the pickups reach that random number, so I can use the int compare equal. 
Title: Re: Compare Int Problem
Post by: Lane on September 05, 2013, 05:42:03 PM
I don't really see what isn't working.

Pickups number goes up when you pickup something, a random number is generated at some point that is between 5 and 10, and there is an int compare to see if pickups is equal to the random number. If you run the Int Compare every frame then it will trigger when you get enough pickups to match the random number.
Title: Re: Compare Int Problem
Post by: Splankton on September 06, 2013, 06:57:53 AM
I don't really see what isn't working.

Pickups number goes up when you pickup something, a random number is generated at some point that is between 5 and 10, and there is an int compare to see if pickups is equal to the random number. If you run the Int Compare every frame then it will trigger when you get enough pickups to match the random number.

Exactly, that's how I'd thought it should work, but it just flows into greater than as soon as it starts.  Is there a way to hold the compare action until it becomes equal? I've tried every frame.
Hos does the int compare work if all I have flowing out is equal with greater and less than selected as none?
Title: Re: Compare Int Problem
Post by: Splankton on September 06, 2013, 12:21:40 PM
I have it working now.  I just made the greater and less than set to none and equal to every frame.  So thanks for the help