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

[Trigger] Custom Spell Lighting Effect Help

Status
Not open for further replies.
Level 5
Joined
Jun 29, 2014
Messages
39
I made Triangle Custom spell here is how it work: When I active spell it create lighting triangle from one region to other regions than when somebody enter in that region he die, but now I have problem when somebody die how to make special effect on him and after 2 sec to disapper and how to destroy my lightings because
  • Lightning - Destroy (Last created lightning effect)
work only on last lighting how to work on all?
And is this good for special effect on dead unit and to disapper after 2 sec for me this don't work
  • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Other\Awaken\Awaken.mdl
Here is whole spell:
  • Triangle Spell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Triangle
    • Actions
      • Wait 2.00 seconds
      • Lightning - Create a Chain Lightning - Primary lightning effect from source (Center of Triangle1 <gen>) to target (Center of Triangle2 <gen>)
      • Wait 2.00 seconds
      • Lightning - Create a Chain Lightning - Primary lightning effect from source (Center of Triangle2 <gen>) to target (Center of Triangle3 <gen>)
      • Wait 2.00 seconds
      • Lightning - Create a Chain Lightning - Primary lightning effect from source (Center of Triangle3 <gen>) to target (Center of Triangle1 <gen>)
      • Wait 2.00 seconds
      • Unit Group - Pick every unit in (Units in Triangle Damage <gen>) and do (Unit - Kill (Picked unit))
      • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Other\Awaken\Awaken.mdl
      • Wait 2.00 seconds
      • Special Effect - Destroy (Last created special effect)
      • Lightning - Destroy (Last created lightning effect)
      • Lightning - Destroy (Last created lightning effect)
      • Lightning - Destroy (Last created lightning effect)
Thank you and sorry for bad english.
 
Level 25
Joined
Sep 26, 2009
Messages
2,379
First of all, when using spells, use the "Starts the effect of an ability" event instead of "Begins casting an ability", since the latter can be abused. (Begin casting an ability servers only as an event for checking certain stuff for custom made spells).

Second: Try avoiding waits in spells if possible (more so when the map is intended for multiplayer) as waits are inaccurate (even if you want 2 second wait, it does not wait 2 seconds, more so the wait time is prolonged by player's ping)

Third: You leak locations. All those "Center of Triangle <gen>"-types of locations leak, which may slow down your game after some time of playing. Look at this topic: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/ at the "Dynamic Locations" part to find out how to fix this.

Lightning: You will need variable/array of type "lightning".
You will basically create lightning and then you assign that lightning into the variable/array by using the "Set variable" action. E.g.:
  • Set Lightning_var[1] = (Last Created Lightning)
(note: variable can hold only one data, if you want to save all three lightning in same variable, you will need to make it into an array)
Then, when the spell ends, you remove the lightning via the variable (you use same action as you posted for destroying lightning, but you pick the variable instead of (last created lightning).

Special Effect: This is harder. First, change the Unit Group action from "Pick every unit and do (Action)" into Pick every unit and do (Actions)". Then into the loop block put action for creating special effect and for killing unit. Also watch out, (position of *unit*) is also a location leak!
The hard part here is figuring out the special effect you use, because there are two types of special effects:
a) Effects with animations (e.g. birth, death, stand) - an example is "Curse" debuff or "Bloodlust" buff.
b) Effects without animations - these have only 1 animation. An example is Animate Dead, Dispel Magic, etc.

To find out into which category the buff belongs to, look at the preview window in your World Editor. When you choose the effect and see it in the preview window, if there are buttons for changing animations above the preview window, the effect belongs to category a). If there are no buttons, it belongs to category b).

The difference is:
For b) - you can create the effect and destroy it immediately (using the Special Effect - Destroy (last created special effect) action) and the effect will still play fully.
However if the buff is like a), then if you destroy it immediately, it also immediately disappears without playing any animation. In this case you need to save the effect into variable/array of type "Special Effect" and remove it some time later by referencing the variable instead of (last created special effect).
 
Status
Not open for further replies.
Top