Opa
New Member
- Reaction score
- 3
Hello everyone,
I want to make my Unit invulnerable for 2 seconds if it respawns and then vulnerable again. This was my first thought with what I have came up:
but since blizzard is only storing one unit as last created unit it bugs when 2 units respawn at the same time because one of the unit is invulnerable for ever.
will this work then?
(all scripts are vanilla jass because my language is not supported here)
I want to make my Unit invulnerable for 2 seconds if it respawns and then vulnerable again. This was my first thought with what I have came up:
JASS:
call SetUnitInvulnerable( GetLastCreatedUnit(), true )
call TriggerSleepAction( 2 )
call SetUnitInvulnerable( GetLastCreatedUnit(), false )
but since blizzard is only storing one unit as last created unit it bugs when 2 units respawn at the same time because one of the unit is invulnerable for ever.
will this work then?
JASS:
set udg_TEMP_INV_VUL[GetConvertedPlayerId(GetTriggerPlayer())] = GetLastCreatedUnit()
else
call DoNothing( )
endif
call SetUnitInvulnerable( udg_TEMP_INV_VUL[GetConvertedPlayerId(GetTriggerPlayer())], true )
call TriggerSleepAction( 2 )
call SetUnitInvulnerable( udg_TEMP_INV_VUL[GetConvertedPlayerId(GetTriggerPlayer())], false )
(all scripts are vanilla jass because my language is not supported here)