Okay so i've been trying to create a respawn system that goes like:
Each creep has its own spawn region, each region and creep is assigned to an array, where the region index is equal to the creep index. it looks like this:
The problem is, i'm new at jass, and i can't tell what fails in this script
So please help a newbie there thanks in advance
Each creep has its own spawn region, each region and creep is assigned to an array, where the region index is equal to the creep index. it looks like this:
JASS:
function Trig_BaseUnitRespawn_Actions takes nothing returns nothing
local unit m = GetDyingUnit()
local integer ml = GetUnitLevel(m)
local unittype mt = GetUnitTypeId(m)
local player p = GetOwningPlayer(m)
local integer i = 0
local integer c = 0
local real t = I2R(ml)+10.
local real f = 0.
local real x = 0.
local real y = 0.
loop
exitwhen c == 1
if IsUnit(m, udg_UnA_Lvl1[i]) then
set c = 1
set f = GetUnitFacing(m)
set x = GetRectCenterX(udg_ReA_Lvl1[i])
set y = GetRectCenterY(udg_ReA_Lvl1[i])
call TriggerSleepAction(t)
call CreateUnit(p, mt, x, y, f)
endif
set i = i+1
endloop
set m = null
set p = null
endfunction
//==== Init Trigger BaseUnitRespawn ====
function InitTrig_BaseUnitRespawn takes nothing returns nothing
local trigger BaseUnitRespawn = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(BaseUnitRespawn, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(BaseUnitRespawn, function Trig_BaseUnitRespawn_Actions)
endfunction
So please help a newbie there thanks in advance
Last edited: