Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: Lane on January 25, 2014, 10:04:47 AM

Title: Firing action/state twice on first sequence
Post by: Lane on January 25, 2014, 10:04:47 AM
Repro attached.

Press F to create a cube.
Moves into next state, destroy stored cube (if exists), create new cube.
Loops back to input state.

It creates two cubes the first time and then proceeds to work fine for sequential uses.
Title: Re: Firing action/state twice on first sequence
Post by: Redhawk on January 25, 2014, 10:38:13 AM
Your Destroy and Create don't look normal.  Typically the line between the two is a straight line, but yours has a v in it.  Also, I couldn't tell if you are trying to destroy the current cube that's in the game as it's not assigned to the cube variable.

You might want to add a start state that does Find Object - Cube and stores it.
Title: Re: Firing action/state twice on first sequence
Post by: Lane on January 25, 2014, 12:46:59 PM
The line indicates it is set to action sequence. It only happens on Action Sequences.

The destroy is set to destroy the object that the create stores so you can keep creating cubes. Turning the destroy action on/off has no bearing on the dupe on first run result.

Title: Re: Firing action/state twice on first sequence
Post by: Redhawk on January 25, 2014, 04:34:33 PM
When I made the changes, it worked just fine - i.e. no duplicates.  It just did 1 at a time and destroyed the one in the scene (since I set the object each loop).
Title: Re: Firing action/state twice on first sequence
Post by: Lane on January 25, 2014, 04:46:29 PM
No dupe with Action Sequence on?
Title: Re: Firing action/state twice on first sequence
Post by: Redhawk on January 25, 2014, 08:41:50 PM
I have no clue what Action Sequence is, so I did the Playmaker Actions with standard events like I put in the screen shot (New Create).  I disconnected your "create" and swapped it with my "new create" and it works just fine.  So the issue must be with whatever an "action sequence" is.
Title: Re: Firing action/state twice on first sequence
Post by: Lane on January 25, 2014, 08:57:46 PM
So the issue must be with whatever an "action sequence" is.

Exactly, and it shouldn't happen. It's a bug.

Click the gearbox in the top right of a state's action list and choose Action Sequence. It sets it up so that the stack of events is the sequence of execution top to bottom. This is great for using one state for a sequence of events and don't want to create 15 different states for some thing to take place. It's actually bypassed by adding a Next Frame Event action at the end but the fact that its happening and there have been so many other unusual things related to double event firing and multiple action execution lately I wanted to go ahead and report it in case its part of a larger issue.
Title: Re: Firing action/state twice on first sequence
Post by: Redhawk on January 26, 2014, 09:14:12 AM
It might actually be the "Create Object" piece.  Click the Help button for Create Object and you will notice that this happens Immediately.  So, probably what is happening is that the event fires, Create Object happens immediately, then the sequence begins which fires off a 2nd Create Object after the Destroy Object. So that equals 2.  Logically, this sounds like it is what is happening instead of being a bug.  So, you probably need to do this differently (like what worked for me) in this particular case.

Below is from the Help.
The object is created IMMEDIATELY, before other actions are called on the state. If the created object has an FSM, that FSM also becomes active IMMEDIATELY, before other actions on the state.
Title: Re: Firing action/state twice on first sequence
Post by: Lane on January 26, 2014, 09:42:30 AM
Whats the point of having an action sequence if you can't rely on it firing in sequence? Also, why does it only do it on the first pass and not sequential ones?

The script should not be executed until the action sequence engages it, its that simple. There shouldn't be any magical bypass and its inconsistent behavior means it is not working as intended.
Title: Re: Firing action/state twice on first sequence
Post by: jess84 on January 26, 2014, 10:35:18 AM
Isn't this just part of the whole "Action Sequences" are buggy and firing multiple times issue, as reported here and here:

http://hutonggames.com/playmakerforum/index.php?topic=6119.0

and

http://hutonggames.com/playmakerforum/index.php?topic=6007.0
Title: Re: Firing action/state twice on first sequence
Post by: Redhawk on January 26, 2014, 11:00:57 AM
I would suggest just leaving yourself a note to come back to it in the future, making the small change (i.e. don't use Action Sequence), and move on to something new to figure out :)

Good luck
Title: Re: Firing action/state twice on first sequence
Post by: Lane on January 26, 2014, 01:47:37 PM
Isn't this just part of the whole "Action Sequences" are buggy and firing multiple times issue, as reported here and here:

http://hutonggames.com/playmakerforum/index.php?topic=6119.0

and

http://hutonggames.com/playmakerforum/index.php?topic=6007.0

It seemed related, that's why i posted it.
Title: Re: Firing action/state twice on first sequence
Post by: jess84 on January 26, 2014, 04:17:42 PM
At least people know about it now, it's an incredibly annoying bug that I'm sure is causing a lot of people to spend a lot of annoying hours tracking down the symptoms elsewhere.

It's now the first thing I look for when I have duplicate objects spawned when they shouldn't be!  >:(
Title: Re: Firing action/state twice on first sequence
Post by: Alex Chouls on January 26, 2014, 10:03:55 PM
The fix is now in beta and will hopefully be released this week - thanks for the reports and repro steps. Sorry for any frustration this bug has caused!