Unit Dies
Events
Unit - A unit Dies
Conditions
Actions
Set DeadUnits[unitnumber] = (Dying unit)
Set Location[unitnumber] = (Position of (Dying unit))
Set owner[unitnumber] = (Owner of (Dying unit))
Set unitnumber = (unitnumber + 1)
Respawn
Events
Time - Every 60.00 seconds of game time
Conditions
Actions
For each (Integer A) from 0 to unitnumber, do (Actions)
Loop - Actions
Unit - Create 1 (Unit-type of DeadUnits[(Integer A)]) for owner[(Integer A)] at Location[(Integer A)] facing Default building facing degrees
Set unitnumber = 0
Code:Unit Dies Events Unit - A unit Dies Conditions Actions Set DeadUnits[unitnumber] = (Dying unit) Set Location[unitnumber] = (Position of (Dying unit)) Set owner[unitnumber] = (Owner of (Dying unit)) Set unitnumber = (unitnumber + 1)
Code:Respawn Events Time - Every 60.00 seconds of game time Conditions Actions For each (Integer A) from 0 to unitnumber, do (Actions) Loop - Actions Unit - Create 1 (Unit-type of DeadUnits[(Integer A)]) for owner[(Integer A)] at Location[(Integer A)] facing Default building facing degrees Set unitnumber = 0
WARNING - This code has memory leaks in the Respawn trigger. I was unsure how to get rid of the variables when they are an array, I'm not that experienced in JASS at all. Assuming you can fix this memory leaks this should revive units every minute.
call RemoveLocation(udg_Your_Variable_Name[YourVariableIndex])