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

[Solved] Need help with a non-channeled drain life spell I made!

Status
Not open for further replies.
Level 2
Joined
Oct 16, 2013
Messages
18
Hello! I'm a long-time Warcraft 3 player and I've messed around with the editor quite a bit over the years, but I've only recently gotten into making complex triggers for custom spells.

That said, I've had a lot of success solving my problems up until by searching around these forums and the internet in general (seriously thanks guys!). However, I am now stumped on just the smallest part of one of my spells after spending countless hours perfecting a skill-set for a mage type hero.

Basically what I created is a spell based on Shadow Strike (so it can't be dispelled) that attaches a tether (life drain lightning effect) to the target that damages the target and heals the caster over time while the target is in range. After much hard work, I got the spell working to my satisfaction by turning on a "every x seconds" spell to create the desired effect.

However! I have discovered upon testing that when casting one of my other spells (a banish type ability) during the drain from my ult, whoever I cast the banish spell on is no longer effected by the drain. Example: If I drain an enemy hero with my ult, then banish them, they stop taking damage but I continue to heal. If I drain an enemy hero with my ult and banish myself, I stop healing but they continue to take damage.

I attached screenshots of my triggers (the first trigger turns on the second), I'm new here so I have no clue how to put them in the actual post, but would be glad to if someone explained how :p

I highlighted the drain effect that isn't working in red in the screenshots. It's odd because the other effects of the spell (moving the lightning effect to the desired location) seem to work, only 1 part of the spell doesn't work, and only on the target of my new ability.
 

Attachments

  • Trigger1.jpg
    Trigger1.jpg
    452.1 KB · Views: 163
  • Trigger2.jpg
    Trigger2.jpg
    348.9 KB · Views: 173
Last edited by a moderator:
Welcome to the hive, Lawlsrsly!

Your issue is most likely a simple MUI issue. Chances are, your spell variables are being overwritten by the other trigger. If you want your spells to be able to be cast at the same time without issues (*by 1 hero), then you should use separate variables for each spell cast. Otherwise the values will be overwritten.

If you want the spells to be cast by multiple heroes at any time, then you must go to must make your code MUI. Here is an explanation of what MUI is, taken from my dynamic indexing tutorial:
MUI
MUI stands for Multiple Unit Instanceability. That is its only purpose: make a spell able to be
cast by multiple units (without undesired behavior).

What are these so-called MUI-issues that I speak of? Well, let's consider a simple timed spell that
transfers health every 0.1 seconds.​

attachment.php


Seems simple enough. You would start a timer when the spell starts to loop every 0.1 seconds.
In the loop, you would damage the target for 2 hit points, and give 2 hit points to the caster:

  • Siphon Life Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Siphon Life
    • Actions
      • Set SL_Caster = (Triggering unit)
      • Set SL_Target = (Target unit of ability being cast)
      • Set SL_Counter = 0
      • Trigger - Turn on Siphon Life Loop <gen>
  • Siphon Life Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit - Cause SL_Caster to damage SL_Target, dealing 2 damage of attack type Spells and damage type Normal
      • Unit - Set life of SL_Caster to ((Life of SL_Caster) + 2.00)
      • Set SL_Counter = (SL_Counter + 0.10)
      • If (All Conditions are True) then do (Then Actions) else do (Else actions)
        • If - Conditions
          • SL_Counter Greater than or equal to 3.00
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
This would work (ignoring the fact that it doesn't check if the unit is dead and junk).​
attachment.php

(The circle in the bottom right shows how much time has elapsed)


But what do you think would happen when another caster comes in?​
attachment.php


Now the original caster doesn't get any HP, and hogger only takes 2 damage per tick instead of 4
(2 + 2). Why? Look at the trigger above. When the spell is cast, SL_Caster is set to the casting
unit. Since variables can only point to one thing at a time, the original caster (green) is overwritten.
Not only that, but the target is overwritten, and the counter is reset to 0.

This illustrates why we need MUI. Without it, hogger doesn't experience as much pain as he should.​

There are many ways to achieve MUI, but the methods are often difficult to understand. Fortunately, we have a few tutorials on it:
http://www.hiveworkshop.com/forums/...279/multi-instancible-gui-spell-making-34393/
http://www.hiveworkshop.com/forums/tutorial-submission-283/general-spell-creation-236141/
http://www.hiveworkshop.com/forums/tutorial-submission-283/visualize-dynamic-indexing-241896/

Those are all different methods to do the same thing. I recommend the second, since it is probably the easiest clear-cut method. The other two involve arrays which can easily go over someone's head.

P.S. You should post the banish trigger as well. And you can post triggers by right clicking the trigger in the editor, selecting "Copy as Text", and then pasting them between trigger tags [TRIGGER]Put Some Trigger Code[/TRIGGER]. Good luck!

Obviously, this stuff may be a bit difficult to apply. You should post your triggers in trigger tags and someone should be able to fix the problem for you, and then you can just study the code.
 
Level 2
Joined
Oct 16, 2013
Messages
18
Thanks so much for the swift response! I was thinking that something like that could be the problem. However, I actually tried disabling my Banish trigger while troubleshooting for a solution and the same problem arose. I'll post all of the triggers involved though and see what you think.

This is the trigger that initializes the spell:

  • Untitled Trigger 059 Copy 3
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Siphon
      • (Unit-type of (Triggering unit)) Equal to Necrolord
    • Actions
      • Set soulstepcaster = (Triggering unit)
      • Set siphontarget = (Target unit of ability being cast)
      • Set soulsteppoint = ((Position of soulstepcaster) offset by (0.00, 80.00))
      • Set siphontargetpoint = (Position of siphontarget)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Lightning - Create a Drain Life lightning effect from source soulsteppoint to target siphontargetpoint
          • Set lightning2 = (Last created lightning effect)
          • Special Effect - Create a special effect attached to the origin of soulstepcaster using Abilities\Spells\Other\Drain\DrainCaster.mdl
          • Set soulstepeffect = (Last created special effect)
          • Special Effect - Create a special effect attached to the origin of siphontarget using Abilities\Spells\Other\Drain\DrainTarget.mdl
          • Set soulstepeffect2 = (Last created special effect)
          • Unit - Cause soulstepcaster to damage siphontarget, dealing (75.00 + ((Real((Intelligence of soulstepcaster (Include bonuses)))) x 1.50)) damage of attack type Spells and damage type Normal
          • Unit - Cause soulstepcaster to damage siphontarget, dealing (-25.00 + ((Real((Intelligence of soulstepcaster (Include bonuses)))) x -0.50)) damage of attack type Spells and damage type Normal
        • Else - Actions
      • Trigger - Turn on Untitled Trigger 061 <gen>
      • Wait 5.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Untitled Trigger 061 <gen> is on) Equal to True
        • Then - Actions
          • Trigger - Turn off Untitled Trigger 061 <gen>
          • Special Effect - Destroy soulstepeffect
          • Special Effect - Destroy soulstepeffect2
          • Lightning - Destroy lightning2
          • Unit - Cause soulstepcaster to damage siphontarget, dealing (75.00 + ((Real((Intelligence of soulstepcaster (Include bonuses)))) x 1.50)) damage of attack type Spells and damage type Normal
          • Unit - Cause soulstepcaster to damage siphontarget, dealing (-25.00 + ((Real((Intelligence of soulstepcaster (Include bonuses)))) x -0.50)) damage of attack type Spells and damage type Normal
          • Unit - Pause siphontarget
          • Special Effect - Create a special effect attached to the chest of siphontarget using Abilities\Spells\NightElf\ManaBurn\ManaBurnTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect attached to the overhead of siphontarget using Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
          • Set soulstepeffect3 = (Last created special effect)
          • Wait 3.00 seconds
          • Unit - Unpause siphontarget
          • Special Effect - Destroy soulstepeffect3
        • Else - Actions
and this is the trigger that moves the lightning effect and drains life:

  • Untitled Trigger 061
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Custom script: call RemoveLocation (udg_soulsteppoint)
      • Custom script: call RemoveLocation (udg_siphontargetpoint)
      • Set soulsteppoint = ((Position of soulstepcaster) offset by (0.00, 80.00))
      • Set siphontargetpoint = (Position of siphontarget)
      • Set siphonregion = (Region centered at soulsteppoint with size (1200.00, 1200.00))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (siphonregion contains siphontarget) Equal to True
              • (siphontarget is alive) Equal to True
              • (soulstepcaster is alive) Equal to True
        • Then - Actions
          • Lightning - Move lightning2 to source soulsteppoint and target siphontargetpoint
          • Unit - Cause soulstepcaster to damage siphontarget, dealing (5.00 + ((Real((Intelligence of soulstepcaster (Include bonuses)))) x 0.10)) damage of attack type Spells and damage type Normal
          • Unit - Cause soulstepcaster to damage soulstepcaster, dealing (-2.50 + ((Real((Intelligence of soulstepcaster (Include bonuses)))) x -0.05)) damage of attack type Spells and damage type Normal
        • Else - Actions
          • Special Effect - Create a special effect attached to the chest of siphontarget using Abilities\Spells\NightElf\ManaBurn\ManaBurnTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Destroy soulstepeffect
          • Special Effect - Destroy soulstepeffect2
          • Lightning - Destroy lightning2
          • Custom script: call RemoveLocation (udg_soulsteppoint)
          • Custom script: call RemoveLocation (udg_siphontargetpoint)
          • Trigger - Turn off (This trigger)
This is my banish trigger, that I disabled during 1 test:

  • Untitled Trigger 058
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Graverot
    • Actions
      • Unit - Create 1 dummy projectile for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Neutral - Firebolt (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) belongs to an ally of (Owner of (Triggering unit))) Equal to False
        • Then - Actions
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (((Real((Intelligence of (Triggering unit) (Include bonuses)))) x 1.20) + (70.00 x (Real((Level of Graverot for (Triggering unit)))))) damage of attack type Spells and damage type Normal
        • Else - Actions
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (((Real((Intelligence of (Triggering unit) (Include bonuses)))) x -1.20) + (-70.00 x (Real((Level of Graverot for (Triggering unit)))))) damage of attack type Spells and damage type Normal
The thing that is confusing me the most is that the other parts of the "every .10 seconds" trigger work, such as continuing to reposition the lightning and not breaking the conditions which would end the spell. All the things that continue to work require the same variables as the life drain that isn't working. I'm just at a loss lol.

Oh and I should mention that I only need the spell to work when cast by 1 hero. It's for a map that only allows 1 type of each hero to be used at once.

Just a small update on my troubleshooting efforts, to save time for anyone trying to help.

Based on the idea that my variables might be resetting upon casting my 2nd spell, I tried setting the same variables in the 2nd spell as I did in the 1st one. When used on the same target, I was thinking it would work if the problem had to do with variables, but the same thing happened. Here is the altered Banish trigger:

  • Untitled Trigger 058 Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Graverot
    • Actions
      • Set soulstepcaster = (Triggering unit)
      • Unit - Create 1 dummy projectile for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Neutral - Firebolt (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Target unit of ability being cast) belongs to an ally of (Owner of (Triggering unit))) Equal to False
        • Then - Actions
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (((Real((Intelligence of (Triggering unit) (Include bonuses)))) x 1.20) + (70.00 x (Real((Level of Graverot for (Triggering unit)))))) damage of attack type Spells and damage type Normal
          • Set siphontarget = (Target unit of ability being cast)
        • Else - Actions
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (((Real((Intelligence of (Triggering unit) (Include bonuses)))) x -1.20) + (-70.00 x (Real((Level of Graverot for (Triggering unit)))))) damage of attack type Spells and damage type Normal
          • Set soulstepcaster = (Target unit of ability being cast)
Whoops! Sorry for the triple posting, I'll update this edit from now on. And applied the hidden tags! Thanks for the tip.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
Please do not triple post, edit the posts instead :)

Also consider using [hidden][/hidden] tags.

[hidden=Triggers][/hidden] works like
  • Untitled Trigger 033
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Last created unit group) and do (Actions)
        • Loop - Actions
          • Set unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (unit is dead) Equal to False
              • (unit is A structure) Equal to False
            • Then - Actions
            • Else - Actions
 
Level 2
Joined
Oct 16, 2013
Messages
18
use your stored variable
it is useless to store something into a variable but you're not use it
your trigger has leaks
read Things that leak to know which is leak and how to remove them

Are you looking at the Banish spell? That isn't the one I'm having trouble with, it's merely the one interrupting my other spell. And yeah, I know it's leaking right now, I simplified it to try to fix my other spell and haven't changed it back yet.

The spell in question is composed of the top two triggers I pasted. Specifically, the "damage unit" part of the 2nd trigger is what is malfunctioning. The rest of the trigger works, such as moving the lightning. Moving the lightning requires both of the variables that would trigger the damage, but for some reason the damage doesn't work even though the lightning does.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
In your "Untitled Trigger 061", it is better to remove locations at the end of the trigger - that way you can use the same variable in other triggers, as they will never hold information (in this case, the location) for longer than 1 trigger run.


However the problem is in the attack type and damage type of your spell.
Look at this: http://www.wc3c.net/showpost.php?p=1030046&postcount=19

Mainly this part:
Spells
This will damage spell-immune enemies if the damage is physical or universal, and will damage ethereal enemies if the damage is magical or universal. The Spell Damage Reduction (AIsr) item ability applies to this (and only this) attack type.

Afaik, banished units are considered ethereal, so while attack type (= spells) is correct, damage type is incorrect (yours is "normal", but ethereal can be damage only by "magical" or "universal" - see the first 2 spreadsheets in the link above to find out which damage types are considered "universal" or "magical")

Edit: in the link I posted, there is a spreadsheet at the bottom of the post, which should solve your problem.
 
Level 2
Joined
Oct 16, 2013
Messages
18
In your "Untitled Trigger 061", it is better to remove locations at the end of the trigger - that way you can use the same variable in other triggers, as they will never hold information (in this case, the location) for longer than 1 trigger run.


However the problem is in the attack type and damage type of your spell.
Look at this: http://www.wc3c.net/showpost.php?p=1030046&postcount=19

Mainly this part:


Afaik, banished units are considered ethereal, so while attack type (= spells) is correct, damage type is incorrect (yours is "normal", but ethereal can be damage only by "magical" or "universal" - see the first 2 spreadsheets in the link above to find out which damage types are considered "universal" or "magical")

Edit: in the link I posted, there is a spreadsheet at the bottom of the post, which should solve your problem.

Ahh!! Thanks so much! I knew it would be something like this. I had a hunch it had to do with the unit becoming Ethereal but had no idea why since I had set the damage to spell damage.
 
Status
Not open for further replies.
Top