WolfieeifloW
WEHZ Helper
- Reaction score
- 372
Yepp, figured that out, thank you for all your help though!
Here's the final working script, in case any finds this later on and wants the final answer:
Adding "private constant" apparently working.
Although I don't think the constant is needed.
Here's the final working script, in case any finds this later on and wants the final answer:
JASS:
scope FUPresence initializer FUInit
globals
private constant integer f = 039;A000039;
private constant integer u = 039;A001039;
private constant integer fd = 039;A003039;
private constant integer ud = 039;A002039;
endglobals
function F2U takes unit t returns nothing
local integer l
set l = GetUnitAbilityLevel(t, fd)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), f, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), u, true)
call UnitRemoveAbility(t, fd)
call UnitAddAbility(t, ud)
call SetUnitAbilityLevel(t, ud, l)
call SetUnitAbilityLevel(t, u, l)
endfunction
function U2F takes unit t returns nothing
local integer l
set l = GetUnitAbilityLevel(t, ud)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), u, false)
call SetPlayerAbilityAvailable(GetOwningPlayer(t), f, true)
call UnitRemoveAbility(t, ud)
call UnitAddAbility(t, fd)
call SetUnitAbilityLevel(t, fd, l)
call SetUnitAbilityLevel(t, f, l)
endfunction
function Conditions takes nothing returns boolean
if GetSpellAbilityId() == 039;A003039; then
call F2U(GetTriggerUnit())
elseif GetSpellAbilityId() == 039;A002039; then
call U2F(GetTriggerUnit())
endif
return false
endfunction
function FUInit takes nothing returns nothing
local integer index = 0
local trigger tr = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(tr, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(tr, Condition(function Conditions))
endfunction
endscope
Adding "private constant" apparently working.
Although I don't think the constant is needed.