Make Last Created Unit In/Vulnerable

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?

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)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top