• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

How to subtract mana from a unit every 5 seconds?

Status
Not open for further replies.
Level 5
Joined
Feb 3, 2012
Messages
107
its not for a spell, dont worry.
so i wanted to have a trigger like this.

Every 10 seconds, every unit in the map will lose 1 point of mana. The mana in my map sort of works like food. (dont worry, ive made regeneration rate to 0)

In addition, if a unit has lost all of its mana, every 10 seconds, he will instead lose 1 point of health.

The set mana of Unit doesnt work, because it doesnt subtract the mana, it just sets the amount of mana. Very different to what i want. thx for the help BeTaGod-
 
  • Events
    • Time - Every 10 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in MYGROUP and do
      • Do - actions
        • If-then-else
          • If - conditions
            • Mana of (picked unit) is greater than 0
          • Then - Actions
            • Unit - Set mana of (picked unit) to ((mana of (picked unit)) - 10)
          • Else - Actions
            • Unit - Set life of (picked unit) to ((life of (picked unit)) - 1)
Now its just up to you to add the units into the group MYGROUP

Also, I don't see how set unit mana won't work becoz it does work with reducing mana of a unit...
 
NOPE, because MYGROUP is a global group that is created at start and only at that instance and not everytime the trigger runs...

It will only leak if I used Pick every unit in blahblahblahblah... like Pick every unit in range for example in which case, the trigger will create a new group everytime it is called to hold those units in range...
 
Status
Not open for further replies.
Top