• 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.

Unit Group Help

Status
Not open for further replies.
Level 2
Joined
May 11, 2007
Messages
24
Alright, I've searched for all the actions I can think of to create a specific units group. I want to select all units except the triggering unit to be put into a unit group so I can 'freeze' all units except for the caster of my spell, 'Time Stop'.

So far I've been unable to find the proper unit group command to do this. Anybody know of a way to select all the units on the map except one? Perhaps I can create one unit group that contains the triggering unit only, and another unit group that contains all the units on the map, then subtract one unit group from the other?

Don't know it's late, but help would be great :)

Thanks in advance, Lash.
 
Level 4
Joined
Jul 30, 2007
Messages
79
As promised:
  • Untitled Trigger 001
    • Events
      • Unit - A unit enters <Your Region>
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to (Picked unit)
            • Then - Actions
              • Do nothing
            • Else - Actions
              • Unit - Pause (Picked unit)
re reading your post it seems you are casting a spell but it still works the same just change region to finishes casting and change all references of triggering unit to casting unit
 
Level 9
Joined
Jul 27, 2006
Messages
652
This would be faster and leak free,
Firstly set the variable freeze to Units in(Playable map area)
Then remove the triggering unit from that group.
Then loop your actions for the unit group freeze.
Sorry I dont have a trigger for you, but this should be easy enough.
- Hope this helps
 
Level 2
Joined
May 11, 2007
Messages
24
Thanks for your help. Using your advice, I came up with this:

  • Time Stop
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Time Stop
    • Actions
      • Set Timestop = (Units in (Playable map area))
      • Unit Group - Remove (Casting unit) from Timestop
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Time Stop for (Casting unit)) Equal to 1
        • Then - Actions
          • Unit Group - Pick every unit in Timestop and do (Unit - Pause (Picked unit))
          • Wait 5.00 game-time seconds
          • Unit Group - Pick every unit in Timestop and do (Unit - Unpause (Picked unit))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Time Stop for (Casting unit)) Equal to 2
        • Then - Actions
          • Unit Group - Pick every unit in Timestop and do (Unit - Pause (Picked unit))
          • Wait 6.00 game-time seconds
          • Unit Group - Pick every unit in Timestop and do (Unit - Unpause (Picked unit))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Time Stop for (Casting unit)) Equal to 3
        • Then - Actions
          • Unit Group - Pick every unit in Timestop and do (Unit - Pause (Picked unit))
          • Wait 7.00 game-time seconds
          • Unit Group - Pick every unit in Timestop and do (Unit - Unpause (Picked unit))
        • Else - Actions
Alright so for some reason my spell doesn't appear to be working, I don't know why, but it appears to be ineffective in pausing all the units

Alright, I fixed it. I had based the spell off of war stomp before, but I already had another ability on this hero based off War Stomp, and using one would activate the other, so I was forced to change the ability to A Thunderclap base. Now, obviously this made the condition ineffective, but it didn't change the 'Time Stop' in the integer comparisons to 'UnknownA00B' so I didn't notice it right away until I clicked on the trigger.

I do have one last question though. The pause unit command does stop all units from attacking and moving, however, I was wondering if it's possible with another command or ability to actually freeze units mid animation? As it is units still play their stand animations while paused, and it doesn't really look to me like time is stopped. Any ideas?
 
Last edited:
Level 9
Joined
Jul 27, 2006
Messages
652
Two things:

Get rid of those ifs by using (4 + Level of Time Stop...) in your wait, it'll be faster.
To stop animations use Change Unit Animation Speed to set the animation speed to 0%.
Glad I could help and I hope your spell works after this...
 
Level 9
Joined
Jun 26, 2005
Messages
511
if you dont wanna have to wait, you can create a dummy unit at the center of target of ability being cast that has a perma immoation spell that has no damage, and has the area of your timestop skill, then edit the buff, and make a trigger if unit has buff pause unit, then if unit has buff equal to flase then do unpause. and you can set the level of the immoation of dmmy unit to level1 = 5seconds level2 = 6seconds level3 = 7seconds, i recommand you use phoenix has a dummy unit for this, cuz phoenix has a -25 degen, so you set the hp to 250, and the unit will last 10seconds, you dont have to make trigger to remove it or whatever.
 
Level 2
Joined
May 11, 2007
Messages
24
Alright, I tried the following trigger:

  • Time Stop
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Time Stop
    • Actions
      • Set Timestop = (Units in (Playable map area))
      • Unit Group - Remove (Casting unit) from Timestop
      • Unit Group - Pick every unit in Timestop and do (Actions)
        • Loop - Actions
          • Unit - Pause (Picked unit)
          • Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
          • Wait (4.00 + (Real((Level of Time Stop for (Casting unit))))) game-time seconds
          • Unit - Unpause (Picked unit)
          • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
          • Unit Group - Remove (Picked unit) from Timestop
Which seems to me like it should work, but it's stopping all the units, and they're never unstopping. Also, I think keeping a Unitgroup up is a leak... but I don't know the command to destroy it if there is one, any help?

The only thing I can think of is a problem with the Integer to Real with the Level of Ability - Timestop, but I don't see any other way to do it.
 
Level 4
Joined
Jul 30, 2007
Messages
79
  • Unit - Unpause (Picked unit)
this is you glitch
you have a wait in between this and the further actions within the pick

try this ( i am not sure if this is exact but more what you are looking for at least )

  • Events
  • Unit - A unit Begins casting an ability
  • Conditions
    • (Ability being cast) Equal to Time Stop
  • Actions
    • Set Timestop = (Units in (Playable map area))
    • Unit Group - Remove (Casting unit) from Timestop
    • Unit Group - Pick every unit in Timestop and do (Actions)
      • Loop - Actions
        • Unit - Pause (Picked unit)
        • Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
    • Wait (4.00 + (Real((Level of Time Stop for (Casting unit))))) game-time seconds
    • Unit Group - Pick every unit in Timestop and do (Actions)
      • Loop - Actions
        • Unit - Unpause (Picked unit)
        • Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
    • Custom script: call DestroyGroup(udg_Timestop)
now i am not real sure on the nature of the Custom script: call DestroyGroup(udg_Timestop) script as i just learned about leaks recently but i think it will actually destroy it and make it unuseable for the remainder of the map
if this is true simply using the variable will be the best method as far as i know
 
Level 2
Joined
May 11, 2007
Messages
24
Excellent, thank you both for your help :) +rep for both of you.

Oh, I do have one last question. Is it better to use call DestroyGroup, as I do need the variable for the whole map, or does it fix the memory leak by just Removing the picked unit from the Unitgroup at the end of it so after the trigger ends Timestop will = 0, or null?

Thanks again :)
 
Level 4
Joined
Jul 30, 2007
Messages
79
like i said i am not 100% sure if the script will make it unusable

they way to test it would be run it with the script once and then try it on the same map again
if the second one works its fine and you have no leaks
if the second one doesn't work you have destroyed the variable and it will not function
in that case i would just remove the script and leave it as you already have the variable and as such i think you are only leaking 1 group no matter how many times you do the spell
removing the units wont do anything to my knowledge


I may be wrong and would love to know if i am
 
Level 9
Joined
Jul 27, 2006
Messages
652
As long as you use set when adding units to the group its fine to destroy it.
If you used add unit to unit group it wouldn't work because there would be no group because it would have been destroyed, that is why you use set udg_TimeStop because it recreates the group. You can add units once you've recreated the group...
 
Status
Not open for further replies.
Top