Hey guys ! I'm working on a system which gives a buff to a unit according to the terrain path where the unit is.
I've tried many solutions out but it seems the trigger will go into an infinite loop after a few seconds of creeps spawning and walking on the "special" tiles.
The first slow buff is correctly applied but then the map starts to freeze and it's over.
Code is below :
Thanks for reading and helping if you see some mistakes made.
I've tried many solutions out but it seems the trigger will go into an infinite loop after a few seconds of creeps spawning and walking on the "special" tiles.
The first slow buff is correctly applied but then the map starts to freeze and it's over.
Code is below :
-
Creeps terrain effects
-
Events
-
Time - Every 0.61 seconds of game time
-
-
Conditions
-
Actions
-
-------- We are storing the units of AI players into an array --------
-
Set iZoneUnits = 0
-
For each (Integer B) from 21 to 22, do (Actions)
-
Loop - Actions
-
Unit Group - Pick every unit in (Units in P1Zone <gen> matching (((Owner of (Matching unit)) Equal to (Player((Integer B)))) and (((Matching unit) is A structure) Equal to False))) and do (Actions)
-
Loop - Actions
-
Set ZoneUnits[iZoneUnits] = (Picked unit)
-
Set iZoneUnits = (iZoneUnits + 1)
-
-
-
-
-
-------- We check the terrain under the unit --------
-
For each (Integer iUnitLoop) from 0 to iZoneUnits, do (Actions)
-
Loop - Actions
-
Set UnitLocations[iUnitLoop] = (Position of ZoneUnits[iUnitLoop])
-
-------- Icecrown - Dark Ice --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Terrain type at UnitLocations[iUnitLoop]) Equal to Icecrown Glacier - Dark Ice
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(ZoneUnits[iUnitLoop] has buff Slowed) Equal to False
-
-
Then - Actions
-
Unit - Create 1 dummy for (Owner of ZoneUnits[iUnitLoop]) at UnitLocations[iUnitLoop] facing Default building facing degrees
-
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
-
Unit - Add Slow Ice to (Last created unit)
-
Unit - Order (Last created unit) to Orc Shaman - Bloodlust ZoneUnits[iUnitLoop]
-
-
Else - Actions
-
-
-
Else - Actions
-
-------- Lava Cracks --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Terrain type at UnitLocations[iUnitLoop]) Equal to Dungeon - Lava Cracks
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Then - Actions
-
Unit - Create 1 dummy for (Owner of ZoneUnits[iUnitLoop]) at UnitLocations[iUnitLoop] facing Default building facing degrees
-
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
-
Unit - Add Lava Speed to (Last created unit)
-
Unit - Order (Last created unit) to Undead Death Knight - Death Coil ZoneUnits[iUnitLoop]
-
-
Else - Actions
-
-
-
Else - Actions
-
-------- Normal Ice --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(ZoneUnits[iUnitLoop] has buff Slowed) Equal to True
-
-
Then - Actions
-
Unit - Remove Slowed buff from ZoneUnits[iUnitLoop]
-
-
Else - Actions
-
-
-
-
-
-
Custom script: call RemoveLocation(udg_UnitLocations[udg_iUnitLoop])
-
-
-
-
-
Spawn player 1
-
Events
-
Time - Every 2.20 seconds of game time
-
-
Conditions
-
(Number of units in (Units in P1Zone <gen> owned by Player 22 (Snow))) Less than 10
-
-
Actions
-
Unit - Create 1 Skeleton for Player 22 (Snow) at (Center of Player1Spawn <gen>) facing Default building facing degrees
-
-
Thanks for reading and helping if you see some mistakes made.