Mana Drain Per Attack

jhnam95

Active Member
Reaction score
12
I'm trying to code something so that whenever a unit attacks, a certain amount of mana is drained. I tried triggering, but then the unit loses mana even when the unit is told to stop firing the attack. I thought about searing arrows dealing 0 bonus damage, but I don't know how to check if it's being used or not since the player cna just not use searing arrows to not lose the mana per attack.
 

bLu3_eYeS

New Member
Reaction score
31
Try doing msething like this:
1.Create a aura that applies only on self and does not do nothing just applyes a buff.
2.Use this trigger that will set the mana of atacking unit to "Mana of attacking unit - 5" like every time the unit with buff attacks he will get -5 mana.
Trigger:
  • Drain mana on atk
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has buff Acid Bomb) Equal to True
    • Actions
      • Set Real = ((Real((Integer((Mana of (Attacking unit)))))) - 5.00)
      • Unit - Set mana of (Attacking unit) to Real

=-=-=-=-=-=-=
+rep if i help'd
 

dudeim

New Member
Reaction score
22
the above trigger can be abused (well I wouldn't know why you want to abuse the mana drain but still) if you order to attack then the mana will be drained even before the attack is actualy done. So if you order to stop then the mana will be drained and no attack will be done therefor you will have to use a damage detection system of some sort. Try searching around here that there are a few of those flying around.

And bLu3_eYeS don't ask for rep if you get it your lucky else your not lucky;)
 

Vöölidin

New Member
Reaction score
0
Manadrain

This might help. i used this as rage for my "warrior" hero but i modified it abit to lower the Attacked units mana. Just make a ability and give it to a hero or the unit u want to drain mana. and change it with the "Rage". Also change the +1.00 and -1.00 to the value u want to drain.

Help.jpg
 

Ayanami

칼리
Reaction score
288
You can do this with the help of a Buff Placer. If the hero is a melee attacker, then a non-Buff Placer is possible. Let's say I base the spell on "Envenomed Spears". Set the duration to any value. Set the slow and damage to 0. Create 2 buffs based on "Poison (Non-stacking)" and "Poison (Stacking)". I'll name these 2 buffs "Buff A" and "Buff B". Now, import Weep's GDD Snippet. Then, use this trigger, shown below.

Trigger:
  • Mana Drain
    • Events
      • GDD_Event becomes Equal to 0.00
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (GDD_DamagedUnit has buff Buff A) Equal to True
          • (GDD_DamagedUnit has buff Buff B) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Set TempReal = 20.00 <-- This is the amount of mana drained
      • Unit - Set mana of GDD_DamageSource to ((Mana of GDD_DamageSource) + TempReal)
      • Unit - Set mana of GDD_DamagedUnit to ((Mana of GDD_DamagedUnit) - TempReal)
      • Unit - Remove Buff A buff from GDD_DamagedUnit
      • Unit - Remove Buff B buff from GDD_DamagedUnit
      • Trigger - Turn on (This trigger)


You can also add in visual effects. Hope this helps.
 

jhnam95

Active Member
Reaction score
12
I know that the damage detection would work, but it's the complete opposite effect of "unit is attacked." What I forgot to mention was that the intention of this is because if a unit runs out of mana, it can't attack. What if my unit has 1000 range and attacks every .3 seconds. Even if it has 0 mana, it'll be able to attack if the projectile from the previous attack hasn't hit yet. What I need is to drain the mana when the projectile launches. Searing arrows and such would be best, but I'm afraid of what side effects this might cause. For one thing, I don't want players attacking w/o the searing arrows on.
 

Vöölidin

New Member
Reaction score
0
Hmm

prolly if you'd force the unit to turn on the Searing arrows skill every 0.01 seconds with a trigger, or make the projectiles speed high so that it hits the second it starts flyin'
 

Bogrim

y hello thar
Reaction score
154
1. Create a trigger which monitors the unit type's mana amount (Unit Group) every X seconds of the game.

--> 2. When picked unit is below X mana and doesn't have the cargo ability, add Cargo Hold.

--> 3. When picked unit is above X mana and does have the cargo ability, remove Cargo Hold.

4. Create a trigger that removes X amount of mana whenever the unit attacks.
 

jhnam95

Active Member
Reaction score
12
@Bogrim, I have no idea what you're trying to say.
@Chaos_Knight, sorry but you missed the crucial point: it drains the ATTACKER'S mana, not the unit that is attacked. If it was the unit that was attacked, I could've easily used feedback or orb of lightning and manaburn or damage detection along with other various methods.
 

Carnerox

The one and only.
Reaction score
84
Trigger:
  • Mana Drain
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Triggering unit) has buff YourBuff) Equal to (==) True
    • Actions
      • Trigger - Turn off (This trigger)
      • Set Mana = 4.00
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - Mana)
      • Trigger - Turn on (This trigger)


It's easy..
 

jhnam95

Active Member
Reaction score
12
You didn't read all of it. That can be abused because the unit will lose mana before the projectile even launches. I'm not saying someone will want to lose a ton of mana by spamming "stop" but what if they're microing and the unit tries to autoattack but they order to unit to stop. The unit just lost its mana for no reason.
 

jhnam95

Active Member
Reaction score
12
i already posted up there that GDD makes an opposite effect. It drains the mana too late and "unit is attacked" does it too early. I need somethign that can do it right as the projectile launches. Searing arrows won't work because the player can just not use it.
 

canons200

New Member
Reaction score
50
maybe do something like this.

unit is attacked
if your unit mana is less than amount
then order your unit to stop
if your unit mana is greater than amount
then cause your unit to damage attacked unit dealing X damage~~~~~
set your mana to your mana - mana desired

warcraft 3 is not a perfect system by itself. Take it or leave it.

In reality, if you want to shoot the enemy while dealing good damage, you add fire onto the arrow. But even if you cancel to shoot, the fire is already burning....................get what i mean?
 

jhnam95

Active Member
Reaction score
12
warcraft 3 is not a perfect system by itself. Take it or leave it.

lol nice... xD

Then an alternative: is it possible to force a player to use searing arrows; make it so that they can't attack without using it.
 

canons200

New Member
Reaction score
50
if you disable normal attack button, your unit can't auto acquisite enemy. because it can't perform attack even through he can use skill, unless you trigger it.

more / less when enemy unit is attacked, order your unit to stop and then oder your unit to searing arrow
 

canons200

New Member
Reaction score
50
i just think another alternative method, the overall effect is the same. Adopt this if suits you

make your unit base damage -1, dice 1, side 1>>damage range 0 - 0
add searing arrow in object editor, set the damage you desired.

trigger part!!!
event an enemy is attacked.
condition attacking unit equal to your unit
action order your unit to searing attacked unit

at such, if your unit mana reach 0, it will still normal attack but with 0 damage. If your unit have sufficient mana, that is, deal 0 damage + searing arrow damage.
 

sabar

New Member
Reaction score
0
Base a new spell off searing arrow. Put it in a spellbook and disable the spellbook so the player cant turn searing arrows off. You can have it on by default in the object editor under default ability or force it on in a trigger.

Then just need a simple trigger. If unit is attacked, attacker type == your unit type, and mana less than searing arrow mana req, order the attacker to stop. The stop order should always go before the unit can swing.

I've used this system myself a few times to force an attacker to wait for mana regen or treat mana as ammo basically.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top