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.

    +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?
    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())) )
    function InitTrig_global_tech takes nothing returns nothing
    local integer i=0
    set gg_trg_global_tech = CreateTrigger()
       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
    call TriggerAddAction( gg_trg_global_tech, function Trig_global_tech_Actions )

Share This Page