• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

I want to make a simple trigger in jass that kicks the player after he dies

Status
Not open for further replies.
Level 7
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
 
Level 7
Joined
Nov 18, 2012
Messages
312
thanks solved!
JASS:
function Trig_PlayerUnitDies_Actions takes nothing returns nothing
call CustomDefeatBJ(GetOwningPlayer(GetTriggerUnit()),"You lose")
endfunction
function HeroDeadConditions takes nothing returns boolean
return IsUnitType(GetDyingUnit(),UNIT_TYPE_HERO)
endfunction
//===========================================================================
function InitTrig_PlayerUnitDies takes nothing returns nothing
local integer i=0  //so it runs for all players
    set gg_trg_PlayerUnitDies = CreateTrigger(  )
    loop
    exitwhen i>11
    call TriggerRegisterPlayerUnitEvent(gg_trg_PlayerUnitDies, Player(i), EVENT_PLAYER_UNIT_DEATH, Condition(function HeroDeadConditions) )
    set i=i+1
    endloop
   call TriggerAddAction( gg_trg_PlayerUnitDies, function Trig_PlayerUnitDies_Actions )
    set i=0
endfunction
 
Status
Not open for further replies.
Top