Feralex
Active Member
- Reaction score
- 4
This trigger works as intended but when a unit owned by player 5 is ordered an order many many time over it causes the game to lag after a while but i cant see why. The Point variable is destroyed and as far as i can see its the only thing that possibly can cause a memory leak. "CenterofMap" is a point variable created at the initialization of the map.
I dont know if this is necasary to show but its connected to the previous trigger. Its basically a slightly remade respawning-trigger to save the position and facing of all units owned by player 5.
Code:
YellowRing
Events
Advanced - Any Unit is Issued Any Order
Conditions
(Owner of (Ordered unit)) Equal to Player 5 (Yellow)
Actions
Wait 0.01 seconds
Set Yellowunitpoint = (CenterofMap offset by (YellowRX[(Custom value of (Ordered unit))], YellowRY[(Custom value of (Ordered unit))]))
Unit - Move (Ordered unit) instantly to Yellowunitpoint, facing YellowRangle[(Custom value of (Ordered unit))] degrees
Point - Remove Yellowunitpoint
I dont know if this is necasary to show but its connected to the previous trigger. Its basically a slightly remade respawning-trigger to save the position and facing of all units owned by player 5.
Code:
YellowR
Events
Map initialization
Conditions
Actions
Set YellowRgroup = (Units owned by Player 5 (Yellow))
Unit Group - Pick every unit in YellowRgroup and do (Actions)
Loop - Actions
Set YellowRint = (YellowRint + 1)
Unit - Set the custom value of (Picked unit) to YellowRint
Custom script: set udg_YellowRX[udg_YellowRint] = GetUnitX(GetEnumUnit())
Custom script: set udg_YellowRY[udg_YellowRint] = GetUnitY(GetEnumUnit())
Set YellowRangle[YellowRint] = (Facing of (Picked unit))
Unit Group - Destroy unit group YellowRgroup