• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Lighting Arrow

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
Adding to what Devalut said, a method I've used before is using a unique Dummy unit to determine that the damage came from your ability (Lightning Arrow). It requires some extra Object Editor abilities but relieves you from having to deal with Timers/Periodically checking for a buff.

So you'd have 3 abilities instead of 2.

Lightning Arrow: The main ability that does nothing besides use the tooltip/cd/manacost. This is what your Ranger would cast, and you would create a Dummy unit in response to this and order it to cast the next ability on this list -> Dummy Arrow, on your target.

Dummy Arrow: The first ability that you add and use on your Dummy. This ability fires the lightning arrow. You could base it off of Acid Bomb and set the AoE to 0, damage interval/duration to 0.001 and damage amount to 0. This way it almost immediately fires a Damage Event.

Dummy Chain: This is the second ability that you add to your Dummy. This is based on Chain Lightning and will cast Chain Lightning.


Then you'd have 1 Damage Event trigger:
  • Events:
  • DamageEvent becomes Equal to 1.00
  • Conditions:
  • Unit-Type of DamageEventSource Equal to Dummy (Lightning Arrow)
  • Level of Dummy Arrow for DamageEventSource Greater than 0
  • Actions:
  • Remove Dummy Arrow from DamageEventSource
  • Add Dummy Chain to DamageEventSource
  • Order DamageEventSource to Orc - Chain Lightning DamageEventTarget
  • Add a 6.00 second Expiration Timer to DamageEventSource
Chain Lightning will end early if the caster dies during the chains, so you want to make sure that you remove your Dummy AFTER you're sure the ability has finished chaining. I add a 6.00 second Expiration Timer because that should be more than enough time for the ability to have finished chaining.
 
Level 12
Joined
Oct 28, 2019
Messages
475
  • Untitled Trigger 001
    • Events
      • Unit - Nhamun 0088 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lighting Arrow
    • Actions
      • Unit - Create 1 DUMMY for Player 2 (Blue) at (Target point of ability being cast) facing Default building facing degrees
      • Set VariableSet targetunitLighting = (Target unit of ability being cast)
  • Untitled Trigger 003
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to DUMMY
    • Actions
      • Hero - Learn skill for (Entering unit): Chain Lightning
      • Unit - Order (Entering unit) to Orc Far Seer - Chain Lightning targetunitLighting
      • Wait 3.00 seconds
      • Unit - Remove (Entering unit) from the game
this work in this form with specifc unit event.... But my main unit is a variable and doesnt work even if put A unit by player 2 .... unit type equal... ability equal... etc any solution to this
 

zam

zam

Level 3
Joined
Jan 1, 2021
Messages
31
  • Untitled Trigger 001
    • Events
      • Unit - Nhamun 0088 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lighting Arrow
    • Actions
      • Unit - Create 1 DUMMY for Player 2 (Blue) at (Target point of ability being cast) facing Default building facing degrees
      • Set VariableSet targetunitLighting = (Target unit of ability being cast)
  • Untitled Trigger 003
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to DUMMY
    • Actions
      • Hero - Learn skill for (Entering unit): Chain Lightning
      • Unit - Order (Entering unit) to Orc Far Seer - Chain Lightning targetunitLighting
      • Wait 3.00 seconds
      • Unit - Remove (Entering unit) from the game
this work in this form with specifc unit event.... But my main unit is a variable and doesnt work even if put A unit by player 2 .... unit type equal... ability equal... etc any solution to this
You're using Specific Unit in the Event change it to Event - Unit Starts Effect of an Ability.
 
Level 12
Joined
Oct 28, 2019
Messages
475
i´ve got it
  • LightingArrow1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Nhamun
      • (Ability being cast) Equal to Lighting Arrow
    • Actions
      • Unit - Create 1 DummyLightingArrow for Player 2 (Blue) at (Target point of ability being cast) facing Default building facing degrees
      • Set VariableSet targetunitLighting = (Target unit of ability being cast)
  • LightingArrow2
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to DummyLightingArrow
    • Actions
      • Hero - Learn skill for (Entering unit): Chain Lightning
      • Unit - Order (Entering unit) to Orc Far Seer - Chain Lightning targetunitLighting
      • Wait 3.00 seconds
      • Unit - Remove (Entering unit) from the game
I´ve got this worked nice.... but have some issues, i´ve used acid bombs and dont know remove buff, and how do this trigger with flame strike and blizzard? Cant find in heroes abilities trigger....other issue how lelving this
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
Check out the attached map.

I have a Lightning Arrow ability that has 3 levels, each level increasing the damage of the Chain Lightning effect.

I'm using the methods I described above, although slightly tweaked in order to fix some minor issues.

This runs when we cast Lightning Arrow. A Dummy is created that fires the Arrow at the target, which upon contact will cause the next trigger to run.
  • Lightning Arrow Hero
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Arrow (Hero)
    • Actions
      • -------- Set the Point where want to create the Dummy --------
      • Set VariableSet LA_Point = (Position of (Triggering unit))
      • -------- --------
      • -------- Create the Dummy --------
      • Unit - Create 1 Lightning Arrow (Dummy) for (Triggering player) at LA_Point facing Default building facing degrees
      • Unit - Add Lightning Arrow (Dummy - Arrow) to (Last created unit)
      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
      • Unit - Set level of Lightning Arrow (Dummy - Arrow) for (Last created unit) to (Level of (Ability being cast) for (Triggering unit))
      • -------- --------
      • -------- Order Dummy to cast Lightning Arrow (The Arrow missile): --------
      • Unit - Order (Last created unit) to Neutral Alchemist - Acid Bomb (Target unit of ability being cast)
      • -------- --------
      • -------- Clean up memory leak: --------
      • Custom script: call RemoveLocation (udg_LA_Point)
This runs when our Dummy's Arrow hits the enemy unit.
  • Lightning Arrow Chain
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (Level of Lightning Arrow (Dummy - Arrow) for DamageEventSource) Greater than 0
    • Actions
      • -------- Move the Dummy to the position of the target: --------
      • Set VariableSet LA_Point = (Position of DamageEventTarget)
      • Unit - Move DamageEventSource instantly to LA_Point
      • Custom script: call RemoveLocation (udg_LA_Point)
      • -------- --------
      • -------- Remove buff: --------
      • Unit - Remove Lightning Arrow (Hidden) buff from DamageEventTarget
      • -------- --------
      • -------- Add Chain Lightning to Dummy: --------
      • Unit - Add Lightning Arrow (Dummy - Chain) to DamageEventSource
      • Unit - Set level of Lightning Arrow (Dummy - Chain) for DamageEventSource to (Level of Lightning Arrow (Dummy - Arrow) for DamageEventSource)
      • -------- --------
      • -------- Remove the Arrow ability so the Chain Lightning damage doesn't cause this trigger to run: --------
      • Unit - Remove Lightning Arrow (Dummy - Arrow) from DamageEventSource
      • -------- --------
      • -------- Order Dummy to cast Chain Lightning: --------
      • Unit - Order DamageEventSource to Orc Far Seer - Chain Lightning DamageEventTarget
I'm using 3 abilities, 1 buff, and 1 variable. Shouldn't be too hard to copy all of those over to your map. Just make sure to update the triggers so that they use the correct abilities/buffs.

And of course I'm using Bribe's Damage Engine as Devalut suggested: Damage Engine 5.7.1.2
 

Attachments

  • Lightning Arrow example 1.w3m
    58.6 KB · Views: 16
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
Hmm? Not sure what you mean exactly.

The Damage comes from Chain Lightning, which is one of the 3 abilities. You need to edit those abilities to change the ability effects.

Also, when you copy and paste that stuff to your map the triggers will get screwed up and use the wrong Units/Abilities/Buffs/etc...
 
Last edited:
Level 12
Joined
Oct 28, 2019
Messages
475
i´ve got it
  • LightingArrow1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Nhamun
      • (Ability being cast) Equal to Lighting Arrow
    • Actions
      • Unit - Create 1 DummyLightingArrow for Player 2 (Blue) at (Target point of ability being cast) facing Default building facing degrees
      • Set VariableSet targetunitLighting = (Target unit of ability being cast)
  • LightingArrow2
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to DummyLightingArrow
    • Actions
      • Hero - Learn skill for (Entering unit): Chain Lightning
      • Unit - Order (Entering unit) to Orc Far Seer - Chain Lightning targetunitLighting
      • Wait 3.00 seconds
      • Unit - Remove (Entering unit) from the game
I´ve got this worked nice.... but have some issues, i´ve used acid bombs and dont know remove buff, and how do this trigger with flame strike and blizzard? Cant find in heroes abilities trigger....other issue how lelving this

I will use this for a while. I would like to know if there is a leak point, or need add custom script to clear memory
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
Here are some issues:

1) You don't need LightningArrow2, that trigger is unnecessary. Everything can be done inside a single trigger.
2) (Target point of ability being cast) doesn't exist, since your ability doesn't target a point, it targets a unit.
3) Regarding LightningArrow2, which you can delete, it has issues. First, you don't want to use Entering Unit and Waits like that. The only safe Event Response to use after a Wait is Triggering Unit. But that's unnecessary, you can simply add an Expiration Timer to your Dummy unit in the same trigger that creates it like I do below. Also, Learn Skill is used for Heroes, to increase the Level of their Hero abilities. You want to use Add Ability/Increase Level of Ability when modifying the abilities for a Dummy unit. Your Dummy unit should be based on the Locust unit (You should use the one I made in my map, it's setup properly).

The fix:

  • Events
  • Unit - A unit Starts the effect of an ability
  • Conditions
  • (Unit-type of (Triggering unit)) Equal to Nhamun
  • (Ability being cast) Equal to Lighting Arrow
  • Actions
  • Set Variable TempPoint = Position of (Target unit of ability being cast)
  • Unit - Create 1 DummyLightingArrow for Triggering Player at TempPoint facing Default building facing degrees
  • Custom script: call RemoveLocation (udg_TempPoint)
  • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
  • Unit - Add Chain Lightning to (Last created unit)
  • Unit - Set level of Chain Lightning for (Last created unit) to (Level of (Ability being cast) for (Triggering unit))
  • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Target unit of ability being cast)
Some random notes:
- Since you want to use this method, the unique Dummy unit becomes unnecessary and you can use a generic Dummy unit instead.
- It's spelled Lightning with an "n" :p

Also, I'm not sure what was wrong with the spell I made, but it's very customizable. You could trigger any damage/effects you could possibly want. The Lightning Arrow (Hero) ability could be based on Storm Bolt if you wanted it to stun/damage the first target for example. You could also trigger some "Impact" damage yourself if you wanted the primary target to take extra damage (look up Cause Unit Damage action).
 
Last edited:
Level 12
Joined
Oct 28, 2019
Messages
475
Ty man... worked nice... im doing an mage archer... and now flame strike
  • FlameArrow
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Nhamun
      • (Ability being cast) Equal to Flame Arrow
    • Actions
      • Set VariableSet FlameLocal = (Position of (Target unit of ability being cast))
      • Unit - Create 1 DummyExplosiveArrow for (Triggering player) at (Target point of ability being cast) facing Default building facing degrees
      • Custom script: Custom script: call RemoveLocation(udg_FlameLocal)
      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Flame Strike to (Last created unit)
      • Unit - Set level of Flame Strike for (Entering unit) to (Level of Flame Strike for (Triggering unit))
      • Unit - Order (Entering unit) to Human Blood Mage - Flame Strike FlameLocal
but the custom script is with problem and idk what comand is to remove points

other question... I can use 3 acid bombs skills to create 3 custom skills or will cause problems??
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
You should use Last created unit instead of Entering unit when you Set the Level/Order the Dummy.

You should create the Dummy at FlameLocal instead of (Target point of ability being cast). The reason we create that Point variable in the first place is so that we can use it.

Your Custom script says Custom Script twice.

Wrong:
  • Custom script: Custom script: call RemoveLocation(udg_FlameLocal)
Correct:
  • Custom script: call RemoveLocation(udg_FlameLocal)
 
Level 12
Joined
Oct 28, 2019
Messages
475
nice ty, one last thing and my mage archer is ready...
  • Arcane Arrow
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Nhamun
      • (Ability being cast) Equal to Arcane Arrow
    • Actions
      • Set VariableSet ArcaneLocal = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Dummy for (Triggering player) at ArcaneLocal facing Default building facing degrees
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Starfall to (Last created unit)
      • Unit - Set level of Starfall for (Entering unit) to (Level of (Ability being cast) for (Triggering unit))
      • Wait 0.20 seconds
      • Unit - Order (Last created unit) to Night Elf Priestess Of The Moon - Starfall.
      • Custom script: call RemoveLocation(udg_ArcaneLocal)
IDK where is the problem here, it dont cast the star fall
for this im using storm bolt
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,535
Issues:

1) You're using (Entering unit) when you should be using (Last created unit). Only use Event Responses that go with their Events, Entering Unit is used with the Event: A unit enters/leaves a Region.
I know you might be thinking "but this works fine", but there's room for errors and bugs to occur if you don't use the appropriate methods.

2) You shouldn't use Waits like that. The (Last created unit) could get changed to something else during the 0.20 seconds, causing the Dummy unit to never get the Starfall order. Let's say during that 0.20 second Wait, another trigger went off that created a NEW Dummy unit (or any unit), what will happen is (Last created unit) will get changed to that new unit causing things to not work.

All of the Event Responses, excluding Triggering Unit, work like global variables that can only be set to 1 thing at a time, and they're shared between every trigger.

3) You're removing ArcaneLocal after a Wait, which gives time (0.20 seconds) for ArcaneLocal to get Set again. That could happen if this trigger were to fire a second time in under 0.20 seconds. Another issue (a memory leak) could happen if you use ArcaneLocal in more than 1 trigger. This creates the opportunity for memory leaks and can even break the trigger because you'll remove the wrong ArcaneLocal.
Custom script: call RemoveLocation will always remove the most RECENT ArcaneLocal created, which may not be the one you wanted to Remove.

That being said, if you're 100% sure that this Trigger will NEVER happen twice in under ~0.20 seconds and ArcaneLocal is used ONLY for this trigger, then it's safe to use the Wait. But be warned, a lot of things will stop working after a Wait, so remember that!

The solution:
1) Remove the Wait.
2) Change (Entering unit) to (Last created unit).
3) Make sure the 5.00 second Expiration Timer is long enough for the Dummy to channel the FULL Starfall duration.
4) Make sure the Dummy can actually cast Starfall (check mana cost and other requirements).
5) If you want a delay before Starfall casts, change Starfall's Casting Time in the Object Editor to 0.20 seconds. If that doesn't work then you can create a new Dummy unit used specifically for this ability and change it's Art - Cast Point to however long you want the delay to be. A unit's Cast Point is basically the same thing as Casting Time.
 
Last edited:
  • Like
Reactions: KPC
Status
Not open for further replies.
Top