• 🏆 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!

[Trigger] Trigger doesn't cause unit to stop. It should.

Status
Not open for further replies.
Level 1
Joined
Jul 8, 2015
Messages
4
Hey there!
I'm starting with some turn-based project. The first thing I want to make is making my movement, based on teleportation(Later I will make it normal movement, but for testing I don't need it). My problem is, when I order unit to stop(in trigger), it doesn't stop. Hold Position doesn't work aswell. Any solutions? Where to place the stop order action?

  • BlinkMove
  • Events
    • Unit is ordered targeting a point
  • Conditions
    • Or - Multiple conditions
      • Issued order equal to smart
      • Issued order equal to move
      • Issued order equal to patrol
  • Actions
    • Set TempPoint1 = position of unit
    • Set TempPoint2 = event response - target point of issued order
    • If (real - math - distance between TempPoint1 and TempPoint2 less than or equal to 512)
    • Then - Actions
      • Unit - Set mana of ordered unit to (mana of ordered unit - 1)
      • Unit - move unit to TempPoint2
      • Custom script: call RemoveLocation(udg_TempPoint1)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • If Mana of triggering unit equal to 0
        • Then Set (Movecounter of owner) = (Movecounter of owner - 1)
        • Else do nothing
    • Else - Actions
      • Set TempPoint3 = point with polar offset - TempPoint1 offset by 512 towards angel between TempPoint1 and TempPoint2
      • Unit - move unit to TempPoint3
      • Custom script: call RemoveLocation(udg_TempPoint3)
      • If Mana of triggering unit equal to 0
        • Then Set (Movecounter of owner) = (Movecounter of owner - 1)
        • Else do nothing
 
Last edited:
Level 1
Joined
Jul 8, 2015
Messages
4
Technically, this trigger was written by someone else, I just modified it for my cause. And yes, I written it there. It's not a big work :v Will copy next time. Anyways, you know how to stop the freaking unit? Giving orders doesn't work, setting 0 speed disables whole thing.
 
Level 1
Joined
Jul 8, 2015
Messages
4
Okay, found the problem.
The trigger is executed in a moment before the order is given, so it cannot be stopped. Just added "wait 0.01 seconds" as a first action, and now the game have the time to execute the order.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Then the location is null, it has been removed.

TempPoint2 is null to be exact.
Try disabling and re-enabling the trigger before and after pausing the unit:

Disable (this trigger)
Pause (unit)
Order (unit) to stop
Unpause (unit)
Enable (this trigger)

EDIT:
I just tested what happens when you use this method... and it is quite nice actually.
What happens when you pause the unit is that the unit is issued to "" towards (0, 0).
This is what I will call the BLOCK order.
This order is pretty much the same as stop, however it is targeted to a point and it doesnt fire all triggers that run on stop orders.
When I unpause the unit, the unit will have no orders any more (because all orders are blocked).
So the unit will retrieve the last given order and will try to use that... if it cannot do that order then it just stops.

However that means that the order is re-given, making the trigger run again, again, again, again and again.
This is not what you want so you give a new order after you have given the BLOCK order (pausing unit).
So after pausing the unit, you give the order to stop so it will stop when it is unpaused.

This will then work properly... you think?
No, there is one problem where you might be referring to the order.
The issued order is replaced by the new order given to the unit.
This means that your "Issued order" is now "stop" and that the "target location of issued order" is (0, 0).
If you have any reference to either of them (or whatever other things you want to refer to) after the pause and stop order, you have to place that above the pause and stop order.

If it still doesnt work, then upload the trigger.
I dont really know if this was easy to understand :/
 
Last edited:
Status
Not open for further replies.
Top