HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Why does this trigger lag?

12-24-2006, 07:38 PM#1
turondo
Trigger:
Elusion Aura
Collapse Events
Time - Every 0.25 seconds of game time
Conditions
Collapse Actions
Set Leak_UnitGroup = (Units in (Playable map area) matching (((Matching unit) has buff Elusion Aura ) Equal to True))
Collapse Unit Group - Pick every unit in Leak_UnitGroup and do (Actions)
Collapse Loop - Actions
Unit - Add Elusion to (Picked unit)
Set Leak_UnitGroup2 = (Units in (Entire map) matching (((Matching unit) has buff Elusion Aura ) Equal to False))
Collapse Unit Group - Pick every unit in Leak_UnitGroup2 and do (Actions)
Collapse Loop - Actions
Unit - Remove Elusion from (Picked unit)
Custom script: call DestroyGroup(udg_Leak_UnitGroup)
Custom script: call DestroyGroup(udg_Leak_UnitGroup2)

anyone know why it lags?

b/c during testing.. its laggin quiet a bit

Any help will be appreciated, thanks!
12-24-2006, 08:03 PM#2
grim001
maybe it's because you're checking every unit in the entire map twice every 0.25 seconds?
you could do this way more efficiently...

first of all, 0.25 is more frequent than it needs to be... you should change that to 0.5 or 1.

second, there's no need at all to have 2 groups. just remove the condition and find all maps in the playable map area. after that use an if statement to check whether the unit has the buff and act accordingly.

even better, on map initialization add every unit in the map into a unitgroup. Then make a trigger that adds units that enter the playable map area to that group. Now you will have a group with every unit in it already and you won't need to create a new one with every iteration of this timer.
12-24-2006, 08:16 PM#3
wyrmlord
I have a question, does it only lag the first time, or does it lag every time? If it lags only the first time, you need to preload the ability by making a dummy unit and giving the ability to it (event should be map initialization) and then just remove the unit.
12-24-2006, 08:58 PM#4
Anopob
May I ask what's the point of this trigger? I mean, after looking at it, every .25 seconds you're adding/removing the skill Elusion. Unless this skill takes place very fast, the interval is too quick. Also, wyrmlord is right (I think).
12-24-2006, 09:24 PM#5
turondo
grim001 - im gonna try what you suggested... if i have any trouble i'll post the new trigger on it, thanks.

wyrmlord - nope, it just keeps lagging the whole time

Anopob - basically its an aura, that adds this skill onto the units around it and i'll try and change the interval
12-24-2006, 09:30 PM#6
xombie
You have a boolean expression leak. (Matching Condition) is a boolexpr, and you have to remove them. I'm assuming that it doesn't lag for the first few seconds, correct?
12-24-2006, 09:38 PM#7
wyrmlord
Actually, the GUI version of that doesn't leak. The function that is called when you put "units matching..." removes the boolexpr for you.
12-24-2006, 09:45 PM#8
Pyrogasm
Is your "Elusion" ability that you're adding to the units every 0.25 seconds a stackable ability, like +damage? If so, you're adding it to the same unit(s) multiple times until the buff wears off. If there are SFX with the ability, then this would definitely add up the lag.

Get what I'm saying? A unit gains the buff, and then every 0.25 seconds (because it still has that buff) the "Elusion" ability is added to it. These abilities only get removed when the buff is removed, so if the buff lasted for 10 seconds, by the end the "elusion" ability would be on the unit 40 times. Not good.
12-24-2006, 11:00 PM#9
rulerofiron99
change it to this:

every .5 seconds EVERY unit loses the spell

then every unit with the buff gains it.
12-25-2006, 12:20 AM#10
Anopob
After looking at it AGAIN, I noticed some things:
  • The 2 groups are different because of "Entire Map" and "Playable Map Area".
  • The 2nd group won't happen (I think), because you're checking if the units DON'T have the spell, and the action is that you REMOVE the spell. ?

Sorry if I misread anything.
12-25-2006, 06:48 AM#11
The)TideHunter(
For your infomation people who said 0.25 will make it lag, you are wrong.
0.01 wont lag with a trigger twice the size.
It something else, it isent the periodic event.
12-25-2006, 08:27 PM#12
Chuckle_Brother
What does the ability do? Some abilities(namely ones that add effects/buffs) can be the laggy.
12-25-2006, 08:32 PM#13
Captain Griffen
Creating and enuming of groups is slow. I'd go with a constant group that has units added when they enter the map, then do if/then/else in a single loop of them, probably on a 1 second timer.
12-25-2006, 09:44 PM#14
rulerofiron99
The thing is that this ability is constantly adding and re-adding the ability to units with the buff.

Like I said, every 0.01 seconds (or whatever), remove the ability from ALL units, then add it to all units with buff.
12-25-2006, 10:29 PM#15
Vexorian
IF that's true, just check the level of the ability, if it is 1, don't add it