• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Spell - Removing Ability From Units from Unit Group

Status
Not open for further replies.
Hello and happy holidays!

Ok, I'm making some spell for my friend, its like from Diablo 2 ability from Barbarian that gives you and nearby units life and mana bonus(not regeneration)

The problem is that everything works nice, but the abilities i add by using unit group don't get removed after a period of time.

Here is the trigger

  • Battle Orders
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BO
    • Actions
      • Set TempLoc1 = (Position of (Triggering unit))
      • For each (Integer A) from 1 to 36, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at TempLoc1 facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add BO(effect) to (Last created unit)
          • Set TempLoc1_Cast = (TempLoc1 offset by 50.00 towards (10.00 x (Real((Integer A)))) degrees)
          • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm TempLoc1_Cast
          • Custom script: call RemoveLocation (udg_TempLoc1_Cast)
      • Set GroupVar = (Units within 600.00 of TempLoc1 matching ((((Owner of (Matching unit)) is an ally of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))
      • Custom script: call RemoveLocation (udg_TempLoc1)
      • Unit Group - Pick every unit in GroupVar and do (Actions)
        • Loop - Actions
          • Set UnitVarPicked = (Picked unit)
          • Unit - Add Life bonus to UnitVarPicked
          • Unit - Set level of Life bonus for UnitVarPicked to (Level of BO for (Triggering unit))
          • Unit - Add Mana Bonus to UnitVarPicked
          • Unit - Set level of Mana Bonus for UnitVarPicked to (Level of BO for (Triggering unit))
      • Custom script: call DestroyGroup (udg_GroupVar)
      • Wait 20.00 game-time seconds
      • Unit - Remove Life bonus from UnitVarPicked
      • Unit - Remove Mana Bonus from UnitVarPicked
Thanks!

-BZR-
 
Uhm... were you supposed to destroy the unit group its in....?

Your going to need another Pick Every Unit in Unitgroup and... thing.

Your bottom two lines are not located in a pick every unit in unit group. They are just on their own. :O
 
the only problem is you remove the bonus from just 1 unit cuz UnitVarPicked is a variable replaced by every unit you have ... :) so you remove
  • Custom script: call DestroyGroup (udg_GroupVar)
And place it at the end of the trigger.
Then delete
  • Unit - Remove Mana Bonus from UnitVarPicked
  • Unit - Remove Life bonus from UnitVarPicked
And after the 20 seconds wait you make this :
  • Unit Group - Pick every unit in GroupVar and do (Actions)
    • Loop - Actions
      • Set UnitVarPicked = (Picked unit)
      • Unit - Remove Life bonus from UnitVarPicked
      • Unit - Remove Life bonus from UnitVarPicked
 
Damn..now it doesn't work at all...I mean it just sets the life after 20 seconds to -100/-200/-300, there is no bonus D:

  • Battle Orders
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BO
    • Actions
      • Set UnitVarCaster = (Triggering unit)
      • Set TempLoc1 = (Position of UnitVarCaster)
      • For each (Integer A) from 1 to 36, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for (Owner of UnitVarCaster) at TempLoc1 facing Default building facing degrees
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Unit - Add BO(effect) to (Last created unit)
          • Set TempLoc1_Cast = (TempLoc1 offset by 50.00 towards (10.00 x (Real((Integer A)))) degrees)
          • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm TempLoc1_Cast
          • Custom script: call RemoveLocation (udg_TempLoc1_Cast)
      • Set GroupVar = (Units within 600.00 of TempLoc1 matching ((((Owner of (Matching unit)) is an ally of (Owner of UnitVarCaster)) Equal to True) and (((Matching unit) is alive) Equal to True)))
      • Custom script: call RemoveLocation (udg_TempLoc1)
      • Unit Group - Pick every unit in GroupVar and do (Actions)
        • Loop - Actions
          • Set UnitVarPicked = (Picked unit)
          • Unit - Set life of UnitVarPicked to ((Max life of UnitVarPicked) + (100.00 x (Real((Level of BO for UnitVarCaster)))))
          • Unit - Set mana of UnitVarPicked to ((Max mana of UnitVarPicked) + (100.00 x (Real((Level of BO for UnitVarCaster)))))
      • Wait 20.00 game-time seconds
      • Unit Group - Pick every unit in GroupVar and do (Actions)
        • Loop - Actions
          • Set UnitVarPicked = (Picked unit)
          • Unit - Set life of UnitVarPicked to ((Max life of UnitVarPicked) - (100.00 x (Real((Level of BO for UnitVarCaster)))))
          • Unit - Set mana of UnitVarPicked to ((Max mana of UnitVarPicked) - (100.00 x (Real((Level of BO for UnitVarCaster)))))
      • Custom script: call DestroyGroup (udg_GroupVar)
      • Custom script: set udg_UnitVarCaster = null
      • Custom script: set udg_UnitVarPicked = null
 
Status
Not open for further replies.
Back
Top