rodead
Active Member
- Reaction score
- 42
i got a code for a mini Escape and it looks like this:
the only problem is the unit won't die and i don't know why so could you guys help me out?
Edit: i made the code better but still got the same problem hope it is now oke and without leaks.
thanks in advanced and +rep
the only problem is the unit won't die and i don't know why so could you guys help me out?
Code:
Quest 2 Die 2
Events
Time - Every 0.05 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to 8, do (Actions)
Loop - Actions
Set Quest_2_Loc[(Integer A)] = (Position of Quest2Unit[(Integer A)])
Set UnitGroup[(Integer A)] = (Units within 75.00 of Quest_2_Loc[(Integer A)] matching ((Unit-type of
(Matching unit)) Equal to Footman))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[1]) Greater than 0
Killbandits[1] Less than 5
Then - Actions
Unit - Kill Quest2Unit[1]
Wait 2.00 seconds
Hero - Instantly revive Quest2Unit[1] at (Center of Quest 2 <gen>), Hide revival graphics
Camera - Pan camera for (Owner of Quest2Unit[1]) to (Center of Quest 2 <gen>) over 0.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[1]) Greater than 0
Killbandits[1] Greater than or equal to 5
Then - Actions
Unit - Kill Quest2Unit[1]
Wait 2.00 seconds
Hero - Instantly revive Quest2Unit[1] at (Center of Kill Robbers <gen>), Hide revival graphics
Camera - Pan camera for (Owner of Quest2Unit[1]) to (Center of Kill Robbers <gen>) over 0.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[2]) Greater than 0
Killbandits[2] Less than 5
Then - Actions
Unit - Kill Quest2Unit[2]
Wait 2.00 seconds
Hero - Instantly revive Quest2Unit[2] at (Center of Quest 2 <gen>), Hide revival graphics
Camera - Pan camera for (Owner of Quest2Unit[2]) to (Center of Quest 2 <gen>) over 0.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[2]) Greater than 0
Killbandits[2] Greater than or equal to 5
Then - Actions
Unit - Kill Quest2Unit[2]
Wait 2.00 seconds
Hero - Instantly revive Quest2Unit[2] at (Center of Kill Robbers <gen>), Hide revival graphics
Camera - Pan camera for (Owner of Quest2Unit[2]) to (Center of Kill Robbers <gen>) over 0.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[3]) Greater than 0
Killbandits[3] Less than 5
Then - Actions
Unit - Kill Quest2Unit[3]
Wait 2.00 seconds
Hero - Instantly revive Quest2Unit[3] at (Center of Quest 2 <gen>), Hide revival graphics
Camera - Pan camera for (Owner of Quest2Unit[3]) to (Center of Quest 2 <gen>) over 0.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[3]) Greater than 0
Killbandits[3] Greater than or equal to 5
Then - Actions
Unit - Kill Quest2Unit[3]
Wait 2.00 seconds
Hero - Instantly revive Quest2Unit[3] at (Center of Kill Robbers <gen>), Hide revival graphics
Camera - Pan camera for (Owner of Quest2Unit[3]) to (Center of Kill Robbers <gen>) over 0.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[4]) Greater than 0
Killbandits[4] Less than 5
Then - Actions
Unit - Kill Quest2Unit[4]
Wait 2.00 seconds
Hero - Instantly revive Quest2Unit[4] at (Center of Quest 2 <gen>), Hide revival graphics
Camera - Pan camera for (Owner of Quest2Unit[4]) to (Center of Quest 2 <gen>) over 0.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[4]) Greater than 0
Killbandits[4] Greater than or equal to 5
Then - Actions
Unit - Kill Quest2Unit[4]
Wait 2.00 seconds
Camera - Pan camera for (Owner of Quest2Unit[4]) to (Center of Kill Robbers <gen>) over 0.00 seconds
Hero - Instantly revive Quest2Unit[4] at (Center of Kill Robbers <gen>), Hide revival graphics
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[5]) Greater than 0
Killbandits[5] Less than 5
Then - Actions
Unit - Kill Quest2Unit[5]
Wait 2.00 seconds
Hero - Instantly revive Quest2Unit[5] at (Center of Quest 2 <gen>), Hide revival graphics
Camera - Pan camera for (Owner of Quest2Unit[5]) to (Center of Quest 2 <gen>) over 0.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[5]) Greater than 0
Killbandits[5] Greater than or equal to 5
Then - Actions
Unit - Kill Quest2Unit[5]
Wait 2.00 seconds
Camera - Pan camera for (Owner of Quest2Unit[5]) to (Center of Kill Robbers <gen>) over 0.00 seconds
Hero - Instantly revive Quest2Unit[5] at (Center of Kill Robbers <gen>), Hide revival graphics
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[6]) Greater than 0
Killbandits[6] Less than 5
Then - Actions
Unit - Kill Quest2Unit[6]
Wait 2.00 seconds
Hero - Instantly revive Quest2Unit[6] at (Center of Quest 2 <gen>), Hide revival graphics
Camera - Pan camera for (Owner of Quest2Unit[6]) to (Center of Quest 2 <gen>) over 0.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[6]) Greater than 0
Killbandits[6] Greater than or equal to 5
Then - Actions
Unit - Kill Quest2Unit[6]
Wait 2.00 seconds
Camera - Pan camera for (Owner of Quest2Unit[6]) to (Center of Kill Robbers <gen>) over 0.00 seconds
Hero - Instantly revive Quest2Unit[6] at (Center of Kill Robbers <gen>), Hide revival graphics
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[7]) Greater than 0
Killbandits[7] Less than 5
Then - Actions
Unit - Kill Quest2Unit[7]
Wait 2.00 seconds
Hero - Instantly revive Quest2Unit[7] at (Center of Quest 2 <gen>), Hide revival graphics
Camera - Pan camera for (Owner of Quest2Unit[7]) to (Center of Quest 2 <gen>) over 0.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[7]) Greater than 0
Killbandits[7] Greater than or equal to 5
Then - Actions
Unit - Kill Quest2Unit[7]
Wait 2.00 seconds
Camera - Pan camera for (Owner of Quest2Unit[7]) to (Center of Kill Robbers <gen>) over 0.00 seconds
Hero - Instantly revive Quest2Unit[7] at (Center of Kill Robbers <gen>), Hide revival graphics
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[8]) Greater than 0
Killbandits[8] Less than 5
Then - Actions
Unit - Kill Quest2Unit[8]
Wait 2.00 seconds
Hero - Instantly revive Quest2Unit[8] at (Center of Quest 2 <gen>), Hide revival graphics
Camera - Pan camera for (Owner of Quest2Unit[8]) to (Center of Quest 2 <gen>) over 0.00 seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in UnitGroup[8]) Greater than 0
Killbandits[8] Greater than or equal to 5
Then - Actions
Unit - Kill Quest2Unit[8]
Wait 2.00 seconds
Camera - Pan camera for (Owner of Quest2Unit[8]) to (Center of Kill Robbers <gen>) over 0.00 seconds
Hero - Instantly revive Quest2Unit[8] at (Center of Kill Robbers <gen>), Hide revival graphics
Else - Actions
For each (Integer A) from 1 to 8, do (Actions)
Loop - Actions
Custom script: call DestroyGroup (udg_UnitGroup[bj_forLoopAIndex])
Custom script: call RemoveLocation (udg_Quest_2_Loc[bj_forLoopAIndex])
Edit: i made the code better but still got the same problem hope it is now oke and without leaks.
thanks in advanced and +rep