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

[Solved] Setting hero's mana to current value + flat addition.

Status
Not open for further replies.
Level 8
Joined
Dec 1, 2010
Messages
316
Hello all, So the system i'm working on is an item pasive. This pasive is supposed to give a 20% chance to restore the mana equal to the heroes agility.

I've succeeded with making most of the steps, however i'm not finding any trigger that finds the current mana the unit has.

The current trigger is wrong at the part where i set the mana to a percentage of it's mana + the agi. But i'm not finding any way to make this first value his current mana.
Does anyone have any idea for a workaround way i can make it so that i only add mana based on his agility?

I've looked a ton but so far could only find a way to set it to the heroes max mana wich i don't want. I need to be able to spot the current mana the hero has.

Thanks!

  • pickup
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacking unit) has (Item carried by (Attacking unit) of type Amulet of the hunt)) Equal to True
        • Then - Actions
          • Set VariableSet RandomNumber = (Random integer number between 0 and 100)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomNumber Greater than 80
            • Then - Actions
              • Unit - Set mana of (Attacking unit) to ((Percentage mana of (Attacking unit)) + (Real((Agility of (Attacking unit) (Include bonuses)))))
              • Special Effect - Create a special effect at (Position of (Attacking unit)) using Abilities\Spells\Undead\ReplenishMana\SpiritTouchTarget.mdl
              • Hero - Add 10000 experience to (Attacking unit), Show level-up graphics
            • Else - Actions
        • Else - Actions
          • Do nothing
 
Level 9
Joined
Jul 30, 2018
Messages
445
It's just two lines below: Unit - Set Mana (To Value) instead of (To Percentage).

I see it now. You have the right actions, but the problem is you can't find the mana value. That is because the mana is actually behind the "Unit property" option and there "mana" is the current mana and "Max mana" obviously the max mana.

Also, if you want precisely 20% chance, the range should be from 1 to 100. ;) Now you have actually 101 and different random numbers, when it should be 100 for 100%.
 
Last edited:
Level 8
Joined
Dec 1, 2010
Messages
316
It's just two lines below: Unit - Set Mana (To Value) instead of (To Percentage).

Also, if you want precisely 20% chance, the range should be from 1 to 100. ;) Now you have actually 101 and different random numbers, when it should be 100 for 100%.
i've found it!

And for the percentages, it's mostly a test stage, i will play around with the chance and the values of it! But thanks!
 
Status
Not open for further replies.
Top