- Joined
- Jul 25, 2009
- Messages
- 3,091
Once you get enough units fielded (maybe 20-30 for one player) this starts lagging like ass, it works exactly as I want it to, it's just not scaleable. How can I make it more efficient. Or completely rework it so it doesn't need to work with a loop at all, (I know I can use a dds to detect hp loss but not hp gain, and I have another loop just like this one that detects mana loss and gain which I need as well.)
-
HP Check
-
Events
-
Time - Every 0.03 seconds of game time
-
-
Conditions
-
Actions
-
Set TempGroup = (Units in (Playable map area) matching (((Level of Squad Leader Attachment for (Matching unit)) Greater than 0) and (((Matching unit) is dead) Equal to False)))
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
-
Set TempGroup2 = (Units in (Playable map area) matching (((Custom value of (Picked unit)) Equal to (Custom value of (Matching unit))) and ((((Matching unit) is dead) Equal to False) and ((Picked unit) Not equal to (Matching unit)))))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Percentage life of GLeader[(Custom value of (Picked unit))]) Less than or equal to (GPercentage[(Custom value of (Picked unit))] x (GCurrentSquadSize[(Custom value of (Picked unit))] - 1.00))
-
-
Then - Actions
-
Set TempUnit = (Random unit from TempGroup2)
-
Unit - Kill TempUnit
-
Set GCurrentSquadSize[(Custom value of (Picked unit))] = (GCurrentSquadSize[(Custom value of (Picked unit))] - 1.00)
-
Unit - Set mana of GLeader[(Custom value of (Picked unit))] to ((Percentage mana of GLeader[(Custom value of (Picked unit))]) - GPercentage[(Custom value of (Picked unit))])%
-
-
Else - Actions
-
-
-
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Percentage life of GLeader[(Custom value of (Picked unit))]) Greater than (GPercentage[(Custom value of (Picked unit))] x (GCurrentSquadSize[(Custom value of (Picked unit))] - 0.00))
-
GCurrentSquadSize[(Custom value of (Picked unit))] Less than (Real((Point-value of (Unit-type of (Picked unit)))))
-
-
Then - Actions
-
Set GPoint[1] = (Position of (Picked unit))
-
Set tempLoc2 = (GPoint[1] offset by 160.00 towards (72.00 x (Real(GInt))) degrees)
-
Unit - Create 1 Locust Dummy for (Owner of (Picked unit)) at tempLoc2 facing (Facing of (Picked unit)) degrees
-
Unit - Add Locust Switcher to (Last created unit)
-
Custom script: call UnitAddAbility(GetLastCreatedUnit(),'Aloc')
-
Custom script: call UnitRemoveAbility(GetLastCreatedUnit(),'Aloc')
-
Unit - Set level of Locust Switcher for (Last created unit) to (Level of (Picked unit))
-
AI - Ignore (Last created unit)'s guard position
-
Unit - Set the custom value of (Last created unit) to (Custom value of (Picked unit))
-
Special Effect - Create a special effect at tempLoc2 using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
-
Special Effect - Destroy (Last created special effect)
-
Unit - Disable supply usage for (Last created unit)
-
Set GCurrentSquadSize[(Custom value of (Picked unit))] = (GCurrentSquadSize[(Custom value of (Picked unit))] + 1.00)
-
Custom script: call RemoveLocation(udg_GPoint[1])
-
Custom script: call RemoveLocation(udg_GPoint[2])
-
-
Else - Actions
-
-
-
-
Custom script: call DestroyGroup(udg_TempGroup)
-
Custom script: call DestroyGroup(udg_TempGroup2)
-
-