• 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] Unit - A unit Is issued an order targeting an object -- Event Problem

Status
Not open for further replies.
Level 3
Joined
Jun 15, 2008
Messages
23
Hey guys, I have a problem with a mounting trigger using this event. Since I was dealing with heroes mounting, I didn't want to use the mount and dismount skill because it resets level, skills, items, variable sets, ect... So I used this trigger where if the player right clicks the horse with the fighter selected, they merge into a unit. Everything works, until I found a problem with the event, where the player can right click twice really fast to make two mounted units instead. I tried putting in a cooldown, MountCooldownForPlayer = true, but it doesn't seem to work. Here is the trigger

Mounting Fighter
Events
Unit - A unit Is issued an order targeting an object
Conditions
(Is (Target unit of issued order) near (Triggering unit) and withing a range of 150.00) Equal to True
(Issued order) Not equal to (Order(attack))
Or - Any (Conditions) are true
Conditions
And - All (Conditions) are true
Conditions
(Unit-type of (Triggering unit)) Equal to Horse
(Unit-type of (Target unit of issued order)) Equal to Fighter
And - All (Conditions) are true
Conditions
(Unit-type of (Triggering unit)) Equal to Fighter
(Unit-type of (Target unit of issued order)) Equal to Horse
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units currently selected by (Owner of (Triggering unit)))) Equal to 1
Then - Actions
Else - Actions
Skip remaining actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Triggering unit)) Equal to Horse
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Target unit of issued order) Equal to Leader[(Player number of (Owner of (Triggering unit)))]
Then - Actions
Set NewPlayerHero[(Player number of (Owner of (Target unit of issued order)))] = True
Else - Actions
Do nothing
Set MountLevel = (Hero level of (Target unit of issued order))
Set MountLife = (Integer((Percentage life of (Target unit of issued order))))
Set MountMana = (Integer((Percentage mana of (Target unit of issued order))))
Sound - Play TamingTarget1 <gen> at 100.00% volume, located at (Position of (Triggering unit)) with Z offset 0.00
Unit - Replace (Target unit of issued order) with a Fighter (Rider) using The old unit's relative life and mana
Unit - Remove (Triggering unit) from the game
Hero - Set (Last replaced unit) Hero-level to MountLevel, Hide level-up graphics
Unit - Set life of (Last replaced unit) to (Real(MountLife))%
Unit - Set mana of (Last replaced unit) to (Real(MountMana))%
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
NewPlayerHero[(Player number of (Owner of (Triggering unit)))] Equal to True
Then - Actions
Set Leader[(Player number of (Owner of (Triggering unit)))] = (Last replaced unit)
Set NewPlayerHero[(Player number of (Owner of (Triggering unit)))] = False
Else - Actions
Do nothing
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Triggering unit)) Equal to Fighter
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Triggering unit) Equal to Leader[(Player number of (Owner of (Triggering unit)))]
Then - Actions
Set NewPlayerHero[(Player number of (Owner of (Triggering unit)))] = True
Else - Actions
Do nothing
Set MountLevel = (Hero level of (Triggering unit))
Set MountLife = (Integer((Percentage life of (Triggering unit))))
Set MountMana = (Integer((Percentage mana of (Triggering unit))))
Sound - Play TamingTarget1 <gen> at 100.00% volume, located at (Position of (Triggering unit)) with Z offset 0.00
Unit - Replace (Triggering unit) with a Fighter (Rider) using The old unit's relative life and mana
Unit - Remove (Target unit of issued order) from the game
Hero - Set (Last replaced unit) Hero-level to MountLevel, Hide level-up graphics
Unit - Set life of (Last replaced unit) to (Real(MountLife))%
Unit - Set mana of (Last replaced unit) to (Real(MountMana))%
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
NewPlayerHero[(Player number of (Owner of (Triggering unit)))] Equal to True
Then - Actions
Set Leader[(Player number of (Owner of (Triggering unit)))] = (Last replaced unit)
Set NewPlayerHero[(Player number of (Owner of (Triggering unit)))] = False
Else - Actions
Do nothing
Else - Actions


Anyone got any solutions?
 
Level 16
Joined
May 1, 2008
Messages
1,605
Hmm first i want do this for you ;9 so i get better view off it

  • Mounting Fighter
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Is (Target unit of issued order) near (Triggering unit) and withing a range of 150.00) Equal to True
      • (Issued order) Not equal to (Order(attack))
      • Or - Any (Conditions) are true
        • Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Horse
              • (Unit-type of (Target unit of issued order)) Equal to Fighter
          • And - All (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Fighter
              • (Unit-type of (Target unit of issued order)) Equal to Horse
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units currently selected by (Owner of (Triggering unit)))) Equal to 1
        • Then - Actions
        • Else - Actions
          • Skip remaining actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Horse
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Target unit of issued order) Equal to Leader[(Player number of (Owner of (Triggering unit)))]
            • Then - Actions
              • Set NewPlayerHero[(Player number of (Owner of (Target unit of issued order)))] = True
            • Else - Actions
              • Do nothing
          • Set MountLevel = (Hero level of (Target unit of issued order))
          • Set MountLife = (Integer((Percentage life of (Target unit of issued order))))
          • Set MountMana = (Integer((Percentage mana of (Target unit of issued order))))
          • Sound - Play TamingTarget1 <gen> at 100.00% volume, located at (Position of (Triggering unit)) with Z offset 0.00
          • Unit - Replace (Target unit of issued order) with a Fighter (Rider) using The old unit's relative life and mana
          • Unit - Remove (Triggering unit) from the game
          • Hero - Set (Last replaced unit) Hero-level to MountLevel, Hide level-up graphics
          • Unit - Set life of (Last replaced unit) to (Real(MountLife))%
          • Unit - Set mana of (Last replaced unit) to (Real(MountMana))%
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • NewPlayerHero[(Player number of (Owner of (Triggering unit)))] Equal to True
            • Then - Actions
              • Set Leader[(Player number of (Owner of (Triggering unit)))] = (Last replaced unit)
              • Set NewPlayerHero[(Player number of (Owner of (Triggering unit)))] = False
            • Else - Actions
              • Do nothing
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Fighter
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Triggering unit) Equal to Leader[(Player number of (Owner of (Triggering unit)))]
                • Then - Actions
                  • Set NewPlayerHero[(Player number of (Owner of (Triggering unit)))] = True
                • Else - Actions
                  • Do nothing
              • Set MountLevel = (Hero level of (Triggering unit))
              • Set MountLife = (Integer((Percentage life of (Triggering unit))))
              • Set MountMana = (Integer((Percentage mana of (Triggering unit))))
              • Sound - Play TamingTarget1 <gen> at 100.00% volume, located at (Position of (Triggering unit)) with Z offset 0.00
              • Unit - Replace (Triggering unit) with a Fighter (Rider) using The old unit's relative life and mana
              • Unit - Remove (Target unit of issued order) from the game
              • Hero - Set (Last replaced unit) Hero-level to MountLevel, Hide level-up graphics
              • Unit - Set life of (Last replaced unit) to (Real(MountLife))%
              • Unit - Set mana of (Last replaced unit) to (Real(MountMana))%
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • NewPlayerHero[(Player number of (Owner of (Triggering unit)))] Equal to True
                • Then - Actions
                  • Set Leader[(Player number of (Owner of (Triggering unit)))] = (Last replaced unit)
                  • Set NewPlayerHero[(Player number of (Owner of (Triggering unit)))] = False
                • Else - Actions
                  • Do nothing
            • Else - Actions
Hmm whats about to add the Actions: Trigger - Turn off this trigger (at beginning) and Trigger - Turn on this trigger at the end? If the tirgger is turned off at the beging .. the player can klick double in 0.0001 seconds .. nothing will happend ...

or at the end do do: Wait - wait 2 seconds > Trigger - Turn on this trigger / or just turn it off

Trigger - Turn off this trigger - will NOT interrupt the function!

MfG
Dr. Boom
 
Level 3
Joined
Jun 15, 2008
Messages
23
Thanks, I tried it that way, works pretty well from multiplying! just now the fast clicks either, if i have the horse it disappears and the footman is still a footman and if i have the footman, the knight is made but the horse is still there lol.

But its much better, though still a problem
 
Level 16
Joined
May 1, 2008
Messages
1,605
Hmm you experiment what kind of my following is corect in your trigger ;)

Whats about that: You create one more variable (name it (maybe) Units - with array 2)

Than you add in your trigger (its just a small section of the full trigger)
  • Actions:
    • Set Units[0] - (The Footman here)
    • Set Units[1] - (The horse here)
    • Unit - Create 1 (Your Knight) for (Player (what you want)) at (Center of Units[1] facing (what you want)
    • Set Units[2] - (The created Knight)
    • Unit - Remove Units[0]
    • Unit - Remove Units[1]
Maybe this can change your problem ;)

MfG
Dr. Boom
 
Status
Not open for further replies.
Top