• 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 fast help with unitgroup

Status
Not open for further replies.
Level 9
Joined
May 31, 2010
Messages
366
  • Kleine Horde
    • Ereignisse
    • Bedingungen
    • Aktionen
      • Set z = (Random integer number between 1 and 4)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • z Gleich 1
        • 'THEN'-Aktionen
          • Set AreaSpawnHorde = Horde Nord <gen>
        • 'ELSE'-Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • z Gleich 2
            • 'THEN'-Aktionen
              • Set AreaSpawnHorde = Horde Ost 1 <gen>
            • 'ELSE'-Aktionen
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • z Gleich 3
                • 'THEN'-Aktionen
                  • Set AreaSpawnHorde = Horde West <gen>
                • 'ELSE'-Aktionen
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • 'IF'-Bedingungen
                      • z Gleich 4
                    • 'THEN'-Aktionen
                      • Set AreaSpawnHorde = Horde Ost 2 <gen>
                    • 'ELSE'-Aktionen
      • Einheit - Create 10 Zombie Horde for Spieler 12 (Braun) at (Center of AreaSpawnHorde) facing (Position of (Triggering unit))
      • Set z = (Random integer number between 1 and 8)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • z Gleich 4
        • 'THEN'-Aktionen
          • Einheit - Create 1 Tank for Spieler 12 (Braun) at (Center of AreaSpawnHorde) facing (Position of (Triggering unit))
        • 'ELSE'-Aktionen
      • Einheitengruppe - Pick every unit in (Units in AreaSpawnHorde) and do (Actions)
        • Schleifen - Aktionen
          • Einheitengruppe - Add (Picked unit) to AktuelleHorde
          • Einheitengruppe - Order AktuelleHorde to Angreifen/Bewegen nach (Position of (Random unit from Helden))
this is the trigger to spawn some units, store them in a group and order them to move.
the problem is that they don't move.
the trigger will be used more than one time in the game and also there are some other trigger wich interact with the group as like adding additional units to the group later.
pls help, thx
 
U have location / point leaks and group leaks in this trigger. Those should be cleaned up.

As for the problem display through a text message the random number as it may be staying the same in testing. There is an option in WE to make it stay the same so u need to uncheck it. I believe it is in game preferences or one of those.

If that is not the case change it over to picked unit for the move order
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Try to put the last line "Einheitengruppe - Order AktuelleHorde to Angreifen/Bewegen nach (Position of (Random unit from Helden))" outside the unit group.
  • Actions
    • Unit Group - Pick every unit in (Units in AreaSpawnHorde) and do (Actions)
      • Loop - Actions
        • Unit Group - Add (Picked unit) to AktuelleHorde
    • Unit Group - Order AktuelleHorde to Move To (Position of (Random unit from Helden))
Or try this instead
  • Actions
    • Unit Group - Pick every unit in (Units in AreaSpawnHorde) and do (Actions)
      • Loop - Actions
        • Unit Group - Add (Picked unit) to AktuelleHorde
        • Unit - Order (Picked unit) to Move To (Position of (Random unit from Helden))
 
Level 9
Joined
May 31, 2010
Messages
366
the problem is that i need to redirect the units in the group and over time the units in the group will die and new units will be added to the group, and only the first group moves as the trigger says, all other groups wich will be added later are just standing at the spawn point
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
The 2nd trigger in my previous post does what you want (if I understood you correctly).
In the first line, I use unit group action "pick every unit"
In the loop the first line adds that unit to AktuelleHorde group and the second line orders that unit, which you just picked, to move to your region/point.

Also, if you're saying that the first time this trigger works, but the second time it doesn't, it may be because this aciton:
  • Unit Group - Order AktuelleHorde to Move To (Position of (Random unit from Helden))
will pick only a maximum of 12 units and orders them to move somewhere.
So if you create 10 zombies and the next time you create 10 zombies, then 8 zombies will not move to the point. That's because the second time you have 20 zombies in that group (10 zombies per use) and the action only orders a max of 12 zombies (so 20-12 => 8 zombies who stay still)
 
Level 9
Joined
May 31, 2010
Messages
366
Also, if you're saying that the first time this trigger works, but the second time it doesn't, it may be because this aciton:
  • Unit Group - Order AktuelleHorde to Move To (Position of (Random unit from Helden))
will pick only a maximum of 12 units and orders them to move somewhere.
So if you create 10 zombies and the next time you create 10 zombies, then 8 zombies will not move to the point. That's because the second time you have 20 zombies in that group (10 zombies per use) and the action only orders a max of 12 zombies (so 20-12 => 8 zombies who stay still)

THATS IT!! omg why is there such a limit? is there any other way to do what i want? except storing each unit in an array...
 
Level 9
Joined
May 31, 2010
Messages
366
but then i never can pick these units again and order them to another point

i create this group of units and want to change the target every 30 sec. (cuz the hero's are moving) also i need to add new units to that group

so i need a way to store all the units to order them to the next target

btw.: i never figured out what leaks and what don't and i propably never will xD (yes i did read the "things that leak"-thread more than 1 times)
 
whenever u use center of or position of they leak. the unit groups dont leak in ur case because u use them the whole time. u really should take the time to learn what leaks and how to fix them it is very simple.

you also have to watch ordering units every 30 seconds as it can bug up if they have a previous order. u have to wait till they stop then order them to move.

if u have other triggers tht move the units plz show them. but like i said ur problem is probably this line
  • Einheitengruppe - Order AktuelleHorde to Angreifen/Bewegen nach (Position of (Random unit from Helden))
change it to this
  • Einheitengruppe - Order (Picked unit) to Angreifen/Bewegen nach (Position of (Random unit from Helden))
u should learn about efficiency also. if u use anythiong twice or more in ur trigger put it into a temp variable and use that. it is more efficient and easier to edit.
 
Level 9
Joined
May 31, 2010
Messages
366
order picked unit will not allow me to order them a second time

every 30 sec the target of the units should be refreshed, so that they pursuite the heros

  • Horde Move
    • Ereignisse
      • Zeit - Every 30.00 seconds of game time
    • Bedingungen
    • Aktionen
      • Einheitengruppe - Order AktuelleHorde to Angreifen/Bewegen nach (Position of (Random unit from Helden))
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
THATS IT!! omg why is there such a limit? is there any other way to do what i want? except storing each unit in an array...
I don't know the reason for the limit, but you can still order all your units to do something. Just use this action
  • Actions
    • Unit Group - Pick every unit in (Units in AreaSpawnHorde) and do (Actions)
      • Loop - Actions
        • Unit Group - Add (Picked unit) to AktuelleHorde
        • Unit - Order (Picked unit) to Move To (Position of (Random unit from Helden))
in your first trigger and whenever you would need to do something with all those units in AktuelleHorde group, then use
  • Actions
    • Unit Group - Pick every unit in AktuelleHorde and do (Actions)
      • Loop - Actions
        • --- your actions here ---
And just like death wrote, you have a lot of memory leaks in that trigger (memory leaks make your map take more space in your pc while playing, resulting in lags after some time and in worst case even crash).
Look at http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/ thread - it is explained what to do in there and how to prevent/delete those leaks
 
order picked unit will not allow me to order them a second time

every 30 sec the target of the units should be refreshed, so that they pursuite the heros

what do u mean it wont allow u to order them a second time ? ive used this plenty of times and it always worked. plz show us the other trigger. as guessing is just useless in any case.
 
Level 9
Joined
May 31, 2010
Messages
366
spawn of the horde wich will repeat every 45 seconds with a chance of 33%

  • Kleine Horde
    • Ereignisse
    • Bedingungen
    • Aktionen
      • Set z = (Random integer number between 1 and 4)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • z Gleich 1
        • 'THEN'-Aktionen
          • Set AreaSpawnHorde = Horde Nord <gen>
        • 'ELSE'-Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • z Gleich 2
            • 'THEN'-Aktionen
              • Set AreaSpawnHorde = Horde Ost 1 <gen>
            • 'ELSE'-Aktionen
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • z Gleich 3
                • 'THEN'-Aktionen
                  • Set AreaSpawnHorde = Horde West <gen>
                • 'ELSE'-Aktionen
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • 'IF'-Bedingungen
                      • z Gleich 4
                    • 'THEN'-Aktionen
                      • Set AreaSpawnHorde = Horde Ost 2 <gen>
                    • 'ELSE'-Aktionen
      • Einheit - Create 10 Zombie Horde for Spieler 12 (Braun) at (Center of AreaSpawnHorde) facing (Position of (Triggering unit))
      • Set z = (Random integer number between 1 and 8)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • z Gleich 4
        • 'THEN'-Aktionen
          • Einheit - Create 1 Tank for Spieler 12 (Braun) at (Center of AreaSpawnHorde) facing (Position of (Triggering unit))
        • 'ELSE'-Aktionen
      • Einheitengruppe - Pick every unit in (Units in AreaSpawnHorde) and do (Actions)
        • Schleifen - Aktionen
          • Einheitengruppe - Add (Picked unit) to AktuelleHorde
          • Einheitengruppe - Order AktuelleHorde to Angreifen/Bewegen nach (Position of (Random unit from Helden))
this will add more units over time if they don't get killed

  • Ereignisse
    • Horde Move
      • Ereignisse
        • Zeit - Every 30.00 seconds of game time
      • Bedingungen
      • Aktionen
        • Einheitengruppe - Order AktuelleHorde to Angreifen/Bewegen nach (Position of (Random unit from Helden))
this will refresh the target position every 30 seconds of all units wich are in the group

and now the problem is that it don't work this way cuz the group has a cap
 
what do u mean the group has a cap ? and change this in ur first trigger
  • Einheitengruppe - Pick every unit in (Units in AreaSpawnHorde) and do (Actions)
    • Schleifen - Aktionen
      • Einheitengruppe - Add (Picked unit) to AktuelleHorde
      • Einheitengruppe - Order AktuelleHorde to Angreifen/Bewegen nach (Position of (Random unit from Helden))
to this
  • Set tempPoint = (Position of (Random unit from Helden))
  • Set tempGroup = (Units in AreaSpawnHorde)
  • Unit Group - Add all units of tempGroup to AktuelleHorde
  • Einheitengruppe - Pick every unit in tempGroup and do (Actions)
    • Schleifen - Aktionen
      • Set tempUnit = (Picked unit)
      • Einheitengruppe - Add tempUnit to AktuelleHorde
      • Einheitengruppe - Order tempUnit to Angreifen/Bewegen nach tempPoint
      • Unit Group - Remove tempUnit from tempGroup
      • Set tempUnit = No unit
  • Custom script: call RemoveLocation( udg_tempPoint)
  • Custom script: set udg_tempPoint = null
  • Custom script: call DestroyGroup( udg_tempGroup)
  • Custom script: set udg_tempGroup = null
change this
  • Ereignisse
    • Horde Move
      • Ereignisse
        • Zeit - Every 30.00 seconds of game time
      • Bedingungen
      • Aktionen
        • Einheitengruppe - Order AktuelleHorde to Angreifen/Bewegen nach (Position of (Random unit from Helden))
to this
  • Ereignisse
    • Horde Move
      • Ereignisse
        • Zeit - Every 30.00 seconds of game time
      • Bedingungen
      • Aktionen
        • Set tempPoint = (Position of (Random unit from Helden))
        • Einheitengruppe - Pick every unit in AktuelleHorde and do (Actions)
          • Schleifen - Aktionen
            • Einheitengruppe - Order (Picked unit) to Angreifen/Bewegen nach tempPoint
        • Custom script: call RemoveLocation( udg_tempPoint)
        • Custom script: set udg_tempPoint = null
this should clear up ur problem and clean up ur leaks plz pay attention to how i did the leak removal so u know wat to do.
 
Level 9
Joined
May 31, 2010
Messages
366
jep but i cant find a better way than store each created unit in an array to pick them later as i can with unit group, pick in area does exactly what i want but even they moved away from the spawn i can not pick them again to move them to another point so i need to store them in a thing like a unit group but without a cap
 
Death, the problem is that the action "Unit Group - Issue order targeting a point" has a cap for 12 units, while "Pick every unit" action has no cap. He uses the first one and because of that has problems


look at the one i gave him to change to it uses pick every unit not the other one.

jep but i cant find a better way than store each created unit in an array to pick them later as i can with unit group, pick in area does exactly what i want but even they moved away from the spawn i can not pick them again to move them to another point so i need to store them in a thing like a unit group but without a cap

the thing i posted will solve this change it then get back to us
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
jep but i cant find a better way than store each created unit in an array to pick them later as i can with unit group, pick in area does exactly what i want but even they moved away from the spawn i can not pick them again to move them to another point so i need to store them in a thing like a unit group but without a cap
There is a better way - the one death used in his triggers for you.

TRIGGER #1
  • Unit Group - Order UnitGroup to Move To (Center of "Region")
The action above loops through each unit in UnitGroup and orders that unit to move to center of some region.

TRIGGER #2
  • Unit Group - Pick every unit in UnitGroup and do (Actions)
    • Loop - Actions
      • Unit - Order (Picked unit) to Move To (Center of "Region")
This loops through each unit in UnitGroup and orders certain actions - in this case, it orders the unit currently picked from the UnitGroup to go to center of region.

The differences between Trigger #1 and #2
#1
+ is easier to set up
- has cap for 12 unit
- can only order 1 action

#2
+ has no cap
+ can order a lot more actions
- is a bit longer and requires a bit more of manual set up


EDIT:
Yeah death, I know you used the correct action. I was writing that post when you didn't post the trigger yet.
 
There is a better way - the one death used in his triggers for you.

TRIGGER #1
  • Unit Group - Order UnitGroup to Move To (Center of "Region")
The action above loops through each unit in UnitGroup and orders that unit to move to center of some region.

TRIGGER #2
  • Unit Group - Pick every unit in UnitGroup and do (Actions)
    • Loop - Actions
      • Unit - Order (Picked unit) to Move To (Center of "Region")
This loops through each unit in UnitGroup and orders certain actions - in this case, it orders the unit currently picked from the UnitGroup to go to center of region.

The differences between Trigger #1 and #2
#1
+ is easier to set up
- has cap for 12 unit
- can only order 1 action

#2
+ has no cap
+ can order a lot more actions
- is a bit longer and requires a bit more of manual set up


EDIT:
Yeah death, I know you used the correct action. I was writing that post when you didn't post the trigger yet.

ok lol
 
Status
Not open for further replies.
Top