[Problem] Unit Respawn Code (Mob Respawn) [NOT SOLVED]
Its difficult to explain what's going wrong with these triggers but I will try.
I tried to apply this into the map I'd currently working on, but some reason it just... glitches up. I have 3 test units set up and it'll respawn them all once, with 2 of the enemies in the right location, but one will be in the wrong location (at the location of one of the other ones) and if they're killed again they just won't respawn. This is with all 3 of them dying in the save time window as the first one.
I'd appreciate any help on this, I've been working on it for a while, and I'd really like to be able to set this up and give it out to everyone to use, but sadly I'm having a really difficult time, both with this, and real life. As I previously mentioned, any help on this would be great.
Its difficult to explain what's going wrong with these triggers but I will try.
I tried to apply this into the map I'd currently working on, but some reason it just... glitches up. I have 3 test units set up and it'll respawn them all once, with 2 of the enemies in the right location, but one will be in the wrong location (at the location of one of the other ones) and if they're killed again they just won't respawn. This is with all 3 of them dying in the save time window as the first one.
I'd appreciate any help on this, I've been working on it for a while, and I'd really like to be able to set this up and give it out to everyone to use, but sadly I'm having a really difficult time, both with this, and real life. As I previously mentioned, any help on this would be great.
-
Unit Respawn Init
-
Events
- Map initialization
- Conditions
-
Actions
- Set HostileUnitGroup = (Units owned by Player 11 (Dark Green))
-
Unit Group - Pick every unit in HostileUnitGroup and do (Actions)
-
Loop - Actions
- Set i = (i + 1)
- Set HostileUnit[i] = (Picked unit)
- Set HostileUnitType[i] = (Unit-type of (Picked unit))
- Set HostileUnitXY[i] = (Position of (Picked unit))
- Set HostileAngle[i] = (Facing of (Picked unit))
- Custom script: set udg_HostileRezTimer[udg_i] = CreateTimer()
- Unit - Remove (Picked unit) from the game
- Countdown Timer - Start HostileRezTimer[i] as a One-shot timer that will expire in (1.00 + ((Real(i)) x 0.05)) seconds
- Set HostileUnitIsDead[i] = True
- Trigger - Add to Unit Respawn <gen> the event (Time - HostileRezTimer[i] expires)
-
Loop - Actions
- Set UnitCount = i
-
Events
-
Unit Death
-
Events
- Unit - A unit owned by Player 11 (Dark Green) Dies
- Conditions
-
Actions
- Game - Display to (All players) the text: Target died
-
For each (Integer i) from 1 to UnitCount, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- HostileUnit[i] Equal to (Triggering unit)
-
Then - Actions
- Game - Display to (All players) the text: Target found
- Set j = i
- Set i = UnitCount
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Unit - Remove (Triggering unit) from the game
- Countdown Timer - Start HostileRezTimer[j] as a One-shot timer that will expire in 90.00 seconds
- Set HostileUnitIsDead[j] = True
-
Events
-
Unit Respawn
- Events
- Conditions
-
Actions
- Game - Display to (All players) the text: Target respawn
-
For each (Integer i) from 1 to UnitCount, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Remaining time for HostileRezTimer[i]) Equal to 0.00
- HostileUnitIsDead[i] Equal to True
-
Then - Actions
- Game - Display to (All players) the text: Target found
- Unit - Create 1 HostileUnitType[i] for Player 11 (Dark Green) at HostileUnitXY[i] facing HostileAngle[i] degrees
- Set HostileUnit[i] = (Last created unit)
- Set HostileUnitIsDead[i] = False
- Set i = UnitCount
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
Last edited: