• 🏆 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!

[Trigger] Help with a mana bonus hero ability?

Status
Not open for further replies.
Level 6
Joined
Jul 24, 2008
Messages
180
I have created an ability to increase mana cap for a hero. There is Energy Pack, the hero ability, and Mana+, the item ability.
  • Events
  • Unit - Unit learns a skill
  • Conditions
  • (Learned Hero Skill) Equal to Energy Pack
  • Actions
  • Unit - Add Mana+ to (Learning Hero)
At level 1 it adds 1 mana. Levels 2/3/4/5 should be 11/111/1111/11111. Level one works, but no successive level will add more mana.
  • Events
  • Time - Every 0.10 seconds of game time
  • Conditions
  • Actions
  • Unit Group - Pick every unit in (units of type SPELL TESTER and do (Actions)
  • Loop - Actions
  • Unit - Set level of Mana+ for (Picked Unit) to (Level of Energy Pack for (Picked Units))
  • If ((Level of Mana+ for (Picked Unit)) Equal to 5) then do (Trigger - Turn off (This trigger)) else (Do nothing)
Can anyone find what I did wrong? Or find another way to approach this? Thanks.
 
Level 2
Joined
Feb 8, 2009
Messages
16
In this trigger:
  • Events
    • Time - Every 0.10 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (units of type SPELL TESTER and do (Actions)
  • Loop - Actions
    • Unit - Set level of Mana+ for (Picked Unit) to (Level of Energy Pack for (Picked Units))
    • If ((Level of Mana+ for (Picked Unit)) Equal to 5) then do (Trigger - Turn off (This trigger)) else (Do nothing)
You made the group pick ALL units of type SpellTester. For this trigger that is the picked unit. Later in that trigger which is were I think you went wrong is here:

  • Unit - Set level of Mana+ for (Picked Unit) to (Level of Energy Pack for (Picked Units))
Your setting the level of SpellTester's spell to the level of SpellTester's spell. Because SpellTester is the "picked" unit. If that makes sense. What you would have to do in this trigger is set the learning hero to a variable like so:
  • Events
    • Unit - Unit learns a skill
  • Conditions
    • (Learned Hero Skill) Equal to Energy Pack
  • Actions
    • Set Variable = (Triggering Unit)
    • Unit - Add Mana+ to (Learning Hero)
Is set the unit learning the spell to a Variable THEN in this part of the trigger that sets the level of the ability:

  • Unit - Set level of Mana+ for (Picked Unit) to (Level of Energy Pack for (Picked Units))
Change it to:


  • Unit - Set level of Mana+ for (Picked Unit) to (Level of Energy Pack for (Variable))

And that SHOULD fix the problem. Also you may want to clear the leaks from the unit groups you have there.

So your triggers should look like this:

First trigger (Unit learns skill)

  • Trigger 1
  • Events
    • Unit - Unit learns a skill
  • Conditions
    • (Learned Hero Skill) Equal to Energy Pack
  • Actions
    • Set Variable = (Triggering Unit)
    • Unit - Add Mana+ to (Learning Hero)
    • Trigger - Turn on Trigger 2 <gen>
Second Trigger (Set level of skill of Spell Tester)

  • Trigger 2 (THIS TRIGGER IS INITIALLY OFF IT IS TURNED ON BY TRIGGER 1)
  • Events
    • Time - Every 0.10 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (units of type SPELL TESTER and do (Actions)
  • Loop - Actions
    • Unit - Set level of Mana+ for (Picked Unit) to (Level of Energy Pack for (Variable))
    • Trigger - Turn off (This Trigger)
This part is not needed just delete it.

  • If ((Level of Mana+ for (Picked Unit)) Equal to 5) then do (Trigger - Turn off (This trigger)) else (Do nothing)

If this is in any way confusing just tell me and I'll explain more.

As you can tell I'm bad at explaining things, im better if I can show you.

Side note: Clear leaks.
 
Last edited:
Level 13
Joined
Mar 16, 2008
Messages
941
Just to inform you: that's a known bug. The first of the levels always work (the same with mp, hp, damage, ias, armor...) but the ones after don't, BUT if you remove the ability, the bonuses are removed although you never had them.
Example: Level 1 adds 20 hitpoints.
If you add it, you got 20 hitpoints more, if you remove it, you loose 20 hitpoints.
New ability: Level 1 adds 0 hitpoints, level 2 -20 hitpoints.
That sounds weird, but think of what happens.
You add the ability and get +0 hitpoints. Now you set the level to 2, but due to this bug the -20 will not be applied. If you now remove it, the game tries to undo "-20" and add +20 hitpoints forever. You can take a look at "BonusMods" from EarthFury :)
 
Status
Not open for further replies.
Top