• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

alternative "Wait"

Status
Not open for further replies.
Level 12
Joined
Feb 22, 2010
Messages
1,115
It depends on where you use it, show some examples.You can use wait or wait(game time) if its what you need.But they are not good at spell triggers.
 
Level 10
Joined
Mar 17, 2012
Messages
582
It depends on where you use it, show some examples.You can use wait or wait(game time) if its what you need.But they are not good at spell triggers.

For example: I created a Wind Strike spell... All damage is triggered. It has a 1000 missile speed so I used "(Wait distance between 2 points) / 1000 seconds" but if two heroes use it at the same time - only one of them deal damage... :thumbs_down:

Can someone show me a little example how to use timers right?
 
Level 10
Joined
Mar 17, 2012
Messages
582
Indexing. Read DIMF's tutorial.

Well I've read about indexing, but it's now what I need at this moment...
How indexing will help me to wait before a missile will touch a target? :vw_unimpressed:

No problem glad to help

Excuse me, but you didn't show an example how to use timers in your guide) I't a shame, but I'm not sure that I know how to use 'em :ogre_kawaii:
 
In GUI, Periodic triggers for the sake of convenience. They're just a bit slower than timers, but you'll be fine. In JASS, using periodic triggers is actually harder than using timers, so you use timers.

Indexing is a whole other thing that you have to face when you're using these methods because of the nature of how data is localized in trigger pseudo-threads of execution in Warcraft III. GetTriggerUnit() will not change its value inside a trigger no matter what because the data is localized to whatever instance of execution is running currently, so you can use waits and get away with not indexing anything. You will however get code that is less performant, uglier and harder to read.

There are several ways to generate unique indexes and manage them.
The easiest method of all for beginners is Tank-Commander's method.
It's readable and understandable, but it doesn't scale incredibly well. That won't matter very much unless you have like a hundred array variables for one spell. (In the worst case, you'll need 15-20. Maybe 30 if your spell is too complex)

I once wrote a tutorial on how you can use waits safely. The only downside is the inaccuracy you face. If you wait X seconds, the real wait time will usually be between X + 0.09 seconds and X + 0.20 seconds. This is assuming everyone has 0ms ping. This is mainly because the wait is implemented as a simple system sleep function call. The shortest time you can wait is about 10 milliseconds. This is due to the nature of the Operating system scheduler.

How indexing will help me to wait before a missile will touch a target?

It doesn't, it's for allowing multiple instances of your spell to exist. While iterating over the instances of your spell, you would get the distance between the target and the missile. If the distance is less than 16 or something, then the missile touched the target, so you do whatever you want and you deindex the spell instance.
Look into Tank-Commander's tutorial, it's the only indexing tutorial on the entire internet that I endorse.
 
Level 10
Joined
Mar 17, 2012
Messages
582
In GUI, Periodic triggers for the sake of convenience. They're just a bit slower than timers, but you'll be fine. In JASS, using periodic triggers is actually harder than using timers, so you use timers.

Indexing is a whole other thing that you have to face when you're using these methods because of the nature of how data is localized in trigger pseudo-threads of execution in Warcraft III. GetTriggerUnit() will not change its value inside a trigger no matter what because the data is localized to whatever instance of execution is running currently, so you can use waits and get away with not indexing anything. You will however get code that is less performant, uglier and harder to read.

There are several ways to generate unique indexes and manage them.
The easiest method of all for beginners is Tank-Commander's method.
It's readable and understandable, but it doesn't scale incredibly well. That won't matter very much unless you have like a hundred array variables for one spell. (In the worst case, you'll need 15-20. Maybe 30 if your spell is too complex)

I once wrote a tutorial on how you can use waits safely. The only downside is the inaccuracy you face. If you wait X seconds, the real wait time will usually be between X + 0.09 seconds and X + 0.20 seconds. This is assuming everyone has 0ms ping. This is mainly because the wait is implemented as a simple system sleep function call. The shortest time you can wait is about 10 milliseconds. This is due to the nature of the Operating system scheduler.



It doesn't, it's for allowing multiple instances of your spell to exist. While iterating over the instances of your spell, you would get the distance between the target and the missile. If the distance is less than 16 or something, then the missile touched the target, so you do whatever you want and you deindex the spell instance.
Look into Tank-Commander's tutorial, it's the only indexing tutorial on the entire internet that I endorse.

Thanks, now I'm starting to understand :ogre_hurrhurr:
 
Status
Not open for further replies.
Top