[General] Mana Cost Reduction of skills Using passive

Level 8
Joined
Oct 6, 2022
Messages
185
Hello, here to ask some question again. i would like to know how to make this passive where "when this passive is learned, decreases the mana cost of all of her skills in half of the original mana cost required for original skills for each each level of her respective skills."
adding to that original mana cost of the 1st to 3rd skills are
lvl1: 100
lvl2: 150
lvl3: 200
lvl4: 250

original mana cost of ult:
lvl1 to lvl3: 350


i've tried it before but the result was a bit off:

  • Hourai Doll
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Passive
    • Actions
      • Set TUnit[1] = (Triggering unit)
      • Unit - For Unit TUnit[1], Set mana cost of ability 1stSkill , Level: 1 to 50
      • Unit - For Unit TUnit[1], Set mana cost of ability 1stSkill , Level: 2 to 75
      • Unit - For Unit TUnit[1], Set mana cost of ability 1stSkill , Level: 3 to 100
      • Unit - For Unit TUnit[1], Set mana cost of ability 1stSkill , Level: 4 to 125
      • -------- ------ --------
      • Unit - For Unit TUnit[1], Set mana cost of ability 2ndSkill , Level: 1 to 50
      • Unit - For Unit TUnit[1], Set mana cost of ability 2ndSkill , Level: 2 to 75
      • Unit - For Unit TUnit[1], Set mana cost of ability 2ndSkill , Level: 3 to 100
      • Unit - For Unit TUnit[1], Set mana cost of ability 2ndSkill , Level: 4 to 125
      • -------- ------ --------
      • Unit - For Unit TUnit[1], Set mana cost of ability 3rdSkill , Level: 1 to 50
      • Unit - For Unit TUnit[1], Set mana cost of ability 3rdSkill , Level: 2 to 75
      • Unit - For Unit TUnit[1], Set mana cost of ability 3rdSkill , Level: 3 to 100
      • Unit - For Unit TUnit[1], Set mana cost of ability 3rdSkill , Level: 4 to 125
      • -------- ------ --------
      • Unit - For Unit TUnit[1], Set mana cost of ability Ult , Level: 1 to 175
      • Unit - For Unit TUnit[1], Set mana cost of ability Ult , Level: 2 to 175
      • Unit - For Unit TUnit[1], Set mana cost of ability Ult , Level: 3 to 175
hope you guys could help me with this



ps -- of anyone wondering why i put an array to the TUnit because so that when i'm making a new skill, i won't need to create more variable for it.
 
Last edited:
Level 30
Joined
Aug 29, 2012
Messages
1,382
If you're on 1.31+ you can certainly use the new functions to do something like this
  • Mana Cost
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to YourPassive
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of YourPassive for (Triggering unit)) Equal to 1
        • Then - Actions
          • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Blizzard)'s Integer Level Field: Mana Cost ('amcs') of Level: 0 to 50
          • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Summon Water Elemental)'s Integer Level Field: Mana Cost ('amcs') of Level: 0 to 80
          • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Mass Teleport)'s Integer Level Field: Mana Cost ('amcs') of Level: 0 to 100
        • Else - Actions
etc.

Only thing to keep in mind is that level 0 for this function = level 1 of the ability ingame
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Just remember that you can Learn the passive prior to the Skills that get reduced by it. So you'll want to detect when ANY of the hero's skills are learned and apply the Mana Cost changes if needed. Here's Chaosium's trigger but extended to include what I just mentioned along with some minor optimizations:
  • Mana Cost
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Level of Passive for (Triggering unit)) Greater than 0
    • Actions
      • Set Variable Hero = (Triggering unit)
      • -------- --------
      • -------- Ideally you could have all of this Skill data stored in Arrays during the Init phase --------
      • Set Variable Skill[1] = 1stSkill
      • Set Variable Skill[2] = 2ndSkill
      • Set Variable Skill[3] = 3rdSkill
      • Set Variable Skill[4] = Ulti
      • -------- --------
      • -------- Apply mana cost changes --------
      • For each Integer (X) from 1 to 4 do (Actions)
        • Loop - Actions
          • Set Variable SkillLevel[X] = ((Level of Skill[X] for Hero) - 1)
          • Set Variable ManaCost[X] = (50 + (25 x SkillLevel[X]))
          • Ability - Set Ability: (Unit: Hero's Ability with Ability Code: Skill[X])'s Integer Level Field: Mana Cost ('amcs') of Level: SkillLevel[X] to ManaCost[X]
      • -------- --------
      • -------- The ulti always costs 175 mana so let's fix it here --------
      • Ability - Set Ability: (Unit: Hero's Ability with Ability Code: Skill[4])'s Integer Level Field: Mana Cost ('amcs') of Level: SkillLevel[4] to 175
If these changes don't take effect then you'll want to "refresh" the ability:
  • Unit - Increase level of ability for unit
  • Unit - Decrease level of ability for unit
^ This forces the ability to apply any updates. Note that in some cases a field simply cannot be changed, but it's usually only for rare fields like "Number of owls" for the Sentinel ability.
 
Last edited:
Top