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.
 
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.
 
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.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top