• 🏆 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!

Question:loops and periodic events..

Status
Not open for further replies.
Level 9
Joined
Jul 20, 2009
Messages
427
In my map I have triggers that has event every 1 second of game time..
I use it to detect if a certain unit in a unit group has buff and if true a specific action would be executed..I want to know if there's a better way to do it?I mean is there any alternative way to detect every second because I think it will cause lag if I have many triggers running at the same time every second.
And also how do I loop an action infinitely?
example >a unit enters playable map>unit type of entering unit=whatever>order entering unit to spirit link something..How do i loop the action such that it would do the same order all over again infinetely..
 
Level 10
Joined
Jan 28, 2009
Messages
442
If you're checking units that you can certify have no buff of your specification, you should change that. For example, by checking units that haven't even been targeted by a spell that gives them the buff. So...
Event - A unit finishes casting an ability
Condition - Ability being cast Equal to (your ability)
Extra-Conditions - Check if the unit meets all the conditions your ability requires for a target (Ground, Hero, max creep level, etc.) (I think the buff is first implemented shortly after the spell is finished, so that may cause a problem unless I'm wrong)
Action - Add target unit of ability being cast to (your group)

Well, maybe the ability may be targeting a group of units (ex. Battle Roar). In that case, just add that group to the other group.
As for leaks, follow this procedure whenever you use unit groups for one use only:

Set TempGroup = (your definition)
Pick every unit in TempGroup and (do your thing)
Custom script - call DestroyGroup(udg_TempGroup)

The group you check must not be destroyed if you use it this way. And remember, when you check if they have the buff, remove units that don't have it, from the group.


If this is in place, it shouldn't be a problem. It's only one trigger checking one group every second. That's a small deal, actually. If you need to do it with several different groups of large proportions, or about every unit in the map checking positions, distances and all kinds of stuff, it may cause lags. In that case you might start worrying. Been there.
 
Last edited:
Status
Not open for further replies.
Top