• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] Every X seconds VS Timer

Status
Not open for further replies.
Level 12
Joined
May 16, 2020
Messages
660
Hi guys,

My editor is getting a bit slow when opening the variable window, so I'm trying to cut down on them if possible. One area which contributes to lots of variables are Timers.

For spells with repeating events, is it generally better to use repeating Timers (every 0.1 seconds...) or can I simply use "Every 0.1 seconds" without disadvantage?

So basically:

  • Time - Every 0.03 seconds of game time
VS

  • Time - Timer expires (every 0.03 seconds)

Cheers
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,557
I believe the minimum time that the Periodic Interval event runs is every 0.03125 seconds. So there's that to keep in mind. Timers on the other hand are precise.

For saving Variables, perhaps it's time to learn Jass? Or better yet Lua, but it can be a headache to make the switch if your map is far into development.
 
Level 18
Joined
Jan 1, 2018
Messages
728
For spells with repeating events, is it generally better to use repeating Timers (every 0.1 seconds...) or can I simply use "Every 0.1 seconds" without disadvantage?
IMO it's better to use your own timers. With the 'every x seconds' you don't have control over when it starts. If the interval is low it doesn't matter much, but with higher intervals you will notice a difference.
Another potential issue is for example if your spell repeats every second, but has a duration of 2.5 seconds. With your own timer it will trigger after 1 and 2 seconds, but with the other event it may run the first time after 0.3 seconds, then 1.3, then 2.3, so it will run three times, and at other times it will run only twice.

I believe the minimum time that the Periodic Interval event runs is every 0.03125 seconds.
It's actually 0.0001 seconds.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,557
IMO it's better to use your own timers. With the 'every x seconds' you don't have control over when it starts. If the interval is low it doesn't matter much, but with higher intervals you will notice a difference.
Another potential issue is for example if your spell repeats every second, but has a duration of 2.5 seconds. With your own timer it will trigger after 1 and 2 seconds, but with the other event it may run the first time after 0.3 seconds, then 1.3, then 2.3, so it will run three times, and at other times it will run only twice.


It's actually 0.0001 seconds.
Ah, I had read that somewhere. Anyway, after testing it out it seems to work as intended at 0.01 second intervals but you're locked to using a minimum of 0.01 in GUI.

Maybe you can get around it with arithmetic or something, also I imagine in Jass you can set it to 0.0001 as you said.
 
Status
Not open for further replies.
Top