| 07-24-2008, 02:03 AM | #1 |
First off I want to thank anyone and everyone who can help me Okay but... I will have 2 regions in my map where each of them will have 50 units... How exactly would I be able to pick out each unit of those 50 and tell each one to go to a different point in a region (the same region that their created in BTW) Basically pick every unit in region and issue order move to a random point in region... that will tell all 50 to go to that same random point... how would I make it tell each and every single one in the region to go to a random spot |
| 07-24-2008, 03:49 PM | #2 |
Does the question not make sense? |
| 07-25-2008, 01:26 PM | #3 |
bump |
| 07-25-2008, 01:39 PM | #4 |
Sorry about the slow response. Unit Group- Pick All Units in (Region) Order (Picked Unit) To Move To (Random Point within (Region)) Repeat this for the other region. Units will seem to cluster in the middle. Move to can also be replaced by Attack To, depending on your situation. Also, do not forget to apply anti-memory leak methods, if you use them. |
| 07-25-2008, 01:41 PM | #5 |
Ok, you'd need a point variable and then you'd have to set it to a random point in the region, pick all the units in the region and then order them to move to the position of the point variable. I can't access WE at the moment, so I hope someone else comes and could post the trigger. EDIT! Fucking when I'm typing... @ Triangle, that'd send them everywhere. I think he mentioned wanting them to go to the same point. |
| 07-25-2008, 02:46 PM | #6 |
Youll need to do something like: "Pick every unit in (Region) and do: Set Point = Random point in (Region) Order Picked unit to move to Point" I think that should do it, if not use: "Pick every unit in (Region) and add them to (Group) For every integer from 0 to (Number of units in (Group)) do: Remove picked unit from Group Order picked unit to move to random point in (Region)" That should do the trick. EDIT: @ tide, he wants them to go to differnet places... |
| 07-25-2008, 06:30 PM | #7 |
thank you so much gorman that's what i needed so with 1 trigger that'll tell all the units in that specific region to go to a random spot for each one of them EDIT: oh and btw how do i fix memory leaks, I actually DON"T know (or is the whole ((Set Point = Random point in (Region) then Order Picked unit to move to Point)) the anti memory leak?) |
| 07-25-2008, 08:19 PM | #8 | ||
Quote:
Quote:
For future reference, make sure you word your question exactly how you want it. People won't be as confused about what you want will be able to help you quickly. |
| 07-26-2008, 12:13 AM | #9 | |
Quote:
To fix memory leaks of point's fashion, you need to do set the point to a variable, then use the custom script command and enter. Trigger: Trigger
![]() Events
![]() Conditions
![]() Actions
![]() ![]() ----- This is how to deal with point leaks (using global points)
![]() ![]() Set YourPoint = Whatever you want...
![]() ![]() Custom Script: call RemoveLocation(udg_YourPoint)
![]() ![]() ----- You do the udg_(insert the name of your variable here)
![]() ![]() ----- e.g if it was Random, call RemoveLocation(udg_Random)
![]() ![]()
![]() ![]() ----- This is how to deal with unit group leaks (using global unit groups)
![]() ![]() Set YourGroup = Whatever you want to mess with...
![]() ![]() ----- Do a "Pick all units in group" thing, referring to the set up group
![]() ![]() Custom Script: call DestroyGroup(udg_YourGroup)
![]() ![]() ----- Again, it's just call DestroyGroup(udg_[your variable here])I don't have access to WE, but that's pretty much how it's done. Avoiding memory leaks just requires to set a point before and then referring only to that point, then removing it. Likewise with unit groups, set your unit group and then pick from it. If this doesn't make any sense, mayhaps this will make more. |
| 07-26-2008, 02:54 AM | #10 | ||
Quote:
The question makes sense. Quote:
Its not really a hard question to understand, sure he missed out a few words but its still good. I think Tide has a habbit of not fully reading questions (or so it seems) |
| 07-26-2008, 02:59 AM | #11 |
thank you tide but i wouldn't Custom Script: call RemoveLocation(udg_YourPoint) until i was done using it? |
| 07-26-2008, 10:24 PM | #12 |
Got it to work :) |
| 07-27-2008, 12:00 AM | #13 |
You don't need the "For each Integer A" if you are using a unit group. Trigger: "<Empty String" is actually "" (make the filed blank and hit enter). A unit has no order when it is "stopped" If you get that to work, I would then remove the leaks. Create a new variable called "TempPoint". The type will be a point variable (not array). Then, you want to set the random point to the TempPoint variable, order the unit to move to the TempPoint and then remove the TempPoint to clean the leak. Also, add the custom script line in front of the unit group action to make sure the game removes the group once it is done (fixes another leak). |
| 07-27-2008, 07:51 AM | #15 | |
Quote:
No, actually it wont. The reason is that Pick Every Unit in Group does the actions separately for each unit in the group. This makes the random point change as it always picks a new random point for each unit. If you all wanted all units to move to the same random point, you would have to set a point variable to the random point and then do the Pick Ever Unit in Group to that point. Are you using The Frozen Throne, or Reign of Chaos? If you are using TFT, I would highly recommend using the multiple actions version of Pick Every Unit in Group, as to clear the point leak created. |
