1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

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

Discussion in 'Triggers & Scripts' started by vlekje5, Jan 27, 2020.

  1. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0
    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
     
  2. Sabe

    Sabe

    Joined:
    Jul 30, 2018
    Messages:
    434
    Resources:
    1
    Spells:
    1
    Resources:
    1
    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: Jan 27, 2020
  3. vlekje5

    vlekje5

    Joined:
    Dec 1, 2010
    Messages:
    255
    Resources:
    0
    Resources:
    0
    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!