• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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
 
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:
 
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