I've been trying to make a vjass creeps respawn system, but as I just started using jass less then a week ago I can't seem to make it work.
JASS:
library CreepsRespawn initializer CRInit
function UnitRespawn takes unit u returns nothing
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real f = GetUnitFacing(u)
local integer i = GetUnitTypeId(u)
call TriggerSleepAction(5)
call CreateUnit(Player(11), i, x, y, f)
endfunction
function CreepDeath takes nothing returns nothing
if (GetOwningPlayer(GetTriggerUnit()) == Player(11)) then
call UnitRespawn(GetTriggerUnit())
endif
endfunction
function CRInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(t, function CreepDeath)
endfunction
endlibrary
Last edited: