HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

i was wondering if this event leaks

10-05-2006, 06:09 PM#1
grupoapunte
i was wondering if this event leaks? do i have to destroy GetOrderPointLoc()?

Collapse JASS:
function Trig_AntiPatrol_Conditions takes nothing returns boolean
    if (OrderId2StringBJ(GetIssuedOrderIdBJ()) == "attack") then
        return false
    endif
    return true
endfunction

function Trig_AntiPatrol_Actions takes nothing returns nothing
    local location l = GetOrderPointLoc()

    call IssuePointOrderLocBJ(GetTriggerUnit(), "move", l)
    call RemoveLocation(l)
    set l = null
endfunction

//===========================================================================
function InitTrig_AntiPatrol takes nothing returns nothing
    set gg_trg_AntiPatrol = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_AntiPatrol, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
    call TriggerAddCondition(gg_trg_AntiPatrol, Condition(function Trig_AntiPatrol_Conditions))
    call TriggerAddAction(gg_trg_AntiPatrol, function Trig_AntiPatrol_Actions)
endfunction


10-05-2006, 06:13 PM#2
Captain Griffen
You do have to destroy it, or just use co-ordinates.

You also use BJs pointlessly.
10-05-2006, 06:18 PM#3
grupoapunte
LOL, well yeah my mistake i edited in in WE not in jass craft so i didnt want to make a mistake

this would be the good one:

Collapse JASS:
function Trig_AntiPatrol_Conditions takes nothing returns boolean
    if (OrderId2String(GetIssuedOrderId()) == "attack") then
        return false
    endif
    return true
endfunction

function Trig_AntiPatrol_Actions takes nothing returns nothing
    local location l = GetOrderPointLoc()

    call IssuePointOrderLoc(GetTriggerUnit(), "move", l)
    call RemoveLocation(l)
    set l = null
endfunction

//===========================================================================
function InitTrig_AntiPatrol takes nothing returns nothing
    set gg_trg_AntiPatrol = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_AntiPatrol, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
    call TriggerAddCondition(gg_trg_AntiPatrol, Condition(function Trig_AntiPatrol_Conditions))
    call TriggerAddAction(gg_trg_AntiPatrol, function Trig_AntiPatrol_Actions)
endfunction


10-05-2006, 06:22 PM#4
Captain Griffen
return not OrderId2String(GetIssuedOrderId()) == "attack"

All you need.
10-05-2006, 08:06 PM#5
Rising_Dusk
return OrderId2String(GetIssuedOrderId()) != "attack"
Come now, Griffy. :P