Ability not adding issue

Discussion in 'JASS Zone' started by afisakov, Oct 29, 2019.

  1. afisakov

    afisakov You can change this now in User CP.

    Ratings:
    +38 / 0 / -0
    Ok, I have an ability, rawcode 'A05J' that I am trying to add to every tower in the map, but for some reason it only shows up on base towers, not on upgraded ones.
    As you can see in the code below it should run on both upgrade finished and construct finish, also I have it triggered to display unit name when it finishes building so I can confirm that triggering unit grabs the upgraded tower and tells me its name... so I cannot tell why the ability does not show up?
    any ideas, or further things to test?
    Code:
    function Trig_global_tech_Actions takes nothing returns nothing
    local integer i=1
    local boolean istech=false
    if GetUnitDefaultAcquireRange(GetTriggerUnit())>9 then
       call UnitAddAbility(GetTriggerUnit(),'A05J')
        call DisplayTextToPlayer(GetLocalPlayer(),0,0,GetUnitName(GetTriggerUnit())+", r: "+R2S(GetUnitDefaultAcquireRange(GetTriggerUnit())) )
    endif
    ...
    endfunction
    
    
    function InitTrig_global_tech takes nothing returns nothing
    local integer i=0
    set gg_trg_global_tech = CreateTrigger()
    loop
       exitwhen i>4
       call TriggerRegisterPlayerUnitEventSimple( gg_trg_global_tech, Player(i), EVENT_PLAYER_UNIT_CONSTRUCT_FINISH )
       call TriggerRegisterPlayerUnitEventSimple( gg_trg_global_tech, Player(i), EVENT_PLAYER_UNIT_UPGRADE_FINISH )
       set i=i+1
    endloop
    call TriggerAddAction( gg_trg_global_tech, function Trig_global_tech_Actions )
    endfunction
    
     

Share This Page