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

[Solved] Remove a unit from a group after x time

Status
Not open for further replies.
Level 2
Joined
Nov 22, 2016
Messages
9
  • Explosive Belt
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Bomb
    • Actions
      • Unit Group - Add (Target unit of ability being cast) to TempGroup
      • Wait 20.00 seconds
      • Unit Group - Remove (Target unit of ability being cast) from TempGroup
This doesn't work. I need to remove the unit from TempGroup once the buff applied by Bomb spell expires.
 
Level 39
Joined
Feb 27, 2007
Messages
5,024
Some event responses, like "Target Unit of ability being cast", will cease to function after waits. Others, like "Triggering unit", will work just fine. You can get around this by storing the unit in a local variable (something GUI can't do, but JASS can):
  • Explosive Belt
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Bomb
    • Actions
      • -------- This line absolutely must go first, else you will get compiler errors --------
      • Custom script: local unit TempU
      • Set YOUR_UNIT_VARIABLE = (Target unit of ability being cast)
      • -------- Don't forget the "udg_" before the name of your variable --------
      • Custom script: set TempU = udg_YOUR_UNIT_VARIABLE
      • Unit Group - Add YOUR_UNIT_VARIABLE to TempGroup
      • Wait 20.00 seconds
      • Custom script: set udg_YOUR_UNIT_VARIABLE = TempU
      • Unit Group - Remove YOUR_UNIT_VARIABLE from TempGroup
 
Status
Not open for further replies.
Top