Strange title I am aware...
Anyway. I've made a spell for my joke hero where he summons fish dependant on how many kills he has. His kills get halved when he casts the spell. The fish then home in on enemies and explode dealing damage equal to his strength, if there are no targets then they follow the caster instead.
I was testing it and had cheated and probably had about 70 fish (couldn't really tell as they all have locust) and it caused MASSIVE lag when they returned to the caster. The likely-hood of having that many at once is very unlikely but I wanted to know whether it is the model causing the lag or my movement trigger.
So here it is:
Anyway. I've made a spell for my joke hero where he summons fish dependant on how many kills he has. His kills get halved when he casts the spell. The fish then home in on enemies and explode dealing damage equal to his strength, if there are no targets then they follow the caster instead.
I was testing it and had cheated and probably had about 70 fish (couldn't really tell as they all have locust) and it caused MASSIVE lag when they returned to the caster. The likely-hood of having that many at once is very unlikely but I wanted to know whether it is the model causing the lag or my movement trigger.
So here it is:
-
Manhood Follow
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
-
For each (Integer MH_LoopInt) from 0 to MH_MaxIndex, do (Actions)
-
Loop - Actions
- Set MH_CasterPoint = (Position of MH_Dummy[MH_LoopInt])
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- MH_Target[MH_LoopInt] Not equal to No unit
- (MH_Target[MH_LoopInt] is alive) Equal to True
-
Then - Actions
- Set TempPoint = (Position of MH_Target[MH_LoopInt])
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Distance between MH_CasterPoint and TempPoint) Less than 15.00
-
Then - Actions
- Unit - Kill MH_Dummy[MH_LoopInt]
- Unit - Cause MH_Caster to damage MH_Target[MH_LoopInt], dealing (Real((Strength of MH_Caster (Exclude bonuses)))) damage of attack type Spells and damage type Universal
- Set MH_Dummy[MH_LoopInt] = MH_Dummy[MH_MaxIndex]
- Set MH_Target[MH_LoopInt] = MH_Target[MH_MaxIndex]
- Set MH_MaxIndex = (MH_MaxIndex - 1)
- Set MH_LoopInt = (MH_LoopInt - 1)
-
Else - Actions
- Unit - Move MH_Dummy[MH_LoopInt] instantly to (MH_CasterPoint offset by 15.00 towards (Angle from MH_CasterPoint to TempPoint) degrees), facing TempPoint
-
If - Conditions
- Custom script: call RemoveLocation(udg_TempPoint)
-
Else - Actions
- Set TempUnitGroup = (Units within 1200.00 of MH_CasterPoint matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) is an enemy of (Owner of MH_Caster)) Equal to True)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in TempUnitGroup) Greater than or equal to 1
-
Then - Actions
- Set MH_Target[MH_LoopInt] = (Random unit from TempUnitGroup)
- Set MH_LoopInt = (MH_LoopInt - 1)
-
Else - Actions
- Set TempPoint = (Position of MH_Caster)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Distance between MH_CasterPoint and TempPoint) Greater than 60.00
-
Then - Actions
- Unit - Move MH_Dummy[MH_LoopInt] instantly to (MH_CasterPoint offset by 15.00 towards (Angle from MH_CasterPoint to TempPoint) degrees), facing TempPoint
-
Else - Actions
- Unit - Make MH_Dummy[MH_LoopInt] face MH_Caster over 0.00 seconds
-
If - Conditions
- Custom script: call RemoveLocation(udg_TempPoint)
-
If - Conditions
- Custom script: call DestroyGroup(udg_TempUnitGroup)
-
If - Conditions
- Custom script: call RemoveLocation(udg_MH_CasterPoint)
-
Loop - Actions
-
For each (Integer MH_LoopInt) from 0 to MH_MaxIndex, do (Actions)
-
Events