• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Trigger] Detect mana used

Status
Not open for further replies.
Hello guys. Couldn't find anything that would help me with my trouble so i decided to creat new thread.

However post a link if u found something interesting on this forum what solves my problem. :thumbs_up:

I'm in need of trigger/system to detect mana used by spells by units doing so.
I have found example in Jass but i need somthing similar in GUI, if u want i will post where i found Jass example.

Any help is appreciated. :wink:
 
Well it's easy :) first make a Trigger using the event " Begins Casting Spell "
Save the mana of the unit as X = mana of unit " VARIABLE " :)
Then Do a trigger event saying " Start Effect of an Ability or spell " ...
Take Y = Mana of the unit ........... then do XY = X - Y = " NUMBER "

That's the mana used :) good luck.

It does require a little more job to do it MUI .. but that explaination is only GUI and not MUI :)
 
Check out the map uploaded.. the only problem is when the mana regenerate rate is too high.. Tried this sometime ago and gave up and here i am trying again lol
I think the best way to detect mana usage is to specify each spell mana usage manually since mine is not accurate

  • Before Cast
    • Events
      • Unit - A unit Begins casting an ability / Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set begincast_mana = (Mana of (Triggering unit))
      • Game - Display to (All players) the text: (Before Casting: + ((String(begincast_mana)) + Mana))
  • After Cast
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
    • Actions
      • Set finishcast_mana = (Mana of (Triggering unit))
      • Game - Display to (All players) the text: (Finish Casting: + ((String(finishcast_mana)) + Mana))
      • Set used_mana = (begincast_mana - finishcast_mana)
      • Game - Display to (All players) the text: (Mana Used: + ((String(used_mana)) + Mana))
 

Attachments

Thanks you both for quick and helpfull answers.

I'm gona try both since in RMX example i'm unsure of what gonna happen if unit get stuned, and about the zulrivers example, i tried something similar and a minor bug occured, units with higher mana regeneration had their mana cost of spells via variable less than orginal.
It was exactly orginal value -1. :wink:

Anyways gona try both, thanks once again! :grin:
 
Okey, i just tested via zulrivers's map all posibilities, and:
Rmx: Starts the effect of ability event does not respond actual state of mana pool of triggering unit, because it's momment when spell is cast and mana is 'being used', but not used already (it's wierd).

About zulrivers example, your idea is good, but there is problem i described in my previous post, it's not exactly perfect, but for sure i dont need that, it we convert Real into Integer we gonna have perfect numbers (or nearly) ;) We can use Ends casting a spell instead of Stops casting aswell.

Again thanks for your time, both +rep:thumbs_up:
 
Status
Not open for further replies.
Back
Top