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

Spell/Trigger - Poison Trap, lighter version?

Status
Not open for further replies.
Level 6
Joined
Jan 12, 2011
Messages
110
Hello guys,

I'd like to ask you to help me with one trigger.
Let's look how does it look like at first:
sexhkg.png


What does it do?

First, whenever unit dies (Poison Trap) it saves its position and all enemy units in 250 area of the dying trap into variables. Then it creates 15 dummy units (i've got a bug, name of that dummies really isn't Cenarius, but Trap Dummy).
Then it gives them Shadow Strike abillity, strikes up to 15 enemies in area by spell ShSt (which is the same level as the dying Poison Trap - up to 10 levels), and then removes those units after 1s.
Well, it works pretty well for me, but I'm afraid of some leaks and glitches etc., so, I'd be pleased, if you could help me to shorten it, or tell me, how to improve it's current standing.


PS: I tried for hours to make loop to create all those units unsuccessfully, no unit was created (I used: For each Integer A, which should be from 1 to 15, but it created no unit.
Also, trying to add them into unit group failed (add last created unit into XXX unit group).


Thank you very much,

Donach
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
try something like this

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set Point = (Position of (Dying unit))
      • Set unitgroup = (Units within 250.00 of Point matching (((Matching player) is an enemy of (Owner of (Dying unit))) Equal to True))
      • Custom script: ---remove the point leak---
      • Unit Group - Pick every unit in unitgroup and do (Actions)
        • Loop - Actions
          • Set Point = (Position of (Picked unit))
          • Unit - Create 1 Cenarius for (Owner of (Dying unit)) at Point facing Default building facing degrees
          • Custom script: ---remove the point leak---
          • Unit - Add Shadow Strike (Neutral Hostile) to (Last created unit)
          • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Custom script: ---remove the unit group leak---
 
Level 6
Joined
Jan 12, 2011
Messages
110
try something like this

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set Point = (Position of (Dying unit))
      • Set unitgroup = (Units within 250.00 of Point matching (((Matching player) is an enemy of (Owner of (Dying unit))) Equal to True))
      • Custom script: ---remove the point leak---
      • Unit Group - Pick every unit in unitgroup and do (Actions)
        • Loop - Actions
          • Set Point = (Position of (Picked unit))
          • Unit - Create 1 Cenarius for (Owner of (Dying unit)) at Point facing Default building facing degrees
          • Custom script: ---remove the point leak---
          • Unit - Add Shadow Strike (Neutral Hostile) to (Last created unit)
          • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Custom script: ---remove the unit group leak---

Oh damn, thanks a lot man!
I've just added the simple line to update the level abillity, so it works perfect.
Thanks again.

Donach
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Actually...

If the event is "A unit dies" you can change "Owner of (Dying Unit)" for "Triggering Player".

  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units within 250.00 of Point matching (((Matching player) is an enemy of (Triggering Player)) Equal to True))
Using "Triggering Unit" is better/faster than using specific event response units (Dying Unit). Using other event responses other than "Triggering Unit" is used only for those triggers that has multiple events, involving different units. Using "Triggering Player" instead of "Owner of (Triggering Unit)" is better and faster, since it reduces the called actions by 1. (Every pair of parenteheses means an action).

(Owner of (Triggering Unit)) = 2 pairs of parentheses
(Triggering Player) = 1 pair.
 
Level 6
Joined
Jan 12, 2011
Messages
110
Actually...

If the event is "A unit dies" you can change "Owner of (Dying Unit)" for "Triggering Player".

  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units within 250.00 of Point matching (((Matching player) is an enemy of (Triggering Player)) Equal to True))
Using "Triggering Unit" is better/faster than using specific event response units (Dying Unit). Using other event responses other than "Triggering Unit" is used only for those triggers that has multiple events, involving different units. Using "Triggering Player" instead of "Owner of (Triggering Unit)" is better and faster, since it reduces the called actions by 1. (Every pair of parenteheses means an action).

(Owner of (Triggering Unit)) = 2 pairs of parentheses
(Triggering Player) = 1 pair.


Well, I didn't know that. Thanks for this, I'll have to update many triggers in my map now. :-D
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
Credits to Spinnaker and Maker too. Both taugh me that.

Forgot to say that "set bj_wantDestroyGroup = true" is faster than declaring the group, using, and destroy it later, though this way (creating-using-destroying) gives more handling over them (since decides when to destroy, and allows counting units in the group and else).
 
Status
Not open for further replies.
Top