GetHandleId

BlueMirage

Trust, but doubt.
Reaction score
39
I have a very wierd problem here.
When I use GetHandleId on my newly created local trigger, it gives me a number. However, when I try to get that same number when using GetHandleId on GetTriggeringTrigger(), I always get 0.

Anybody knows why this happens?

JASS:
function NullAreaSlide takes nothing returns boolean
    local unit u = GetTriggerUnit()
    local trigger t = GetTriggeringTrigger()
    local integer i = GetHandleId(t)
    local real x = LoadReal(udg_Hashtable, i, 0)
    local real y = LoadReal(udg_Hashtable, i, 1)


    call BJDebugMsg(I2S(i)) //Always returns 0!!!

    call PointProjection(x, y, GetUnitX(u), GetUnitY(u), 150) //Custom function, irrelevant
    call SetUnitX(u, udg_TempX)
    call SetUnitY(u, udg_TempY)
    return false
endfunction

function Trig_Null_Area_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local integer i = GetHandleId(t)
    local unit u = GetTriggerUnit()
    local real x = GetSpellTargetX()
    local real y = GetSpellTargetY()
    local unit area = CreateUnit(GetOwningPlayer(u), 'u004', x, y, 270.)
    local trigger trig = CreateTrigger()

    call SaveUnitHandle(udg_Hashtable, i, 0, area)
    call SaveUnitHandle(udg_Hashtable, i, 1, u)
    call SaveTriggerHandle(udg_Hashtable, i, 2, trig)

    set i = GetHandleId(trig)
    call BJDebugMsg(I2S(i)) //Returns a correct number.
    call TriggerRegisterUnitInRange(trig, area, 140, Condition(function NullAreaSlide))
    call SaveReal(udg_Hashtable, i, 0, x)
    call SaveReal(udg_Hashtable, i, 1, y)

    call TimerStart(t, 7., false, function DestroyNullArea)

    set u = null
    set area = null
    set trig = null
    set t = null
endfunction
 

Komaqtion

You can change this now in User CP.
Reaction score
469
That is because you cannot use [ljass]GetTriggeringTrigger()[/ljass] in the 'filter' of an event registeration...

Try putting 'null' here: [ljass] call TriggerRegisterUnitInRange(trig, area, 140, null[/ljass]

And then add a condition with the function "NullAreaSlide" instead, and it should work ;)
 

BlueMirage

Trust, but doubt.
Reaction score
39
Ah, pity. I hoped that I wouldn't need to attach a triggercondition as well. So much stuff to keep track of D:

Well, thanks for the answer. +rep
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top