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

Issue on mana cost

Status
Not open for further replies.
Level 5
Joined
Dec 22, 2007
Messages
102
I recently got help creating a fire shiled ability, and it all works fine except that the ability empties the mana pool of the target on which its casted. It only costs 100 mana, and I can't find anything in the triggers that would cause it.
 

Attachments

This is very odd... every time you try to add ANY ability to the Spell Book, and give the Spell Book to the targeted unit, it drains all their mana. I tested with other random abilities, too, in your map... Critical Strike and Spiked Carapaces also drained all mana, even when they were the only spells in the spell book.

My only workaround, really, is to give the unit the Spell Book when they are picked, and then do 1 of 2 things:

1) Set level 1 of each ability to do nothing, and level 2 = level 1, etc. Then you can just keep them with the Spell Book having the level 1 abilities, and it won't do anything. And then in the trigger, set the level of their abilities to the level of the casting unit's ability + 1. Or...
2) Keep the Spell Book on this unit the whole time, and just disable the abilities inside the Spell Book for every player, until the ability is cast on them.

Sorry, I know that isn't a great workaround, but it's the only thing I could get to make it functioning, besides just adding the Mana back.
 
It has to do with your upgrade, which adds 200 to max mana. I guess the upgrade is somehow updated when adding the spell in spellbook. Your Doom Guards have only 200 max mana as base, exact the same amount. When it's set higher, giving the spellbook might instead refresh mana.
 
Can you explain how that is to be done? I tired making a real variable and setting the mana of the target to that variable, and loading it afterwards, but it didn't work. I made the trigger look like this:
  • Fire Shield
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fire Shield
    • Actions
      • Set Daemon = (Triggering Unit)
      • Set FireShieldTarget = (Target unit of ability being cast)
      • Set TargetMana = (Mana of FireShieldTarget)
      • Unit - Add Fire Shield (Bundle) to FireShieldTarget
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Fire Shield for Daemon) Equal to 2
        • Then - Actions
          • Unit - Set level of Fire Shield (Effect) for FireShieldTarget to 2
          • Unit - Set level of Fire Shield Armor for FireShieldTarget to 2
        • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • FireShieldTarget Equal to Daemon
          • Then - Actions
            • Unit - Set mana of FireShieldTarget to (TargetMana - 100)
          • Else - Actions
            • Unit - Set mana of FireShieldTarget to TargetMana
        • Unit Group - Add FireShieldTarget to FireShieldTargets
        • Trigger - Turn on Fire Shield Targets <gen>
 
Also, you don't need the Conditions to check the level of the Fire Shield and set the level to 2
Instead of doing this:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of Fire Shield for Daemon) Equal to 2
    • Then - Actions
      • Unit - Set level of Fire Shield (Effect) for FireShieldTarget to 2
      • Unit - Set level of Fire Shield Armor for FireShieldTarget to 2
    • Else - Actions
You can just do this:
  • Actions
    • Unit - Set level of Fire Shield (Effect) for FireShieldTarget to (Level of Fire Shield for (Triggering unit))
    • Unit - Set level of Fire Shield Armor for FireShieldTarget to (Level of Fire Shield for (Triggering unit))
This trigger will keep track of the caster's Fire Shield ability level
If it's 2, then buff level 2, understand ?
It saves performance better
 
I created a separate trigger which sets TargetMana = mana of FireShieldTarget every
second, and added a .5 second delay between setting variables and adding the spellbook
and it worked great. Now the only issue with that ability is that when casted on another
target during the duration of the first target's buff, the variable will change and the first
unit with the buff will not properly lose the ability. I'm not sure how to get around this
though.
 
Status
Not open for further replies.
Back
Top