• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Order Dependant Trigger

Status
Not open for further replies.
Level 2
Joined
Jun 11, 2013
Messages
9
Hello. I'd like a trigger to detect the many orders a specific unit is given.
Then, "moving", "attacking" and "holding position" may trigger some effects.

Note that stop and holdposition orders are different and smart (on ground) is the same action as smart (on an enemy or allied unit). So the Issued Order is not returning it as well.

Also when the unit uses metamorphosis order, the trigger stops working. Some one can help me?

Triggers Below:

TRIGGER 1:
  • Unit - A unit Learns a skill
  • (Learned Hero Skill) Equal to Space Suit
  • Set SuitOwner = (Learning Hero)
  • Unit - Set level of Attack Speed Suit for SuitOwner to (Level of Space Suit for SuitOwner)
  • Unit - Set level of Move Speed Suit for SuitOwner to (Level of Space Suit for SuitOwner)
  • Unit - Set level of Life Regen Suit for SuitOwner to (Level of Space Suit for SuitOwner)
  • Unit - Set level of Mana Regen Suit for SuitOwner to (Level of Space Suit for SuitOwner)
  • Countdown Timer - Start PointA as a Repeating timer that will expire in 0.10 seconds
  • Countdown Timer - Start AlternateTimer as a One-shot timer that will expire in 0.05 seconds
  • Countdown Timer - Start CheckingTimer as a Repeating timer that will expire in 0.20 seconds
TRIGGER 2:
  • Time - AlternateTimer expires
  • Countdown Timer - Start PointB as a Repeating timer that will expire in 0.10 seconds
TRIGGER 3:
  • Time - PointA expires
  • Set A = (Position of SuitOwner)
TRIGGER 4:
  • Time - PointB expires
  • Set B = (Position of SuitOwner)
TRIGGER 5:
  • Unit - A unit Is issued an order with no target
  • Unit - A unit Is issued an order targeting a point
  • Unit - A unit Is issued an order targeting an object
  • (Triggering unit) Equal to SuitOwner
  • (Issued order) Not equal to SuitOwnerOrder
  • Set SuitOwnerOrder = (Issued order)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • SuitOwnerOrder Equal to (Order(stop))
          • SuitOwnerOrder Equal to (Order(holdposition))
    • Then - Actions
      • Trigger - Run Apply Regen <gen> (checking conditions)
    • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SuitOwnerOrder Equal to (Order(attack))
    • Then - Actions
      • Trigger - Run Apply Attack <gen> (checking conditions)
    • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SuitOwnerOrder Equal to (Order(move))
    • Then - Actions
      • Trigger - Run Apply Move <gen> (checking conditions)
    • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SuitOwnerOrder Equal to (Order(smart))
    • Then - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Target unit of issued order) Equal to No unit
        • Then - Actions
          • Trigger - Run Apply Move <gen> (checking conditions)
          • Set SuitOwnerOrder = (Order(move))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of SuitOwner) is an enemy of (Owner of (Target unit of issued order))) Equal to True
            • Then - Actions
              • Trigger - Run Apply Attack <gen> (checking conditions)
              • Set SuitOwnerOrder = (Order(attack))
            • Else - Actions
              • Trigger - Run Apply Move <gen> (checking conditions)
              • Set SuitOwnerOrder = (Order(move))
    • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • SuitOwnerOrder Equal to (Order(patrol))
    • Then - Actions
      • Unit - Order SuitOwner to Stop
    • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(flamestrike))
          • (Issued order) Equal to (Order(metamorphosis))
          • (Issued order) Equal to (Order(ward))
          • (Issued order) Equal to (Order(tranquility))
    • Then - Actions
      • Player - Disable Move Speed Suit for (Owner of SuitOwner)
      • Player - Disable Attack Speed Suit for (Owner of SuitOwner)
      • Player - Disable Mana Regen Suit for (Owner of SuitOwner)
      • Player - Disable Life Regen Suit for (Owner of SuitOwner)
      • Set SuitOwnerOrder = (Issued order)
    • Else - Actions
APPLY REGEN TRIGGER:
  • Countdown Timer - Start ThreeSecondTimer[1] as a One-shot timer that will expire in 3.00 seconds
  • Countdown Timer - Pause ThreeSecondTimer[2]
  • Countdown Timer - Pause ThreeSecondTimer[3]
APPLY MOVE TRIGGER:
  • Countdown Timer - Start ThreeSecondTimer[2] as a One-shot timer that will expire in 3.00 seconds
  • Countdown Timer - Pause ThreeSecondTimer[1]
  • Countdown Timer - Pause ThreeSecondTimer[3]
  • Player - Disable Mana Regen Suit for (Owner of SuitOwner)
  • Player - Disable Life Regen Suit for (Owner of SuitOwner)
  • Player - Disable Attack Speed Suit for (Owner of SuitOwner)
APPLY ATTACK TRIGGER:
  • Countdown Timer - Start ThreeSecondTimer[3] as a One-shot timer that will expire in 3.00 seconds
  • Countdown Timer - Pause ThreeSecondTimer[2]
  • Countdown Timer - Pause ThreeSecondTimer[1]
  • Player - Disable Mana Regen Suit for (Owner of SuitOwner)
  • Player - Disable Life Regen Suit for (Owner of SuitOwner)
  • Player - Disable Move Speed Suit for (Owner of SuitOwner)
TRIGGER 6:
  • Time - ThreeSecondTimer[1] expires
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (In-game time of day) Greater than or equal to 6.00
          • (In-game time of day) Less than 18.00
    • Then - Actions
      • Player - Enable Mana Regen Suit for (Owner of SuitOwner)
      • Player - Enable Life Regen Suit for (Owner of SuitOwner)
    • Else - Actions
TRIGGER 7:
  • Time - ThreeSecondTimer[2] expires
  • Player - Enable Move Speed Suit for (Owner of SuitOwner)
TRIGGER 8:
  • Time - ThreeSecondTimer[3] expires
  • Player - Enable Attack Speed Suit for (Owner of SuitOwner)
 
Last edited:
Level 2
Joined
Jun 11, 2013
Messages
9
Actually I could use the A and B distance to check if he's holding ground or moving. But the attack check part is confused. I can't trigger that and also do the rest work. Also using this trigger above, it dont work if the unit cast metamorphosis. (both units from metamorphosis are the same, but the second one can fly). Don't know why it is not working.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Does the unit that your hero morphs into also have those custom abilities? Metamorphosis doesn't save abilities, it only saves their levels, so if the unit your hero morphs into doesn't have them, then your trigger won't work.

I use these orders in my trigger to prevent moving:
  • Or - Any (Conditions) are true
    • Conditions
      • (Issued order) Equal to (Order(smart))
      • (Issued order) Equal to (Order(move))
      • (Issued order) Equal to (Order(patrol))
      • (Issued order) Equal to (Order(follow))
      • (Issued order) Equal to (Order(holdposition))
Then you have attack order, attack ground order and spell orders (these depends on what spell you use)

You also don't need so have 3 timers to save A and B locations. You could do it like I did in the hidden tab:
  • Learn Suit
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Space Suit
    • Actions
      • Set SuitOwner = (Learning Hero)
      • Unit - Set level of mp regen for SuitOwner to (Level of Space Suit for SuitOwner)
      • Unit - Set level of hp regen for SuitOwner to (Level of Space Suit for SuitOwner)
      • Unit - Set level of att speed for SuitOwner to (Level of Space Suit for SuitOwner)
      • Unit - Set level of move speed for SuitOwner to (Level of Space Suit for SuitOwner)
      • -------- -------------------------------------------- --------
      • -------- removes location to prevent leak --------
      • Custom script: call RemoveLocation(udg_current_pos)
      • Custom script: call RemoveLocation(udg_last_pos)
      • -------- -------------------------------------------- --------
      • -------- saves current position of your unit --------
      • Set current_pos = (Position of SuitOwner)
      • Trigger - Turn on LoopTrigger <gen>
This is your first trigger, but I got rid of your countdown timers and saved current location of your SuitOwner as "current_pos" and then switch Loop trigger on.

Loop trigger is here:
  • LoopTrigger
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • -------- removes location to prevent memory leak --------
      • Custom script: call RemoveLocation(udg_last_pos)
      • -------- -------------------------------------------- --------
      • -------- the location that was saved as current location was saved 0.1 second before; it is now saved as "last position" --------
      • Set last_pos = current_pos
      • -------- -------------------------------------------- --------
      • -------- we now find out the real current positions of your unit --------
      • Set current_pos = (Position of s)
      • -------- -------------------------------------------- --------
      • -------- -------------------------------------------- --------
      • -------- if distance between last_pos and current_pos is 0, then unit did not move --------
      • -------- or --------
      • -------- if x and y coordinates of last_pos and x and y of current_pos are same, the unit did not move --------
In this trigger you always set "current_pos" as "last_pos" because "current_pos" was saved 0.1 seconds before; and then you saved the real current position into "current_pos".

You can later in other triggers check their distance or x and y coordinates to find out if they match and if they do, your SuitOwner did not move.


You could do similar thing as I did in the hidden tab with your other timers, using booleans.
 
Level 2
Joined
Jun 11, 2013
Messages
9
Yes, i used to do that too. But the real problem is that im having trouble to check if the unit is attacking. Moving or Standing position is ok. The problem is when the unit starts to attack while standing position or moving.. and even if moving, when it does the attack, it stops for a while and then the regen buff start to being applied, while the others are removed... this was being too complicated and I decided to just set as move speed and regen buffs. removed the attack part. also transformed the abilities into item abilities and made the trigger ADD and REMOVE the ability, instead of enabling/disabling them..
Does the unit that your hero morphs into also have those custom abilities? Metamorphosis doesn't save abilities, it only saves their levels, so if the unit your hero morphs into doesn't have them, then your trigger won't work.

Yes, the alternate unit is a copy from the original one, but with flying movement and heigh.
 
Level 2
Joined
Jun 11, 2013
Messages
9
Well. Actually the taste of the ability is to give passive bonuses according to the hero behavior.
It may give attack speed if the hero IS attacking. This means that his current order is Attack or Smart with an enemy as target.
Move speed if the hero ISNT attacking and is moving. This means his current order is move or smart with target unit of issued order being equal to no unit.
Regeneration if the hero is holding position. This means that he needs to be on the SAME place and cannot move.

In fact the problem lies on the automatic units behavior.
I.E. when you press STOP, the unit will stop moving. But then, if any enemy unit comes within acquisition range, the stopped unit will react and start to attack this unit... and its current order will still be STOP.

The same happen to the attacks. Many times the attacking unit will have to be at the same place (even for a milisecond) to fire the attack.. and this cannot trigger the regeneration.

Also, there's another little problem: The passive bonuses start after 3 seconds delay (a timer is started at the behavior detection and the buff is applied when the timer expires). But if the trigger fires every 0.1 second, for example, this timer will be refreshed forever and will never apply the buff.. (no one ever issue an order and then let the unit do what he ordered). So it needs to have some kind of blocking with a boolean, for example, to prevent this happening.

AND, at last, the metamorphosis issue. I don't know what's happening. The alternate unit is really the same as the original one, same targeted as, same classifications, etc. The only difference is that the alternate one has flying heigh (for jumping purposes). But this shouldn't interfere in the functionality of the rest of the things. And yes, both has the same skills (hero ones and unit ones).

Anyone??


Ps.: Please forgive my poor English. This is not my first language. Don't mind my mistakes. Thanks.
 
Level 7
Joined
Jan 22, 2013
Messages
293
Hello. I'd like a trigger to detect the many orders a specific unit is given.

Well An easy way to connect these orders to other events is by using numbers to turn on other events.


You are trying to connect orders to events, you need to constantly keep checking a hero for his current orders. when one comes around change a Real to a number.

There is an event that allows you to run triggers when a particular real meets a particular number, so all you have to do is have a different number for each trigger you want to have.


Overall you need to be matching the orders through strings.
 
Status
Not open for further replies.
Top