• 🏆 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] Spell - Removing Ability From Units from Unit Group

Status
Not open for further replies.
Level 37
Joined
Mar 5, 2008
Messages
3,887
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-
 
Level 9
Joined
Nov 28, 2008
Messages
704
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
 
Level 9
Joined
Jan 23, 2008
Messages
384
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
 
Level 37
Joined
Mar 5, 2008
Messages
3,887
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.
Top