Fatal from order, and unable to set point

Mikazuki

New Member
Reaction score
0
1.
I've got a trigger that forces a unit to stop whenever it's given any order and it has a specific buff on it. For whatever reason though, it crashes WC3 when you just right click. Here's the code;
JASS:
function Trig_SPfrozen_Conditions takes nothing returns boolean
    return((GetIssuedOrderId()!=852090)and(GetIssuedOrderId()!=852091)and(GetIssuedOrderId()!=852529)) //except magic shell and counterspell
endfunction

function Trig_SPfrozen_Actions takes nothing returns nothing
    if ((GetUnitAbilityLevel(GetTriggerUnit(),'B006') > 0)or(GetUnitAbilityLevel(GetTriggerUnit(),'B007') > 0)) then
        call IssueImmediateOrder(GetTriggerUnit(),"stop") //stop
    endif
endfunction

function InitTrig_SPfrozen takes nothing returns nothing
    set gg_trg_SPfrozen = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_SPfrozen, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_SPfrozen, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_SPfrozen, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddCondition( gg_trg_SPfrozen, Condition( function Trig_SPfrozen_Conditions ) )
    call TriggerAddAction( gg_trg_SPfrozen, function Trig_SPfrozen_Actions )
endfunction



2.
The trigger below sets four points to random points on the map, unless the random points picked are in any of four specific regions. The coordinates are being randomised properly, but the global array variable () for those four points aren't being set to the randomised coordinates.
JASS:
function Trig_UNITSPAWNffarandoms_Actions takes nothing returns nothing
    local integer i = 1
    local real x
    local real y
    local boolean b = false
    loop
    exitwhen i == 4
        loop
        exitwhen b == true
            set x = GetRandomReal(-2650.,2650.)
            set y = GetRandomReal(-3050.,2600.)
            if ((RectContainsCoords(gg_rct_Region_000,x,y)==false)and(RectContainsCoords(gg_rct_Region_001,x,y)==false)and(RectContainsCoords(gg_rct_Region_002,x,y)==false)and(RectContainsCoords(gg_rct_Region_003,x,y)==false)) then
                set b = true
            endif
        endloop
        set udg_GAMEINIT_spawnpoint<i> = Location(x,y)
        set i = i+1
    endloop
endfunction

function InitTrig_UNITSPAWNffarandoms takes nothing returns nothing
    set gg_trg_UNITSPAWNffarandoms = CreateTrigger(  )
    call DisableTrigger( gg_trg_UNITSPAWNffarandoms )
    call TriggerRegisterTimerEventPeriodic( gg_trg_UNITSPAWNffarandoms, 0.50 )
    call TriggerAddAction( gg_trg_UNITSPAWNffarandoms, function Trig_UNITSPAWNffarandoms_Actions )
endfunction</i>

(yes, this trigger does get enabled)



I've done quite a bit of experimenting, and I really can't find the problem in my code. Could anyone shed some light on this?
Thanks in advance.
 

Embrace_It

New Member
Reaction score
9
1.

First, try making spaces between your "and"'s and "or"'s.

I dont have WC3 in front of me right now, but you should try to locate the problem first. Try commenting the conditions out and see if it works, then try the actions (maybe only try to remove the buff check).

2.

I'm assuming the global variable is created somewhere else. For starters, the first element of an array is 0, not 1, therefore the last element of an array MyArray[4] (which has 4 elements) is 3. Right now, you are skipping the first element, by starting on 1.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Infinity loop!
Add the GetCurrentOrder != String2OrderId("stop")(I don't know the order id of "stop") in condition.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top