JASS Saves, Then Goes To Main Screen

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:
JASS:
scope FUPresence initializer FUInit

    globals
        private constant integer f = 'A000'
        private constant integer u = 'A001'
        private constant integer fd = 'A003'
        private constant integer ud = 'A002'
    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() == 'A003' then
            call F2U(GetTriggerUnit())
        elseif GetSpellAbilityId() == 'A002' 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.
 

tooltiperror

Super Moderator
Reaction score
231
Not really, a global is only calculated once anyways. I think JASSHelper does inline them, but I hope it is smart enough not to inline incorrectly.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top