Hero Ability Trigger Help

Level 6
Joined
Jul 10, 2016
Messages
160
Hey guys could i get some help with triggers?

Im trying to make a map and I need help with some triggers.

I need to make a trigger where if the hero gets max level he will automatically get a new ability, like in x hero siege.

thanks. i would put +rep to you
 

Jampion

Code Reviewer
Level 13
Joined
Mar 25, 2016
Messages
1,294
If 10 is your max level and banish is the ability you want to add, you can use this:
  • MaxLevel
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Hero level of (Triggering unit)) Equal to 10
    • Actions
      • Unit - Add Banish (Neutral Hostile) to (Triggering unit)
 
Level 6
Joined
Jul 10, 2016
Messages
160
If 10 is your max level and banish is the ability you want to add, you can use this:
  • MaxLevel
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Hero level of (Triggering unit)) Equal to 10
    • Actions
      • Unit - Add Banish (Neutral Hostile) to (Triggering unit)

How can I add a unit as a variable?? and how can i make it work?
 
Level 6
Joined
Jul 10, 2016
Messages
160
If 10 is your max level and banish is the ability you want to add, you can use this:
  • MaxLevel
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Hero level of (Triggering unit)) Equal to 10
    • Actions
      • Unit - Add Banish (Neutral Hostile) to (Triggering unit)

or how can I atleast make a unit into a preset?
 
Level 19
Joined
Feb 23, 2014
Messages
1,212
How can I add a unit as a variable?? and how can i make it work?
You don't need to add variables in this example.

What the trigger does is - whenever a unit gets a level, it checks if the unit that gained a level (and caused the trigger to run - i.e. triggering unit) is at level 10 and if so, it adds the ability that unit.

The trigger will work, though you might want to consider adding more conditions, because right now the trigger will add the selected ability to ANY unit that gains level 10.

If you want this trigger to only work for a specific unit, you should add something like this:
  • Conditions
    • (Triggering unit) Equal to YOUR UNIT
If you are using a unit that is pre-placed on the map, just click "Select Unit" and then click on the unit on the map. If you are using a variable, you need to create a unit variable first in the variable editor then at some point before this trigger has a chance to fire, use action "Set Variable". Once values are put in, the action will look like this:

  • Actions
    • Set UNIT VARIABLE = SOME REFERENCE TO A UNIT
For instance, you might use (Last created unit) as the reference if the unit you want to set as your variable is created by a Create Unit trigger function. Just be careful - if this trigger will run multiple times, it will overwrite the variable each time, so either turn it off after the first time it is run or set up events/conditions in a way that makes it impossible to be run multiple times.

One more example I will give is a situation where you want a specific hero type to get a specific ability whenever a hero of that type reaches max level. In other words, if you want each Paladin hero to get X ability whenever it reaches max level.

In that case, you might want to use something like this:

  • Events
    • Unit - A unit Gains a level
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Paladin
    • (Hero level of (Triggering unit)) Equal to 10
  • Actions
    • Unit - Add Acid Bomb to (Triggering unit)
And if you want different types of heroes to gain different abilities, I'd recommend adding "If/Then/Else" action and moving both the unit-type conditions and add ability actions there. Like this:

  • Events
    • Unit - A unit Gains a level
  • Conditions
    • (Hero level of (Triggering unit)) Equal to 10
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Triggering unit)) Equal to Paladin
      • Then - Actions
        • Unit - Add Acid Bomb to (Triggering unit)
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Triggering unit)) Equal to Archmage
      • Then - Actions
        • Unit - Add Animate Dead to (Triggering unit)
      • Else - Actions
There's a ton of other things you might do with this, but if you want a specific solution you'd need to describe what exactly do you need in detail.
 
Last edited:
Top