• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Crash] Strange crash

Status
Not open for further replies.
Level 7
Joined
Aug 11, 2010
Messages
269
So basically I've got three separated regions of the map; with one being an interior and two being an exterior. Here's my triggers:

  • SYS Castle Force Movement Inside
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (AreaMainPlayable01 <gen> contains (Triggering unit)) Equal to True
          • (AreaMainPlayable02 <gen> contains (Triggering unit)) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (AreaSalemCastle <gen> contains (Target point of issued order)) Equal to True
          • (AreaSalemCastle <gen> contains (Target unit of issued order)) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(move))
        • Then - Actions
          • Unit - Order (Triggering unit) to Move To (Center of TeleportSalemToCastle <gen>)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(attack))
            • Then - Actions
              • Unit - Order (Triggering unit) to Attack-Move To (Center of TeleportSalemToCastle <gen>)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Issued order) Equal to (Order(smart))
                • Then - Actions
                  • Unit - Order (Triggering unit) to Right-Click (Center of TeleportSalemToCastle <gen>)
                • Else - Actions
                  • Unit - Order (Triggering unit) to Attack-Move To (Center of TeleportSalemToCastle <gen>)
  • SYS Castle Force Movement Outside
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (AreaSalemCastle <gen> contains (Triggering unit)) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (AreaMainPlayable01 <gen> contains (Target point of issued order)) Equal to True
          • (AreaMainPlayable02 <gen> contains (Target point of issued order)) Equal to True
          • (AreaMainPlayable01 <gen> contains (Target unit of issued order)) Equal to True
          • (AreaMainPlayable02 <gen> contains (Target unit of issued order)) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(move))
        • Then - Actions
          • Unit - Order (Triggering unit) to Move To (Center of TeleportCastleToSalem <gen>)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(attack))
            • Then - Actions
              • Unit - Order (Triggering unit) to Attack-Move To (Center of TeleportCastleToSalem <gen>)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Issued order) Equal to (Order(smart))
                • Then - Actions
                  • Unit - Order (Triggering unit) to Right-Click (Center of TeleportCastleToSalem <gen>)
                • Else - Actions
                  • Unit - Order (Triggering unit) to Attack-Move To (Center of TeleportCastleToSalem <gen>)
whenever the unit arrives inside the castle and attempts to move around the game immediately crashes. This doesn't happen while in the exterior regions. Any ideas on how to fix this problematic issue?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
I am guessing an infinite loop. Order actions will instantly trigger issued order events. If the response to an order event is to issue an order then an infinite loop can occur.

The order issued can fire another issued order event to produce another order which fires the issue order event which...

In response to the order, try turning both triggers off, then issuing the order, then turning both triggers back on. This will prevent the issue order action from causing the issued order event from firing.
 
Level 7
Joined
Aug 11, 2010
Messages
269
I am guessing an infinite loop. Order actions will instantly trigger issued order events. If the response to an order event is to issue an order then an infinite loop can occur.

The order issued can fire another issued order event to produce another order which fires the issue order event which...

In response to the order, try turning both triggers off, then issuing the order, then turning both triggers back on. This will prevent the issue order action from causing the issued order event from firing.

Awesome, it doesn't crash anymore... However, I'm still having issues with the trigger.

When the guy enters the castle and I issue a movement or attack order command further into the castle; instead of heading deeper into the castle he instead wants to exit it. I'm baffled at why this is happening since I checked the trigger and I don't see anything out of the ordinary. The regions aren't lapping, neither. Any insight would be helpful.
 
Level 7
Joined
Aug 11, 2010
Messages
269
Could you explain what the triggers are meant to do? Is it meant to force movement to a teleport rect to get in/out of an area of your map? If so then why not use waygates which are automatically built into the path finder?

You're correct to assume that the functionality of what I'd like to do is like a waygate. However; unfortunately due to circumstances (I've tried your method already) it won't work for what I'm needing it to do, even if it's practically the same.

That's why I'm going to need to figure out what's wrong with my trigger; it's a major quality of life feature that'll definitely make the map I'm working on have a certain layer of polish... If I can just get it working, haha.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
(AreaMainPlayable01 <gen> contains (Target unit of issued order)) Equal to True
(AreaMainPlayable02 <gen> contains (Target unit of issued order)) Equal to True
In the case of point orders the "Target unit of issued order" will evaluate "null" (GUI "no unit"). It is possible that testing if null is inside a rect always returns true, in which case the trigger will always fire for point orders made inside the castle (what you report is happening).

To fix you only run those tests if "Target unit of issued order" is not equal to "no unit".

The logic would be somewhat like...
source inside castle and (target point outside castle or (target is a unit and target outside castle))

Do be aware you are leaking a lot of locations for every point order that gets issued during a session of your map. This can lead to degraded performance over time. I would recommend reading up about leaks and fixing them as soon as the trigger is working as intended to prevent performance problems at a later time.
 
Level 7
Joined
Aug 11, 2010
Messages
269
In the case of point orders the "Target unit of issued order" will evaluate "null" (GUI "no unit"). It is possible that testing if null is inside a rect always returns true, in which case the trigger will always fire for point orders made inside the castle (what you report is happening).

To fix you only run those tests if "Target unit of issued order" is not equal to "no unit".

The logic would be somewhat like...
source inside castle and (target point outside castle or (target is a unit and target outside castle))

Do be aware you are leaking a lot of locations for every point order that gets issued during a session of your map. This can lead to degraded performance over time. I would recommend reading up about leaks and fixing them as soon as the trigger is working as intended to prevent performance problems at a later time.

Well at least we've made a little progress. The unit can now move around the castle freely; however, the main problem now is when the unit attempts to attack any units within the area it'll attempt to move outside of the area. I'm not quite sure why.

I do plan to put leak removing events in that trigger; I just haven't gotten around to it just yet. Gonna wait until I get the trigger working first.

  • SYS Castle Force Movement Outside
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (AreaSalemCastle <gen> contains (Triggering unit)) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (AreaMainPlayable01 <gen> contains (Target point of issued order)) Equal to True
          • (AreaMainPlayable02 <gen> contains (Target point of issued order)) Equal to True
          • And - All (Conditions) are true
            • Conditions
              • (Target unit of issued order) Not equal to No unit
              • (AreaSalemCastle <gen> contains (Target unit of issued order)) Equal to False
              • Or - Any (Conditions) are true
                • Conditions
                  • (AreaMainPlayable01 <gen> contains (Target unit of issued order)) Equal to True
                  • (AreaMainPlayable02 <gen> contains (Target unit of issued order)) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off SYS Castle Force Movement Inside <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Issued order) Equal to (Order(move))
        • Then - Actions
          • Unit - Order (Triggering unit) to Move To (Center of TeleportCastleToSalem <gen>)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Issued order) Equal to (Order(attack))
            • Then - Actions
              • Unit - Order (Triggering unit) to Attack-Move To (Center of TeleportCastleToSalem <gen>)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Issued order) Equal to (Order(smart))
                • Then - Actions
                  • Unit - Order (Triggering unit) to Right-Click (Center of TeleportCastleToSalem <gen>)
                • Else - Actions
                  • Unit - Order (Triggering unit) to Attack-Move To (Center of TeleportCastleToSalem <gen>)
      • Trigger - Turn on (This trigger)
      • Trigger - Turn on SYS Castle Force Movement Inside <gen>
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
The same problem as before might be happening with the following...
(AreaMainPlayable01 <gen> contains (Target point of issued order)) Equal to True
(AreaMainPlayable02 <gen> contains (Target point of issued order)) Equal to True
A null location might always or never be contained inside a rect. If GUI supports it you could check it against null (no point?) similar to what you did with the unit.

Instead of a big mess of conditions to support both types of order, it might be a good idea to break this trigger apart. Since the actions are common you put them in a no event trigger. You then create 2 triggers, one for each order type and fill in the conditions as appropriate. Both these triggers then run the action trigger with the run trigger action.

Instead of turning off the triggers (more messy as more triggers) you could use a lock to only allow one instance of the actions to be running at any given time. This works by checking if a boolean is false (its initial value) and if so then sets it true, does the actions and finally sets it false again. If the boolean is true then the actions are skipped, hence allowing only one instance of the actions to be running at any time. It could break if the thread crashes in the middle of the action block so one should be careful to avoid that from happening.
 
Level 7
Joined
Aug 11, 2010
Messages
269
The same problem as before might be happening with the following...

A null location might always or never be contained inside a rect. If GUI supports it you could check it against null (no point?) similar to what you did with the unit.

Instead of a big mess of conditions to support both types of order, it might be a good idea to break this trigger apart. Since the actions are common you put them in a no event trigger. You then create 2 triggers, one for each order type and fill in the conditions as appropriate. Both these triggers then run the action trigger with the run trigger action.

Instead of turning off the triggers (more messy as more triggers) you could use a lock to only allow one instance of the actions to be running at any given time. This works by checking if a boolean is false (its initial value) and if so then sets it true, does the actions and finally sets it false again. If the boolean is true then the actions are skipped, hence allowing only one instance of the actions to be running at any time. It could break if the thread crashes in the middle of the action block so one should be careful to avoid that from happening.

Works perfectly. Thanks a bundle for your time and patience, I've now got leak cleaned region-to-points and the variable enable/disable. Much more efficient. All I needed to do was split the two triggers into four. I guess I was just trying to be efficient but in my struggle to become 'efficient' and only have two triggers I ended up becoming significantly inefficient, funny how that works!

Anyway, +rep! My problems are fixed.
 
Status
Not open for further replies.
Top