• 🏆 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] Mounting Unit Gain Abilities

Status
Not open for further replies.
Level 3
Joined
May 22, 2012
Messages
50
I know about the Hippogryph Mount ability, and that is what I am currently using. The issue is, I want it so if MountingUnit has AbilityA, then give the NewUnit AbilityB. I'm not quiet sure how to do it... as I don't see a Event Response - MountedUnit option, or anything like that... and I don't know how to check the levels of abilities.

So, basically this is what I'm talking about:


  • Mounting
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (MountingUnit has ability) Equal to Dodge[Level2]
      • (Ability being cast) Equal to MountHorse
    • Actions
      • Unit - Add Dodge[Level2] to (MountedUnit)
  • Dismounting
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (DismountingUnit has ability) Equal to Dodge[Level2]
      • (Ability being cast) Equal to DismountHorse
    • Actions
      • Unit - Add Dodge[Level2] to (DismountedUnitA)


The issue is now solved! Here is the Triggers working in action!
Both of these Triggers here are for the unit on the ground who is mounting.
  • SwordsmanCasting
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to MountingUnit(Example:Footman)
    • Actions
      • Trigger - Turn on SwordsmanEnters <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 1
        • Then - Actions
          • Set MountInt = 1
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 2
        • Then - Actions
          • Set MountInt = 2
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 3
        • Then - Actions
          • Set MountInt = 3
        • Else - Actions
          • Do nothing
      • Trigger - Run SwordsmanEnters <gen> (checking conditions)
This one here (Below) has to be turned off (But Enabled), so keep that in mind.
  • SwordsmanEnters
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to NewUnit(Example:Knight)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 1
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 1
          • Animation - Change (Entering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 2
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 2
          • Animation - Change (Entering unit)'s vertex coloring to (90.00%, 90.00%, 90.00%) with 0.00% transparency
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 3
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 3
          • Animation - Change (Entering unit)'s vertex coloring to (80.00%, 80.00%, 80.00%) with 0.00% transparency
        • Else - Actions
          • Do nothing
      • Trigger - Turn off SwordsmanEnters <gen>
These next two triggers are for when the MountedUnit(Example:Knight) dismounts. Keep in mind the on/off is more important here than in the other two, and removing them can mess a ton of stuff up... unless you know what you're doing.
  • Horseman Casting
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Horseman(Example:Knight)
    • Actions
      • Trigger - Turn on HorsemanEnters <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 1
        • Then - Actions
          • Set MountInt = 1
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 2
        • Then - Actions
          • Set MountInt = 2
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 3
        • Then - Actions
          • Set MountInt = 3
        • Else - Actions
          • Do nothing
      • Trigger - Run HorsemanEnters <gen> (checking conditions)
This other part (Below) must be turned off (Enabled, but initially off) in order to work.
  • HorsemanEnters
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to MountingUnit(Example:Footman)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 1
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 1
          • Animation - Change (Entering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 2
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 2
          • Animation - Change (Entering unit)'s vertex coloring to (90.00%, 90.00%, 90.00%) with 0.00% transparency
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 3
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 3
          • Animation - Change (Entering unit)'s vertex coloring to (80.00%, 80.00%, 80.00%) with 0.00% transparency
        • Else - Actions
          • Do nothing
      • Trigger - Turn off HorsemanEnters <gen>
I also added in the "Animation-Change ...", though it's not needed.
 
Last edited:
Level 3
Joined
May 22, 2012
Messages
50
Who is Triggering Unit? What I'm talking about is the new unit that is created after the two units merge together. There isn't any option for that from what I can tell. :S
 
Level 3
Joined
May 22, 2012
Messages
50
You mean like this?


  • Mounting
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to MountHorse
    • Actions
      • Unit - Set level of AbilityB for (Triggering unit) to 3
That last bit, with the Action? I tried it a few times, and nothing is happening.
 
Level 3
Joined
May 22, 2012
Messages
50
Yes. All the units (Except for the horse) has AbilityB.

I even tried something like spawning a Footman next to the Triggering Unit, but that didn't acknowledge that it worked.

I'm wondering if the Conditions is what's holding up the Trigger. Do you think that could be the case?
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
use this as the event

Unit - A unit enters (Playable map area)

add a condition on mount and dismount for checking unit types
 
Level 3
Joined
May 22, 2012
Messages
50
Great! Now I have:


  • Mounting
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Horseman
    • Actions
      • Unit - Set level of AbilityB for (Triggering unit) to 3


A few issues are:
1. I can't check if the mounting unit has AbilityB.
2. Whenever I train the unit, it will automatically be given this ability (Which could be avoided if I could check if they have AbilityB, because it would do no harm to give it to them again.)
 
Level 3
Joined
May 22, 2012
Messages
50
How to I specify which unit I am checking? It needs to be able to check the unit that is Mounting, and if it matches, then it sets the newly created unit's ability to the same level.
 
Level 3
Joined
May 22, 2012
Messages
50
The Triggers aren't working any more. It can only check the unit AFTER it enters the region. Therefor, it checks the mounting unit's ability to be level1, and then sets the new units ability to be level1... despite the fact the mounting unit was a level2.
 
Level 3
Joined
May 22, 2012
Messages
50
The Trigger doesn't work. When I use it, it can't read the caster's ability level... instead, it tries to read the new unit's ability's level.
 
Level 3
Joined
May 22, 2012
Messages
50
Alright. I have a semi-working Trigger now. The only current issue is when multiple units use their abilities... it can become a duplication bug.

  • Unit Casting
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to MountHorse
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Casting unit)) Equal to 1
        • Then - Actions
          • Set MountInt = 1
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Casting unit)) Equal to 2
        • Then - Actions
          • Set MountInt = 2
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Casting unit)) Equal to 3
        • Then - Actions
          • Set MountInt = 3
        • Else - Actions
          • Do nothing
  • Enters Region
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Horseman
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 1
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 1
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 2
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 2
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 3
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 3
        • Else - Actions
          • Do nothing
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
do you have a UnitIndexer?

E/ nevermind, I honestly don't see a way to do this without heavy vJass. Why are the levels of your abilities different between units?
 
Level 3
Joined
May 22, 2012
Messages
50
Success!

Thanks for the help guys, I've figured it out now.


  • UnitCasting
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to MountingUnit
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 1
        • Then - Actions
          • Set MountInt = 1
          • Trigger - Run UnitEnters <gen> (checking conditions)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 2
        • Then - Actions
          • Set MountInt = 2
          • Trigger - Run UnitEnters <gen> (checking conditions)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 3
        • Then - Actions
          • Set MountInt = 3
          • Trigger - Run UnitEnters <gen> (checking conditions)
        • Else - Actions
          • Do nothing
  • UnitEnters
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to NewUnit(Example:Knight)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 1
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 1
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 2
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 2
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 3
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 3
        • Else - Actions
          • Do nothing


I ran it a few times, and it works perfectly the way I want it! It is able to work when you have all three different units casting the ability at the same time, or different times, or whatever!
 
Level 3
Joined
May 22, 2012
Messages
50
do you have a UnitIndexer?

E/ nevermind, I honestly don't see a way to do this without heavy vJass. Why are the levels of your abilities different between units?

The abilities varied between units because I wanted to cut down on the amount of units I had. I was ending up with abut six or so units in my barracks... and it was getting crazy. So, instead, I made it so when you train a unit, it "Level ups" it's abilities, enabling it to dodge attacks easier, and land more critical hits. Oh, and I also tint their colors slightly so you have a visual other than the abilities saying [1] or [2] ETC.

The working Triggers I got now don't have the tinting stuff I normally have, but anyone else who wants to use them can always add those themselves if they want it too.
 
Level 3
Joined
May 22, 2012
Messages
50
Oops, I forgot about dismounting. I found away around it though. I have to start out with the UnitEnter's triggers being turned off because when you spawn one into the world, it will set them to level one... this way, it works cleanly!

Both of these Triggers here are for the unit on the ground who is mounting.
  • SwordsmanCasting
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to MountingUnit(Example:Footman)
    • Actions
      • Trigger - Turn on SwordsmanEnters <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 1
        • Then - Actions
          • Set MountInt = 1
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 2
        • Then - Actions
          • Set MountInt = 2
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 3
        • Then - Actions
          • Set MountInt = 3
        • Else - Actions
          • Do nothing
      • Trigger - Run SwordsmanEnters <gen> (checking conditions)
This one here (Below) has to be turned off (But Enabled), so keep that in mind.
  • SwordsmanEnters
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to NewUnit(Example:Knight)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 1
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 1
          • Animation - Change (Entering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 2
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 2
          • Animation - Change (Entering unit)'s vertex coloring to (90.00%, 90.00%, 90.00%) with 0.00% transparency
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 3
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 3
          • Animation - Change (Entering unit)'s vertex coloring to (80.00%, 80.00%, 80.00%) with 0.00% transparency
        • Else - Actions
          • Do nothing
      • Trigger - Turn off SwordsmanEnters <gen>
These next two triggers are for when the MountedUnit(Example:Knight) dismounts. Keep in mind the on/off is more important here than in the other two, and removing them can mess a ton of stuff up... unless you know what you're doing.
  • Horseman Casting
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Horseman(Example:Knight)
    • Actions
      • Trigger - Turn on HorsemanEnters <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 1
        • Then - Actions
          • Set MountInt = 1
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 2
        • Then - Actions
          • Set MountInt = 2
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of AbilityB for (Dying unit)) Equal to 3
        • Then - Actions
          • Set MountInt = 3
        • Else - Actions
          • Do nothing
      • Trigger - Run HorsemanEnters <gen> (checking conditions)
This other part (Below) must be turned off (Enabled, but initially off) in order to work.
  • HorsemanEnters
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to MountingUnit(Example:Footman)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 1
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 1
          • Animation - Change (Entering unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 2
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 2
          • Animation - Change (Entering unit)'s vertex coloring to (90.00%, 90.00%, 90.00%) with 0.00% transparency
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • MountInt Equal to 3
        • Then - Actions
          • Unit - Set level of AbilityB for (Entering unit) to 3
          • Animation - Change (Entering unit)'s vertex coloring to (80.00%, 80.00%, 80.00%) with 0.00% transparency
        • Else - Actions
          • Do nothing
      • Trigger - Turn off HorsemanEnters <gen>
I also added in the "Animation-Change ...", though it's not needed.
 
Status
Not open for further replies.
Top