- Joined
- Nov 18, 2012
- Messages
- 312
JASS:
//But I failed.
//I don't really know how the native works
function Trig_PlayerDies_Actions takes nothing returns nothing
call CustomDefeatBJ(Player(GetPlayerId(GetTriggerPlayer())),"You lose")
endfunction
function HeroDeadConditions takes nothing returns boolean
return IsUnitType(GetDyingUnit(),UNIT_TYPE_HERO)
endfunction
//===========================================================================
function InitTrig_PlayerDies takes nothing returns nothing
local integer i=0 //so it runs for all players
set gg_trg_PlayerDies = CreateTrigger( )
loop
exitwhen i>11
call TriggerRegisterPlayerUnitEvent(gg_trg_PlayerDies, Player(i), EVENT_PLAYER_UNIT_DEATH, Condition(function HeroDeadConditions) )
set i=i+1
endloop
call TriggerAddAction( gg_trg_PlayerDies, function Trig_PlayerDies_Actions )
set i=0
endfunction