• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] JassScipt Help (Not Working Script)

Status
Not open for further replies.
Level 1
Joined
Aug 8, 2009
Messages
5
Could someone help me why this script is not working
JASS:
function GetSTD takes integer b, integer ex returns integer
    local integer count = 1
    local integer result = b
    if (ex==0) then
        return 1
    endif
    if (ex==1) then
        return 2
    endif
    loop 
        exitwhen (count==ex)
        set result = result * b
        set count = count + 1
    endloop
    return result
endfunction

function Trig_Generator_Func009Func001Func001C takes nothing returns boolean
    if ( not ( GetUnitAbilityLevelSwapped('A000', GetEnumUnit()) > 0 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Generator_Func009Func001A takes nothing returns nothing
    local integer tempint
    
    if ( Trig_Generator_Func009Func001Func001C() ) then
        set tempint = 5 * GetSTD(2,GetUnitAbilityLevelSwapped('A004', GetEnumUnit()))
        call AdjustPlayerStateBJ( (tempint), GetOwningPlayer(GetEnumUnit()), PLAYER_STATE_RESOURCE_GOLD )
        call CreateTextTagUnitBJ( ( "+" + I2S((tempint))), GetEnumUnit(), 0, 10, 100, 100, 0.00, 0 )
        call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
        call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.00 )
        call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 100.00, 90 )
    else
        call DoNothing(  )
    endif
endfunction

function Trig_Generator_Func009A takes nothing returns nothing
    call ForGroupBJ( udg_FarmGroup, function Trig_Generator_Func009Func001A )
    call GroupClear( udg_FarmGroup )
endfunction

function Trig_Generator_Actions takes nothing returns nothing
    // Add Farm1, Farm2 and Farm3 into one unit group
    set udg_FarmGroup = GetUnitsOfTypeIdAll('h002')
    set udg_FarmGroupTemp = GetUnitsOfTypeIdAll('h003')
    call GroupAddGroup( udg_FarmGroupTemp, udg_FarmGroup )
    call GroupClear( udg_FarmGroupTemp )
    set udg_FarmGroupTemp = GetUnitsOfTypeIdAll('h004')
    call GroupAddGroup( udg_FarmGroupTemp, udg_FarmGroup )
    call GroupClear( udg_FarmGroupTemp )
    call ForForce( udg_RoadRunners, function Trig_Generator_Func009A )
endfunction

//===========================================================================
function InitTrig_Generator takes nothing returns nothing
    set gg_trg_Generator = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Generator, 1.00 )
    call TriggerAddAction( gg_trg_Generator, function Trig_Generator_Actions )
endfunction
Thank You in advance
 
Level 1
Joined
Aug 8, 2009
Messages
5
oh i already solve it thank you for your answer
JASS:
function Trig_Generator_Func009Func001Func001C takes nothing returns boolean
    if ( not ( GetUnitAbilityLevelSwapped('A000', GetEnumUnit()) > 0 ) ) then
        return false
    endif
    return true
endfunction
it's selecting wrong unit at the 'A000' it must be A004
 
Status
Not open for further replies.
Top