since I use MMF2 I never understood the difference between these two. With my actual project (multiplayer shooter) I had the problem, that shoot fired on computer a were not synchronal on computer b, although the programming was the same. I used Every 00.04 for that first. Than changed to Restrict actions and erveything worked perfectly.
So why is that? Where is the difference?
And now the even bigger problem. When I play the game, after a period of time and without any obvious cause, EVERY event with the restriction "restrict actions for" is no longer restricted for a period of time. Means, when I shoot it is no longer restricted for 00.04, the mechs shoot every frame. Another example, playing a sound when walking "every" 00.48 is now played every frame. Very awful.
Anybody knows that bug or isnt it a bug? And more important, how do I fix it??
btw the problem appears on all computers the same time
One thing you can try to do to fix all the issues you're having here is try to get away from using the timer based events. Instead create a counter or use a dedicated active object to store variables. Use this to create your own loop so that you can rest assured knowing that your game isn't going to progress out of sync with the timer events.
For example:
Instead of: Every 00.50 seconds
Try: Add 1 to counter
When counter hits 50, set counter to 0 and fire event.
It may not be exactly half a second, but you can play around with it so that it is if you truly need it to be.
The problem with timer based events is the fact that whenever the game hitches up or the framerate slows down, timer based events still try to fire. For example, if a game locks up for half a second and you have an event that fires every second. When the game starts responding again, the non-timer based events are going to fire as if the lockup never happened, meanwhile the timer based event of 1 second is still going to try to fire on scheduled. This can lead to issues where in which for example, if someone is shooting a gun that fires a bullet once every 0.1 seconds, based on the performance of the game, the bullets will fire closer or further in succession, not based off of what you count (remember, it's firing accurately on the timer), but appear closer or further, because the game is running slower then the expected time.
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
What SiLVERFIRE said. It's not exactly a bug.. it's just the "right" way to use MMF2. Yeah, you should never use the Every event directly, stick it on a counter.
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
It's not a bug ok, but what exactly SHOULD the every _ seconds command be used for? ... making a real-time clock?
Other than that, I haven't found a good use for it.
Edit: wait a min, you mean to use it with the counter? .. that's a good idea. Every _ Seconds, Add 1 to Counter.
Exactly like MUZ said!
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
The timer events are good for applications which might rely on time. Also, before the Get Framerate command existed in MMF2, Every _ Seconds was used to create a framerate counter:
Always: Add 1 to Hidden Counter
Every 1 Second: Set Visible Counter to Hidden Counter then set Hidden Counter to 0.
Timed events can also be useful for online games because they are less based on the in-game performance. The length of 1 second for me will always be the same for you and anyone else playing the game, regardless of how well the game is performing. So if you're getting 30fps and I'm getting 60fps, the likelihood of these events firing at the same time is significantly greater if a timer event is used, because framerate has less of an impact. On the flip side, had you been basing it off of framerate, the game with 30fps would take twice as long to fire the event then the game running 60fps.
Also: Never use "Every 00.00: Add 1 to cunter" if you're trying to make a framerate dependent game. You're not getting rid of the problem. 00.00 seconds is still going to fire more frequently on a game running 30fps then 60fps. You need to use "Always" because the Always command is nothing but a condition that fires every single loop. Now whether or not other conditions in the event fire is still reliant to whether or not the actions are fired - the point is, Always is entirely dependent on framerate because the very nature of this condition is that it will always fire once per-loop. 60 frames a second? Always will fire 60 times in one second.