• 🏆 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] Need help

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2008
Messages
440
I need to know why its not working. The timer works properly but the loop doesnt fire.
JASS:
function EndTimer_Callback takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer count = LoadInteger(udg_DDHash,GetHandleId(t),1)
    local real x = GetLocationX(udg_Temp_Loc)
    local real y = GetLocationY(udg_Temp_Loc)
    local unit dest = CreateUnit(udg_Target, udg_DDS[count], x, y, 0.00)
    call UnitApplyTimedLife(dest, 'BTLF', 2.00)
    set dest = null
    if count>10 then
          call PauseTimer(t) 
          call DestroyTimer(t) 
          call FlushChildHashtable(udg_DDHash,GetHandleId(t)) 
    endif
    call SaveInteger(udg_DDHash,GetHandleId(t),1,count+1)
endfunction

function Trig_TTD_Actions takes nothing returns nothing
    local integer b = 0
    local integer bf = CountUnitsInGroup(udg_Temp_Group)
    local real x = GetLocationX(udg_Temp_Loc)
    local real y = GetLocationY(udg_Temp_Loc)
    local timer t = CreateTimer()
    local unit dest
    local unit dumb
    local unit u
    call SaveInteger (udg_DDHash, GetHandleId(t), 1, 0)
    call TimerStart(t,  .5, true, function EndTimer_Callback)
    loop
        exitwhen b > bf
        set u = FirstOfGroup(udg_Temp_Group)
        call DisplayTextToPlayer(Player(0), x, y, I2S(b))
        set dumb = CreateUnit(udg_Target, 'h00C',x, y, 0.00)
        call UnitAddAbility(dumb, udg_DestructionBolt)
        call IssueTargetOrder(dumb,"firebolt", u)
        call UnitApplyTimedLife(dumb, 'BTLF', 5.00 )
        set dumb = null
        set b = b + 1
        call GroupRemoveUnit(udg_Temp_Group, u)
        set u = null
        if b == bf then
            call SetUnitExploded(udg_Relic, true)
            call KillUnit(udg_Relic)
        endif
    endloop
    if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS)) then
        call EnableUserControl(false)
    endif
    call CinematicModeBJ( false, bj_FORCE_ALL_PLAYERS )
    set udg_In_Event = false
endfunction

//===========================================================================
function InitTrig_TTD takes nothing returns nothing
    set gg_trg_TTD = CreateTrigger(  )
    call DisableTrigger( gg_trg_TTD )
    call TriggerAddAction( gg_trg_TTD, function Trig_TTD_Actions )
endfunction

Any Ideas?
 
Last edited:
Level 9
Joined
Jun 7, 2008
Messages
440
Yea, hashtable is intialized. The timer itself works to a T. Its the loop that im having problems with. What its supposed to do is kill every hero around it when the count is finished. (Its also when the item dies)

You set u to null before removing it from the group --> will always pick the same unit from the group. Install debug messages.

Fixed the oversight thanks waterknight. Sorry, Im unfamiliar with debug messages. the text was installed to check to see if the loop fires at all.

It still does not work however.
 
Last edited:
Level 9
Joined
Jun 7, 2008
Messages
440
I really dont see what. The hashtable works. All global variables are defined. I did read both "b" and "bf". Starting "b" was declared at 0. "bf" read 42. Ill do a more thorough test tomorrow.
 
Level 9
Joined
Jun 7, 2008
Messages
440
After many hours of rigorous testing, i finally found the problem:
The ability, though saved as a variable, would not give to the dummy unit. I can manually do this, though I am unaware if this would leak, due to the fact that there are a crapload of dummies that need to be created.

Also, I tested it via manually adding it, and they all fired at the same time. Is there a way to wait until hastable count has reached 10 before the dummy units target their respectable targets?
 
Status
Not open for further replies.
Top