Burn % of current mana

Archideas

Active Member
Reaction score
32
Right, so I'm trying to make a spell that burns away 20%/30%/40% of current mana of the picked enemy units and deals that amount in damage. I'm not really certain this formula I have so far is correct so I'm turning to you guys to help me out.

Trigger:
  • Almagest
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Almagest
    • Actions
      • Set HeroCaster = (Casting unit)
      • Set HeroCastPoint = (Position of HeroCaster)
      • Set HeroCastUnitGrp = (Units within 600.00 of HeroCastPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of HeroCaster)) Equal to True))))
      • Unit Group - Pick every unit in HeroCastUnitGrp and do (Actions)
        • Loop - Actions
          • Unit - Cause HeroCaster to damage (Picked unit), dealing ((Mana of (Picked unit)) x (0.10 + (0.10 x (Real((Level of Almagest for HeroCaster)))))) damage of attack type Spells and damage type Normal
          • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) x (0.10 + (0.10 x (Real((Level of Almagest for HeroCaster))))))
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call DestroyGroup( udg_HeroCastUnitGrp )
      • Custom script: call RemoveLocation( udg_HeroCastPoint )
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
Right, so I'm trying to make a spell that burns away 20%/30%/40% of current mana of the picked enemy units and deals that amount in damage. I'm not really certain this formula I have so far is correct so I'm turning to you guys to help me out.

Trigger:
  • Almagest
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Almagest
    • Actions
      • Set HeroCaster = (Casting unit)
      • Set HeroCastPoint = (Position of HeroCaster)
      • Set HeroCastUnitGrp = (Units within 600.00 of HeroCastPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of HeroCaster)) Equal to True))))
      • Unit Group - Pick every unit in HeroCastUnitGrp and do (Actions)
        • Loop - Actions
          • Unit - Cause HeroCaster to damage (Picked unit), dealing ((Mana of (Picked unit)) x (0.10 + (0.10 x (Real((Level of Almagest for HeroCaster)))))) damage of attack type Spells and damage type Normal
          • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) x (0.10 + (0.10 x (Real((Level of Almagest for HeroCaster))))))
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call DestroyGroup( udg_HeroCastUnitGrp )
      • Custom script: call RemoveLocation( udg_HeroCastPoint )

Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) - ((Mana of (Picked unit) x (0.10 + (0.10 x (Real((Level of Almagest for HeroCaster)))))))

That should work? ^^
 

Bogrim

y hello thar
Reaction score
154
There are other mistakes in this trigger.

1. You don't need to assign a variable for the casting unit, just use "Event Response - Triggering unit".

2. You need another condition in your unit group which detects if the unit has mana or not, e.g. (Mana of (Matching Unit)) Greater than 0.

3. The mana drain formula should be ((Mana of (Picked unit)) * (0.90 - (0.10 x (Real((Level of Almagest for HeroCaster)))))).
 

Archideas

Active Member
Reaction score
32
After your suggestions, my trigger looks like this now.

Trigger:
  • Almagest
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Almagest
    • Actions
      • Set HeroCaster = (Casting unit)
      • Set HeroCastPoint = (Position of HeroCaster)
      • Set HeroCastUnitGrp = (Units within 600.00 of HeroCastPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Mana of (Matching unit)) Greater than 0.00) and ((((Matching unit) belongs to an enemy of (Owner of HeroCa
      • Unit Group - Pick every unit in HeroCastUnitGrp and do (Actions)
        • Loop - Actions
          • Unit - Cause HeroCaster to damage (Picked unit), dealing ((Mana of (Picked unit)) x (0.10 + (0.10 x (Real((Level of Almagest for HeroCaster)))))) damage of attack type Spells and damage type Normal
          • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) x (0.90 - (0.10 x (Real((Level of Almagest for HeroCaster))))))
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\DeathPact\DeathPactTarget.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call DestroyGroup( udg_HeroCastUnitGrp )
      • Custom script: call RemoveLocation( udg_HeroCastPoint )
 

Ayanami

칼리
Reaction score
288
Can be further optimized to this. You do not need the variable "HeroCaster" at all.

Trigger:
  • Almagest
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Almagest
    • Actions
      • Set HeroCastPoint = (Position of (Triggering unit))
      • Set HeroCastUnitGrp = (Units within 600.00 of HeroCastPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Mana of (Matching unit)) Greater than 0.00) and ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))
      • Unit Group - Pick every unit in HeroCastUnitGrp and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing ((Mana of (Picked unit)) x (0.10 + (0.10 x (Real((Level of Almagest for (Triggering unit))))))) damage of attack type Spells and damage type Magic
          • Unit - Set mana of (Picked unit) to ((Mana of (Picked unit)) x (0.90 - (0.10 x (Real((Level of Almagest for HeroCaster))))))
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\DeathPact\DeathPactTarget.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call DestroyGroup( udg_HeroCastUnitGrp )
      • Custom script: call RemoveLocation( udg_HeroCastPoint )
 

Archideas

Active Member
Reaction score
32
Got another trigger that doesn't want to work as I want it to. This is supposed to drain 50 health from all enemy units within a 375 radius each second for 3 seconds. But somehow it won't work. I'm sure I missed something obvious but I can't find the problem.

Trigger:
  • Grand Cross
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Grand Cross
    • Actions
      • Set GrandCrossPoint = (Target point of ability being cast)
      • Set GrandCrossCaster = (Casting unit)
      • Set CrossLoops = 0
      • Unit - Create 1 Grand Cross Dummy for (Owner of GrandCrossCaster) at GrandCrossPoint facing Default building facing degrees
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Trigger - Turn on Grand Cross DoT <gen>


Trigger:
  • Grand Cross DoT
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Set GrandCrossGrp = (Units within 375.00 of GrandCrossPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of
      • Unit Group - Pick every unit in GrandCrossGrp and do (Actions)
        • Loop - Actions
          • Unit - Cause GrandCrossCaster to damage (Picked unit), dealing 12.50 damage of attack type Chaos and damage type Universal
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set CrossLoops = (CrossLoops + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CrossLoops Equal to 12
            • Then - Actions
              • Custom script: call RemoveLocation( udg_GrandCrossPoint )
              • Custom script: call DestroyGroup( udg_GrandCrossGrp )
              • Trigger - Turn off (This trigger)
            • Else - Actions
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
This can be done in one trigger
(Handwritten)
Trigger:
  • GrandCross
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Grand Cross
    • Actions
      • Set GrandCrossPoint = (Target point of ability being cast)
      • Set GrandCrossGrp = (Units within 375.00 of GrandCrossPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit........
      • Custom script: call RemoveLocation( udg_GrandCrossPoint )
      • For Each integer A from 1 to 12 do actions
        • loop-actions
          • Unit Group - Pick every unit in GrandGrossGrp and do multiple actions
            • loop-actions
              • Set life of (Triggering Unit) to: (Current life)+50
              • Set life of (picked unit) to: (Current life)-50
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
              • Special Effect - Destroy (Last created special effect)
          • Wait 0.25 seconds
      • Custom script: call DestroyGroup( udg_GrandCrossGrp )
 

Archideas

Active Member
Reaction score
32
So this way I can make it so all enemy units within a 375 radius of the target point have 12.5 health per 0.25 second drained from them over a course of 3 seconds?
 

HydraRancher

Truth begins in lies
Reaction score
197
So this way I can make it so all enemy units within a 375 radius of the target point have 12.5 health per 0.25 second drained from them over a course of 3 seconds?

It is not recommended to use this method, it may bugg up when using other (Integer A) actions. If you wish to have a repeatative draining system, you probably need to use Timers and/but not Hashtables.
 

Archideas

Active Member
Reaction score
32
I noticed I forgot to specify the problem. It basically won't last the 3 seconds I want it to. Even though it should drain 150 health in total, it only drains like 50. And as far as I know, 12.5 * 12 = 150, and 3 / 12 = 0.25. So I think my formula is right, but it still doesn't want to work. :<
 

HydraRancher

Truth begins in lies
Reaction score
197
I noticed I forgot to specify the problem. It basically won't last the 3 seconds I want it to. Even though it should drain 150 health in total, it only drains like 50. And as far as I know, 12.5 * 12 = 150, and 3 / 12 = 0.25. So I think my formula is right, but it still doesn't want to work. :<

Dont use set life = ...
Use Unit - Damage Target.
Where did you get your 3 from? (in 3 / 12 = 0.25)
 

Archideas

Active Member
Reaction score
32
Dont use set life = ...
Use Unit - Damage Target.
Where did you get your 3 from? (in 3 / 12 = 0.25)

I'm not using Set Life, I'm using Damage. The spell should drain 12.5 health per 0.25 second from enemy units within a 375 radius from where the spell is casted. And since it lasts 3 seconds in total, it should loop 12 times in total.

So the 3 / 12 = 0.25 basically means that if I want it to loop every 0.25 second for 3 seconds, I need to loop it 12 times. :<
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
I'm just gonna shoot this out: Why don't you make the dummy have permanent immolation? If damage is the only problem ^^
 

Archideas

Active Member
Reaction score
32
I'm just gonna shoot this out: Why don't you make the dummy have permanent immolation? If damage is the only problem ^^

My god... Why the fooking freckles didn't I think of that before? Thanks alot for the suggestion. xP
 

Ayanami

칼리
Reaction score
288
Your problem lies in this trigger.

Trigger:
  • Grand Cross DoT
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Set GrandCrossGrp = (Units within 375.00 of GrandCrossPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of
      • Unit Group - Pick every unit in GrandCrossGrp and do (Actions)
        • Loop - Actions
          • Unit - Cause GrandCrossCaster to damage (Picked unit), dealing 12.50 damage of attack type Chaos and damage type Universal
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set CrossLoops = (CrossLoops + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CrossLoops Equal to 12
            • Then - Actions
              • Custom script: call RemoveLocation( udg_GrandCrossPoint )
              • Custom script: call DestroyGroup( udg_GrandCrossGrp )
              • Trigger - Turn off (This trigger)
            • Else - Actions


It should look like this.

Trigger:
  • Grand Cross DoT
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Set GrandCrossGrp = (Units within 375.00 of GrandCrossPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of
      • Unit Group - Pick every unit in GrandCrossGrp and do (Actions)
        • Loop - Actions
          • Unit - Cause GrandCrossCaster to damage (Picked unit), dealing 12.50 damage of attack type Chaos and damage type Universal
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
          • Special Effect - Destroy (Last created special effect)
      • Set CrossLoops = (CrossLoops + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CrossLoops Equal to 12
        • Then - Actions
          • Custom script: call RemoveLocation( udg_GrandCrossPoint )
          • Custom script: call DestroyGroup( udg_GrandCrossGrp )
          • Trigger - Turn off (This trigger)
        • Else - Actions


Due to your "Set CrossLoops" being inside your unit group loop, it will loop. Thus, let's say there are 3 units in the group. Then the set action would loop 3 times, resulting your DoT trigger to end faster than usual.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top