• 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.

Help with trigger

Status
Not open for further replies.
Level 9
Joined
Sep 15, 2012
Messages
311
I have a Ranger hero that summons a wolf.
The wolf has 250 base hit points and I want to make a trigger that adds +15 to its max hit points for each level of the Ranger hero.

I made a unit ability named Spirit Bond (based on Item Life Bonus) that has 20 levels and each level gives +15 more hit points.
Then I did something like this:

  • Event
  • Unit - A unit spawns a unit.
  • Condition - Unit-type of Summoned Unit Equal to Wolf
  • Actions
  • Unit - Give Spirit Bond to Summoned Unit
  • Unit - Set Level of Spirit Bond for Summoned Unit to Hero Level of Summoning Unit
It didn't work. The wolf gains the ability Spirit Bond, gains +15 hit points but no matter what level the Ranger Hero is the ability is not increasing. Also the Spirit Bond ability is not showing on the Wolf.
Anyone can help?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
That is because the ability "Item Life Bonus" is bugged: only the first level works.
However, when you remove the ability, the unit loses HP corresponding to the level of the ability

Example: ability that adds +100 HP every level (+100/+200/+300)
Ability is added and set to level is 2.
Unit gains +100HP (because levels don't work).
Ability is removed: unit loses 200HP (a total of 100HP lost, because he gained 100HP when the ability was added).

For GUI. there's this system (you only want to import "SetUnitMaxState, unless you're interested in the BonusMod as well).
You can set a unit's max HP by doing this (set max HP to 500):
  • Set Bonus_Type = 0
  • Set Bonus_Unit = Summoned Unit
  • Set Bonus_Amount = 500
  • Trigger - Run Set MaxState <gen> (ignoring conditions)
Or add HP by doing this (add 200HP):
  • Set Bonus_Type = 0
  • Set Bonus_Unit = Summoned Unit
  • Set Bonus_Amount = ((Integer((Max life of (Summoned unit)))) + 200)
  • Trigger - Run Set MaxState <gen> (ignoring conditions)

If you prefer JASS, then this is the original version of that system.
 
Level 9
Joined
Sep 15, 2012
Messages
311
It's not working at all... :(

I copied Set Life and Mana Abilities, Init and SetUnitMAxState triggers.

Edit: It's working but it increases only mana instead of Hit points. I will do a triple check to see if I copied something wrong or the triggers have a typo.

Edit2: The triggers seems Ok since they work on the test map. Seems I copy something wrong. Or some variable interferes or whatever... trying to solve it... :(

Solved. I probably did something wrong while editing the trigger lines.
 
Last edited:
Level 21
Joined
Mar 27, 2012
Messages
3,232
That is because the ability "Item Life Bonus" is bugged: only the first level works.
However, when you remove the ability, the unit loses HP corresponding to the level of the ability

Example: ability that adds +100 HP every level (+100/+200/+300)
Ability is added and set to level is 2.
Unit gains +100HP (because levels don't work).
Ability is removed: unit loses 200HP (a total of 100HP lost, because he gained 100HP when the ability was added).

For GUI. there's this system (you only want to import "SetUnitMaxState, unless you're interested in the BonusMod as well).
You can set a unit's max HP by doing this (set max HP to 500):
  • Set Bonus_Type = 0
  • Set Bonus_Unit = Summoned Unit
  • Set Bonus_Amount = 500
  • Trigger - Run Set MaxState <gen> (ignoring conditions)
Or add HP by doing this (add 200HP):
  • Set Bonus_Type = 0
  • Set Bonus_Unit = Summoned Unit
  • Set Bonus_Amount = ((Integer((Max life of (Summoned unit)))) + 200)
  • Trigger - Run Set MaxState <gen> (ignoring conditions)

If you prefer JASS, then this is the original version of that system.

You gave me an idea.
What if the first level did nothing and second was -100 health?
It adds 100 health. (if level is incremented)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
You gave me an idea.
What if the first level did nothing and second was -100 health?
It adds 100 health. (if level is incremented)
That's exactly how the system (linked in that post) works :D.
Well, kind-of: it uses multiple levels (like you said: first level = 0, after that it uses binary digits) so you can easily add/remove a high amount of HP (instead of doing +1 / +1 / +1 a thousand times, which would suck).
 
Status
Not open for further replies.
Top