HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger gives spurts of lag

08-20-2005, 04:01 AM#1
MrApples
I'm working on a AoS and this trigger gives freezes the game for half a second. Its not really a big deal but its annoying, anyway I can make it smooth?

Quote:
Sending
Events
Unit - A unit Finishes training a unit
Conditions
Actions
Set TempUnitGroup = (Units owned by Player 11 (Dark Green) matching (((Matching unit) is in Ordered) Equal to False))
Unit Group - Pick every unit in TempUnitGroup and do (Actions)
Loop - Actions
Set TempUnitGroup2 = (Units owned by Player 12 (Brown) matching (((Matching unit) is A town-hall-type unit) Equal to True))
Unit - Order (Trained unit) to Attack (Random unit from TempUnitGroup2)
Custom script: call DestroyGroup(udg_TempUnitGroup)
Custom script: call DestroyGroup(udg_TempUnitGroup2)
Unit Group - Add (Picked unit) to Ordered
Set TempUnitGroup = (Units owned by Player 12 (Brown) matching (((Matching unit) is in Ordered) Equal to False))
Unit Group - Pick every unit in TempUnitGroup and do (Actions)
Loop - Actions
Set TempUnitGroup2 = (Units owned by Player 11 (Dark Green) matching (((Matching unit) is A town-hall-type unit) Equal to True))
Unit - Order (Picked unit) to Attack (Random unit from TempUnitGroup2)
Custom script: call DestroyGroup(udg_TempUnitGroup)
Custom script: call DestroyGroup(udg_TempUnitGroup2)
Unit Group - Add (Picked unit) to Ordered

Also this trigger freezes the game alot more than it should, for just a simple move unit trigger. Perhaps moving the unit during a special effect does it?

Quote:
Bought Hero
Events
Unit - A unit Sells a unit
Conditions
((Sold unit) is A Hero) Equal to True
Actions
Set TempPlayerGroup = (All players matching (((Matching player) is an ally of Player 11 (Dark Green)) Equal to True))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Owner of (Buying unit)) is in TempPlayerGroup) Equal to True
Then - Actions
Set TempUnitGroup = (Units owned by Player 11 (Dark Green) matching (((Matching unit) is A town-hall-type unit) Equal to True))
Unit - Move (Sold unit) instantly to (Position of (Random unit from TempUnitGroup))
Custom script: call DestroyGroup(udg_TempUnitGroup)
Else - Actions
Set TempUnitGroup = (Units owned by Player 12 (Brown) matching (((Matching unit) is A town-hall-type unit) Equal to True))
Unit - Move (Sold unit) instantly to (Position of (Random unit from TempUnitGroup))
Custom script: call DestroyGroup(udg_TempUnitGroup)
Custom script: call DestroyForce(udg_TempPlayerGroup)
08-20-2005, 05:18 PM#2
Vexorian
The first one: Random unit in unit group is a time intesive function and you call it twice per unit in that other group.

The second one: Perhaps there is a trigger that executes when a unit is moved there what is causing the lag?

I am betting that Player 12 has a lot of units?
08-20-2005, 08:21 PM#3
MrApples
Player 11 and 12 both have about 20 productions buildings each which produce a unit about every 25 seconds. The point of the trigger is to tell the units to go fight.
08-20-2005, 11:22 PM#4
Vexorian
For starters you could simply add the units of player 12 a player group variable each time they are trained, and remove them when they die.

So you don't have to create a new group everytime
08-23-2005, 06:04 PM#5
MrApples
I've fixed the lag by adding a trigger that auto picks instead of random.

But now the units go back to their traning buildings once they are no longer in range to attack anything(after using a ability/attacking).