Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Crashing trigger

Discussion in 'World Editor Help Zone' started by micca, Oct 21, 2020.

  1. micca

    micca

    Joined:
    Dec 31, 2016
    Messages:
    276
    Resources:
    0
    Resources:
    0
    Hi, I am quite lost in here. The trigger crashes the game and I cant find a reason why. The reason seems to lie in this condition according to my testing of the function. But I don't understand what's wrong with it.
    • MinY Less than ((Y of SpawnPoint) - 128.00)

    Can you guys give me a hint, please?
    MinY, MaxX etc. are border coordinates of a region.
    Thank you for any help.
    • Rock Generation
      • Events
      • Conditions
      • Actions
        • Set VariableSet SpawnPoint = (Point((X of SpawnPoint2), (Y of SpawnPoint2)))
        • Custom script: call RemoveLocation(udg_SpawnPoint2)
        • Unit - Create 1 SpawnUnit for Neutral Passive at SpawnPoint facing Default building facing degrees
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • MaxX Greater than ((X of SpawnPoint) + 128.00)
          • Then - Actions
            • Set VariableSet SpawnPoint2 = (Point(((X of SpawnPoint) + 128.00), (Y of SpawnPoint)))
            • Custom script: call RemoveLocation(udg_SpawnPoint)
            • Trigger - Run (This trigger) (checking conditions)
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • MinY Less than ((Y of SpawnPoint) - 128.00)
              • Then - Actions
                • Set VariableSet SpawnPoint2 = (Point(MinX, ((Y of SpawnPoint) - 128.00)))
                • Custom script: call RemoveLocation(udg_SpawnPoint)
                • Trigger - Run (This trigger) (checking conditions)
              • Else - Actions
     
  2. biridius

    biridius

    Joined:
    Apr 3, 2018
    Messages:
    197
    Resources:
    4
    Maps:
    4
    Resources:
    4
    Your trigger seems to be running itself repeatedly. If this is done too much, it will crash the game, as every run of the trigger creates a code thread which are limited in number. If it was just done in a single thread, it would run out of operation limit and just not work any further without crashing.

    It probably is fine when doing just one row, but once it starts creating multiple rows (the Y condition) the game crashes.

    Try separating the load using a timer, creating a single row with every tick.
     
    Last edited: Oct 21, 2020
  3. micca

    micca

    Joined:
    Dec 31, 2016
    Messages:
    276
    Resources:
    0
    Resources:
    0
    oh, so it's the limitations of the editor? I will try to slow down the process using a timer then
     
  4. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,378
    Resources:
    0
    Resources:
    0
    I believe you can use "Run this trigger (Ignoring conditions)", I'm pretty sure it only ignores the Conditions literally found in the Conditions block and not in your Actions. I think this is faster even without any conditions?

    Also, it may have to do with the unit creation as well, I'd disable that if you still crash after trying biridius' suggestion.
     
    Last edited: Oct 21, 2020
  5. micca

    micca

    Joined:
    Dec 31, 2016
    Messages:
    276
    Resources:
    0
    Resources:
    0
    It works fine with timers.