private function execFTKS takes nothing returns boolean
local unit u = GetTriggerUnit()
local real hp = GetUnitState(u, UNIT_STATE_MAX_LIFE)
local integer lvl = GetUnitLevel(u)
// Debugging (for you ;p)
static if (DEBUG_MODE) then
if HIGH_HP <= 0.00 then
call BJDebugMsg("[|cffffcc00FTKS|r]|cffff0000Error:|r Invalid High HP global")
return false
endif
if HIGH_LEVEL < 1 then
call BJDebugMsg("[|cffffcc00FTKS|r]|cffff0000Error:|r Invalid High level global")
return false
endif
if SH > MAX_STRINGS then
call BJDebugMsg("[|cffffcc00FTKS|r]|cffff0000Error:|r The SH global is assumed to be greater than MAX_STRINGS")
return false
endif
if BASIS < 0 or BASIS > 3 then
call BJDebugMsg("[|cffffcc00FTKS|r]|cffff0000Error:|r The Basis Id is invalid.")
return false
endif
endif
if BASIS == 0 then
static if (ONLY_FOR_HEROES) then
if IsUnitType(u, UNIT_TYPE_HERO) and hp >= HIGH_HP then
call CreateFT(1, SH, u)
else
call CreateFT(SH + 1, MAX_STRINGS, u)
endif
else
if hp >= HIGH_HP then
call CreateFT(1, SH, u)
else
call CreateFT(SH + 1, MAX_STRINGS, u)
endif
endif
elseif BASIS == 1 then
static if (ONLY_FOR_HEROES) then
if IsUnitType(u, UNIT_TYPE_HERO) and lvl >= HIGH_LEVEL then
call CreateFT(1, SH, u)
else
call CreateFT(SH + 1, MAX_STRINGS, u)
endif
else
if lvl >= HIGH_LEVEL then
call CreateFT(1, SH, u)
else
call CreateFT(SH + 1, MAX_STRINGS, u)
endif
endif
elseif BASIS == 2 then
static if (ONLY_FOR_HEROES) then
if IsUnitType(u, UNIT_TYPE_HERO) and hp >= HIGH_HP and lvl >= HIGH_LEVEL then
call CreateFT(1, SH, u)
else
call CreateFT(SH + 1, MAX_STRINGS, u)
endif
else
if hp >= HIGH_HP and lvl >= HIGH_LEVEL then
call CreateFT(1, SH, u)
else
call CreateFT(SH + 1, MAX_STRINGS, u)
endif
endif
elseif BASIS == 3 then
static if (ONLY_FOR_HEROES) then
if IsUnitType(u, UNIT_TYPE_HERO) then
call CreateFT(1, SH, u)
else
call CreateFT(SH + 1, MAX_STRINGS, u)
endif
else
call CreateFT(1, MAX_STRINGS, u)
endif
endif
set u = null
return false
endfunction
private function InitFTKS takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
exitwhen i >= 16
call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_DEATH, null)
set i = i + 1
endloop
call Settings()
call TriggerAddCondition(t, Condition(function execFTKS))
endfunction