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

New to Triggers Need Help

Status
Not open for further replies.
Level 1
Joined
May 28, 2011
Messages
3
Hey im trying to make a fast pace Island Defense/Vamp map and im having trouble with making an ability spawn units on the position of slain units. I used a fork lightning based ability and im trying to get it so once a unit is killed by it a unit spawns at the position of the dead unit.

Also i need help creating a blink strike that has 1 rank that deals low damage and also steals hp. It would be extremely helpful if you list the variables seperate from the triggers so that i can create them easier. The issue isn't really in the whole trigger knowledge its more the variables.
 
Level 1
Joined
May 28, 2011
Messages
3
Yeah i already tried that. It doesn't work like that for some reason...i have to make it so the trigger knows the cause of the death thats the problem.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
You will have to trigger the entire spell, or use a method that can be bugged (see below).

You cannot check all targets of the Forked Lightning spell, so it is impossible to check whether that spell has killed a unit or not.
If you cannot know when the spell killed a unit, you cannot create a unit on death.

The more simple solution would be to check when the spell is cast, turn on Trigger 2, wait 0.00 seconds and then turns it off again.
Trigger 2 activates when a unit dies and creates a unit at the dying unit's position.

It looks like this:
  • Forked Lightning Activate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Forked Lightning
    • Actions
      • Trigger - Turn on Forked Lightning Death <gen>
      • Wait 0.00 seconds
      • Trigger - Turn off Forked Lightning Death <gen>
  • Forked Lightning Death // INITIALLY OFF
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set tempLoc = (Position of (Triggering unit))
      • Unit - Create 1 Knight for (Owner of (Killing unit)) at tempLoc facing 0.00 degrees
      • Custom script: call RemoveLocation(udg_tempLoc)
However, this is prone to bugs. The "wait 0.00 seconds" does not last long, but it can be long enough to get the triggers to bug.
If a lot of units die in your map, then I suggest you redo the spell from scratch.


Edit:

Excuse me, didn't notice your second request.

  • Blink Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink Strike
    • Actions
      • Set DAMAGE = 100.00
      • Set HP_DRAIN = 0.50
      • Set tempLoc = (Position of (Target unit of ability being cast))
      • Unit - Move (Triggering unit) instantly to tempLoc
      • Custom script: call RemoveLocation(udg_tempLoc)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of (Target unit of ability being cast)) Less than DAMAGE
        • Then - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ((Life of (Target unit of ability being cast)) x HP_DRAIN))
        • Else - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (DAMAGE x HP_DRAIN))
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing DAMAGE damage of attack type Spells and damage type Normal
I left the variables there because you specifically asked for it.
I do encourage you to leave them out and change the actions accordingly though.

I used Channel as a base spell.
 
Level 1
Joined
May 28, 2011
Messages
3
Thank you ap0c, that is exactly what i needed the only thing is im having trouble trying to figure out what kind of variables DAMAGE, HP_DRAIN and TempLoc actually are.


EDIT: Nvm i figured it out lmfao
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
A good way to see which type a variable is: look at how it is used.

"Set DAMAGE = 100.00"
You can clearly see that I set this variable to a value of "100.00".
This is a number, and there are only 2 types like this: integers and reals.
Integers keep whole numbers (such as "100", or "36"), while reals keep real numbers (such as "100.08", or "6.66").
So this is a real.
Same goes for HP_DRAIN (also a real, as it is "0.50").

tempLoc is a point variable, you'll just have to remember that. I use it to clean leaks (every time you use a point without removing it, it creates a leak. Too much leaks and the game will slow down).
In JASS it's called a "location", hence the name.
 
Status
Not open for further replies.
Top