Set Internal Flag 2 Not Working?
Here's what I have:
An event group that sets flags 1-4 off on my ship2
Then an event group that checks for player 2 joystick buttons 1-4 pressed and sets flags 1-4 on on my ship 2
Then an event group that checks flags 1-4 on my ship2 and does the appropriate action (fire1, fire2, shields, boost).
The problem is, none of those flags are ever set to be on by the third group, even though there's nothing setting them to be off in between them.
I even made it add ship2 to the debugger and PAUSE the debugger in the same event as when it sets flag 2 to on, and the debugger *still* shows it as off!
What's weird is I also set flags 5-8 to be on based on player 2 joystick buttons 1-4 being held down, and those work perfectly.
What's really frustrating about this is that I have another group (AI) that sets this internal flag 2 on, and it works fine. So why doesn't it work in this case?
WTF?
Re: Set Internal Flag 2 Not Working?
Also, forgot to mention - if I add a "never" condition to the event in the first group - the one that sets flag 2 off, it suddenly starts working (of course, once I press fire 2, flag 2 is on forever). But this group is BEFORE the group that sets flag 2 on, how could that first group be effecting what happens in a group AFTER it? Aren't event groups executed in the order you see them in the event editor???
Re: Set Internal Flag 2 Not Working?
And now a final piece of this baffling puzzle:
If I take the part of my first group (the one that sets all the flags off) and move it *after* the third group (the one that checks the flags and fires projectiles), it suddenly works.
This doesn't make any sense to me at all. This must be a freaky bug of some sort - maybe something to do with grouping?
Here, in detail, is what it looks like (simplified to just show the one button/flag I was having trouble with):
Doesn't work:
Code:
Event Group: Player 2 Setup
+ ship2 internal flag 2 is on
-> ship2 set internal flag 2 off
Event Group: Input 2
+ player2 pressed button fire 2
-> ship2 set internal flag 2 on
Event Group: Player 2 Actions
+ ship2 internal flag 2 is on
-> shoot photon torpedo (etc.)
Works:
Code:
Event Group: Input 2
+ player2 pressed button fire 2
-> ship2 set internal flag 2 on
Event Group: Player 2 Actions
+ ship2 internal flag 2 is on
-> shoot photon torpedo (etc.)
Event Group: Player 2 Setup
+ ship2 internal flag 2 is on
-> ship2 set internal flag 2 off
Does that seem like it should make a difference to anyone else?
And, so, I reiterate: WTF?!
Re: Set Internal Flag 2 Not Working?
Things are not necessary executed in the order that they are in the event editor in the way that you are thinking.
When the flag is on, it runs the event that turns it off before the event that shoots the torpedo because it comes first. You could say the event has higher priority because it's closer to the start of the event editor.
I think you pretty much figured that out yourself, though.
Re: Set Internal Flag 2 Not Working?
The "doesnt work" code should work from what you have posted.
What are you doing in between Input 2 and Player 2 Actions - perhaps something in there is touching the value.
View all events associated with the object and look harder.
Re: Set Internal Flag 2 Not Working?
The events starting with a "Player presses fire button" are executed before all the other events, actually when the button is pressed. These events are true events, like the jeyboard press events, and they are executed when the event occurs.
If you wantr you events to be executed in the order of the program, just insert an always condition before the actual condition.
Re: Set Internal Flag 2 Not Working?
[]The events starting with a "Player presses fire button" are executed before all the other events, actually when the button is pressed. These events are true events, like the jeyboard press events, and they are executed when the event occurs.
If you wantr you events to be executed in the order of the program, just insert an always condition before the actual condition. [/]
That should be in one of the knowledge base thingies somewhere. I've been watching Clickstuff for years and I still didn't know that.
Re: Set Internal Flag 2 Not Working?
It is actually documented in one of the "Getting the most of MMF" articles, the one on the runtime I guess. I cannot find them on the server right now. Jeff, do you know wheere the articles are?
Re: Set Internal Flag 2 Not Working?
I will go re-link those documents on the MMF2 Learning resources page.
We should go thru them and update them for MMF2 with some new screenshots when we get a free second but other then that they should be still valid for MMF2
http://www.clickteam.com/eng/learning_resources.php
Re: Set Internal Flag 2 Not Working?
It was mostly that I never realized that adding "Always" would force the engine to perform the actions during the non-events loop.
Re: Set Internal Flag 2 Not Working?
[]The events starting with a "Player presses fire button" are executed before all the other events, actually when the button is pressed. These events are true events, like the jeyboard press events, and they are executed when the event occurs.
If you wantr you events to be executed in the order of the program, just insert an always condition before the actual condition. [/]
Ah, well, that explains it... <img src="/center/images/graemlins/smile.gif" alt="" />