• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

Trigger fires when it shouldn't

Not open for further replies.
Level 14
Aug 30, 2004
Concept: turret gun in a capital ship. When in the ship, right-clicking in any direction will cause a laser to fire in that direction.

  • Command Ship Turret
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Command Ship Gunner
      • cooldownTurret[(Player number of (Owner of (Triggering unit)))] Equal to False
      • ((Issued order) Equal to (Order(move))) or ((Issued order) Equal to (Order(smart)))
    • Actions
      • Game - Display to (All players) the text: (String((Issued order)))
      • Set tempUnit = (Triggering unit)
      • Set tempInteger = (Player number of (Owner of tempUnit))
      • -------- - --------
      • -------- ----fire --------
      • -------- - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of tempUnit) Greater than or equal to 3.00
        • Then - Actions
          • Set tempPoint = (Target point of issued order)
          • Set x = (X of tempPoint)
          • Set y = (Y of tempPoint)
          • Custom script: call RemoveLocation (udg_tempPoint)
          • Custom script: set udg_CreateX = GetUnitX(udg_RepublicCommandShip)
          • Custom script: set udg_CreateY = GetUnitY(udg_RepublicCommandShip)
          • Custom script: call MoveLocation(udg_LocationMove1, udg_CreateX, udg_CreateY)
          • Custom script: call MoveLocation(udg_LocationMove2, udg_x, udg_y)
          • Unit - Set mana of tempUnit to ((Mana of tempUnit) - 3.00)
          • Set CreationShipType = Laser Red
          • Set CreationPlayerOwner = (Owner of tempUnit)
          • Set CreationUnitOwner = tempUnit
          • Set CreationAngle = (Angle from LocationMove1 to LocationMove2)
          • Trigger - Run Create Laser Cannon <gen> (ignoring conditions)
          • Set cooldownTurret[tempInteger] = True
          • Wait 0.20 game-time seconds
          • Set cooldownTurret[(Player number of (Owner of (Triggering unit)))] = False
        • Else - Actions
          • Game - Display to PlayerGroup[tempInteger] the text: |c00ffff66No energy...
You can ignore the actions for now; the first action indicates that the trigger is firing correctly when the player right-clicks. The problem is it also fires when the same unit casts the Summon Bear ability!

There are 3 conditions, the third of which should stop the trigger from firing when the bear is summoned, but it's not.

1. Unit-type comparison. The summon bear ability and the right-click will both meet this condition.

2. cooldownTurret = false. This is a timer so you can only cast 5 times a second. It should work for both the summon bear ability and the right-click.

3. Issued order = move or smart. This is the condition that should rule out the summon bear ability! The order to summon a bear is: summongrizzly, but for some reason this trigger is still firing! The bear summoned ability is changed so that there is no summoned bear (number of summoned units = zero), so it's not the case that a bear is being summoned and ordered to move... The issued order, according to the first action, is "smart".

Is there another condition I could put in to distinguish the summon bear ability from the right-click?

Does anyone have any idea why this is happening.

p.s. This trigger also fires when I cast an ability based on Item Mana Regain, but not when I cast mirror image or divine shield.
Level 37
Mar 6, 2006
The problem is that the unit remembers the move order it was given before the transformation.

If a unit is moving while ordered to transform, it will be ordered to move to the targeted location after the transformation is over.

You can try to avoid it with this trigger:
  • Untitled Trigger 076
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(bearform))
          • (Issued order) Equal to (Order(unbearform))
    • Actions
      • Wait 0.00 seconds
      • Set point = (Position of (Triggering unit))
      • Unit - Move (Triggering unit) instantly to point
      • Custom script: call RemoveLocation(udg_point)
Also note that in your trigger, you should not use wait. It's highly inaccurate. Use a countdown timer instead.

In single player using a 0.20 wait, you might get values between 0.275 and 0.375. Different each time, In multilayer it could be even worse. That's not really fair for players if their wait times are random.
Not open for further replies.