Giving an order crashes the game

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
I think this might be the cause of the crash. Consider this example:

JASS:
function crash_the_game takes nothing returns nothing
    local trigger t = GetTriggeringTrigger()

    // this line doesn't order the unit anying so it's "safe"
    call DisplayTextToPlayer(Player(0), 0.0, 0.0, OrderId2String(GetIssuedOrderId()))

    // this line is causing an infinite loop resulting in a crash
    // the Blood Mage(gg_unit_Hblm_0001) is ordered to stop but after that
    // he is ordered to stop again and again... <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue    :p" loading="lazy" data-shortname=":p" />
    call IssueImmediateOrder(gg_unit_Hblm_0001,&quot;stop&quot;)

    call DisableTrigger(t)
    call TriggerClearActions(t)
    call DestroyTrigger(t)
endfunction

function crash takes nothing returns nothing
    local trigger t

    set t = CreateTrigger()
    call TriggerRegisterUnitEvent(t, gg_unit_Hblm_0001, EVENT_UNIT_ISSUED_TARGET_ORDER)
    call TriggerRegisterUnitEvent(t, gg_unit_Hblm_0001, EVENT_UNIT_ISSUED_POINT_ORDER)
    call TriggerRegisterUnitEvent(t, gg_unit_Hblm_0001, EVENT_UNIT_ISSUED_ORDER)
    call TriggerAddAction(t, function crash_the_game)

    set t = null
endfunction

//===========================================================================
function InitTrig_test takes nothing returns nothing
    local trigger t = CreateTrigger()

    // Press escape and order the unit to move for example to &quot;exit&quot; the game with a crash
    call TriggerRegisterPlayerEventEndCinematic(t, Player(0))
    call TriggerAddAction(t, function crash)
endfunction


I guess in your case the other ability Clock is ordering the unit to cast/use invisibility:
[ljass]call DummySpell(u, 'A00S', "invisibility", 1)[/ljass]

Resulting in a crash (I think ... : P).
 

saw792

Is known to say things. That is all.
Reaction score
280
Ignore these people... Comment out the three lines below [ljass]if tim == null then[/ljass] in the timer/trigger callback. If it still crashes, then it's most likely related to some sort of trigger problem (you should be using conditions as has been said already), otherwise you can easily find the problem line...

EDIT: Also comment out everything outside the if conditions, since you will run into problems with uninitialized variables otherwise
 
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