Ive been going around an testing all my current triggers to see if there is any improvements i can do etc etc.
I ran into an issue i didnt notice before in my Hero Respawn trigger.
When the the Hero respawns he loses his inventory items.
How would i make this not happen?
Hero Respawn
Events
Unit - Any Unit dies
Local Variables
Killed Hero = No Game Link <Game Link - Unit>
Current Level = 0 <Integer>
Conditions
(Experience level of (Triggering unit)) >= 1
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) == 1
Then
Variable - Set Killed Hero = (Unit type of (Triggering unit))
Variable - Set Current Level = (Experience level of (Triggering unit))
UI - Display (Combine ((Text (Name of player (Triggering player)) with color (Color((Current player (Triggering player) color)))), (Text "'s" with color (Color((Current player (Triggering player) color)))), (Name of (Unit type of (Triggering unit))), " has died, and w for (All players) to Subtitle area
General - Wait 10.0 Real Time seconds
Unit - Create 1 Killed Hero for player 1 at Player 1 Start facing 0.0 degrees (No Options)
Unit - Set (Last created unit) Level to (Real(Current Level))
Don't just recreate the unit. Set the death time to -1 and use the UnitRevive function on the dead unit instead, it revives the actual unit instead of creating a new one, so all items, experience, learned abilities etc don't get lost.
Ive been going around an testing all my current triggers to see if there is any improvements i can do etc etc. I ran into an issue i didnt notice before in my Hero Respawn trigger. When the the Hero respawns he loses his inventory items. How would i make this not happen?
Hero Respawn
Events
Unit - Any Unit dies
Local Variables
Killed Hero = No Game Link <Game Link - Unit>
Current Level = 0 <Integer>
Conditions
(Experience level of (Triggering unit)) >= 1
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Owner of (Triggering unit)) == 1
Then
Variable - Set Killed Hero = (Unit type of (Triggering unit))
Variable - Set Current Level = (Experience level of (Triggering unit))
UI - Display (Combine ((Text (Name of player (Triggering player)) with color (Color((Current player (Triggering player) color)))), (Text "'s" with color (Color((Current player (Triggering player) color)))), (Name of (Unit type of (Triggering unit))), " has died, and w for (All players) to Subtitle area
General - Wait 10.0 Real Time seconds
Unit - Create 1 Killed Hero for player 1 at Player 1 Start facing 0.0 degrees (No Options)
Unit - Set (Last created unit) Level to (Real(Current Level))
Else
Is your death timer thing in DATA -1 or w/e?
@DogmaiSEA: Go
death timer thing?
@DogmaiSEA: Go
oh. no its set to 0
Don't just recreate the unit. Set the death time to -1 and use the UnitRevive function on the dead unit instead, it revives the actual unit instead of creating a new one, so all items, experience, learned abilities etc don't get lost.