• 🏆 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] Need help--- Delete Last created units

Status
Not open for further replies.
Level 2
Joined
Aug 24, 2011
Messages
13
how i can delete last created units?
here triggers :
  • first
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Death Coil
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Set tmn_place = (Target unit of ability being cast)
        • Else - Actions
      • Unit - Create 5 Serpent Ward (Level 1) for (Owner of (Triggering unit)) at (Position of tmn_place) facing Default building facing degrees
      • Wait 5.00 seconds
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Your trigger leaks location. If/then/else if not needed. Replace (Owner of (Triggering unit)) with (Triggering player) and 'Begins casting an ability' with 'Starts effect of ability'. tmn_place unit variable is completely useless. Adding expiration timer to last created unit can help you archieve the 5sec delay before killing unit.

Fixed trigger:
  • first
    • Events
      • Unit - A unit Starts effect of ability
    • Conditions
      • (Ability being cast) Equal to Death Coil
    • Actions
      • Set point = (Position of (Target unit of ability being cast))
      • Unit - Create 5 Serpent Ward (Level 1) for (Triggering player) at point facing Default building facing degrees
      • Unit - Add 5.00 second exipiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_point)
 
Level 2
Joined
Aug 24, 2011
Messages
13
have problem World editor Gives me an Erorr with this
  • first
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Death Coil
    • Actions
      • Set Point = (Position of (Target unit of ability being cast))
      • Unit - Create 5 Serpent Ward (Level 1) for (Triggering player) at Point facing Default building facing degrees
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_point)
Custom Script has problem?:vw_wtf:
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
You should have told me ealier that such issue occured. I haven't noticed that you are creating 5 units at once.

  • first
    • Events
      • Unit - A unit Starts effect of ability
    • Conditions
      • (Ability being cast) Equal to Death Coil
    • Actions
      • Set point = (Position of (Target unit of ability being cast))
      • For each (Integer i) from 1 to 5 do Actions
        • Loop - Actions
          • Unit - Create 1 Serpent Ward (Level 1) for (Triggering player) at point facing Default building facing degrees
          • Unit - Add 5.00 second exipiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_point)
Where 'i' is global integer non array variable.
 
Status
Not open for further replies.
Top