• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Group Moving Help

Status
Not open for further replies.
Level 9
Joined
May 22, 2009
Messages
491
OK, could you show me how to make a group of units move when someone says something? I have it when they enter the region they go into unit group and a player group in case I need both and I want it where someone in that group says -enter they go into another region..... How do I do this all I need is the -enter part.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
  • Move Units
  • Events
    • Player - Player 1 (Red) types a chat message containing -enter as An exact match
    • Player - Player 2 (Blue) types a chat message containing -enter as An exact match
    • Player - Player 3 (Teal) types a chat message containing -enter as An exact match
    • Player - Player 4 (Purple) types a chat message containing -enter as An exact match
    • Player - Player 5 (Yellow) types a chat message containing -enter as An exact match
  • Conditions
  • Actions
    • Set Group = (All units owned by (Triggering Player))
    • Set Loc = [Your Location]
    • Unit Group - Pick every unit in Group and do (Actions)
      • Loop - Actions
        • Unit - Order (Picked unit) to Move To Loc
    • Custom script: call RemoveLocation(udg_Loc)
    • Custom script: call DestroyGroup(udg_Group)
Something like this? (I know you only needed the enter-part, but in case you didn't remove the leaks... :p)
 
Level 9
Joined
May 22, 2009
Messages
491
Thats OK but I need the group to move not when they say -enter their in the group their in it before I just looked and all I need is a condition player is in group. Do you know if they have that? Nevermind found this all out but thank you +rep

OK it is done but now I need help with when the boss of a level dies a unit owned by a player goes to one region other player to another region etc. 6 times like loot boxes.

bump
 
Last edited by a moderator:
Level 28
Joined
Jan 26, 2007
Messages
4,789
You didn't wait 48 hours before bumping >< (41 minutes to be exact...)

I guess you are working on an RPG, so there are a lot of bosses.
If that's the case, then set the loot-regions to a variable (with array).

Then, when the boss is defeated (a unit dies, with the condition that it's that type of unit), start a loop that sets the TempLoc to Region[Integer a] and moves hero[integer A] to that location.
After the loop, clear the location.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Nope, you need to wait 'till 48 hours after the last post :p

So, in the map init trigger (you probably have one -.-)

  • actions
    • Set Region[1] = LootRegion 1
    • Set Region[2] = LootRegion 2
    • Set Region[3] = LootRegion 3
    • Set Region[4] = LootRegion 4
  • Got bored of copy/pasting, do this for all your players -.-
When a player chooses a hero, assign a variable to that unit ("Hero[Player number)]")
Then, the boss dies-trigger:


  • Events
    • Unit - a unit dies
  • Conditions
    • Unit type of (Triggering Unit) equal to (Boss-guy)
  • Actions
    • For each Integer B from 1 to number of players do
      • Loop - actions
        • Set Loc = Center of (Region[Integer B])
        • Unit - Move Hero[Integer B] instantly to Loc[Integer B]
        • Custom script: RemoveLocation(udg_Loc[Integer B])
I have written the triggers myself, so there might be some text-mistakes, but it looks about the same as this :p

Let's see... anything I still need to explain?
Hmm... maybe you can remove all buffs from the units when the boss dies?

Ohh, I've used integer B to prevent the failure of other systems, since loops are commonly used in systems (another way is to create your own variable and make that loop, so it won't mess up other triggers).

Have fun ;)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Both of them.
Whenever you see a number (or something that resembles a number, such as "Integer B") behand a variable, it means that variable has an array.
The number must be between square brackets "[ ]", if not, it's part of the variable name ^^
Arrays can be used to make spells MPI and MUI, to set up functions like this one, basically every multiplayer map has at least 1 variable with an array.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
OK, but I dont have Move Hero blah blah blah or Set Loc center of integer b I can get the integer part but not the center of part.

You need to create 3 variables:

Variable 1:
  • Name: "Hero"
  • Type: "Unit"
  • Array: Yes

Variable 2:
  • Name: "Loc"
  • Type: "Location"
  • Array: Yes

Variable 3:
  • Name: "Region"
  • Type: "Region"
  • Array: Yes

In the trigger where a player chooses a hero, set this action:
  • Set Hero[Player Number] = (Last Created Unit)
Since I don't know which hero-system you use, this is the basic form.
If it is a tavern-system, it would be something like this:
  • Set Hero[(Player number of (Owner of (Sold unit)))] = (Sold unit)
Allright, now you've set up the variable "Hero" correctly.
Then we will set up the regions, as shown in my previous post (I believe you have no problems with that?).

Well, then we shall start on the actual trigger

We start with the loop:
Add a new action and select "For each Integer B, do multiple actions" (under the if/then/else-actions).
Set the '10' to the amount of players there are in your map.

Now the thing you had a problem with: the set loc.
Add a new action inside the loop and select "Set Variable" (above the if/then/else-actions).
As variable, choose "Loc" (which you have created before).

Normally, you would see "Set Loc[Index] = Value" (if you don't, you've messed the variable up).
Instead of the "Index", choose "Function" -> "For Loop Integer B".

For the value, choose "Center of Rect", but instead of the "Playable Map Area", set it to the variable "Region".
Yet again, you will see "Region[Index]", instead of the Index, choose "For loop Integer B" again.

Follow the same steps for the move hero-action and you should have it.

 
Level 9
Joined
May 22, 2009
Messages
491
These are my results..... And it dosent work but there is going to be only one unit per player so is there someway I could do it by moving all of players units even though there is only one?
 

Attachments

  • Start.PNG
    Start.PNG
    18.2 KB · Views: 66
  • End.PNG
    End.PNG
    17.7 KB · Views: 76
Level 28
Joined
Jan 26, 2007
Messages
4,789
Aye, you've done it wrong...
You only need 1 variable for the regions with an array, you've made 6 region variables - each with an array.
And actually: you didn't use my location-variable... so you've got leaks

For moving all units for a player it's really simple:
Set a variable unit group (yes, variables again) to "All units owned by player[Integer B]"
Then create an action:
  • Unit group - Pick every unit in Group Variable and do
    • Loop - actions
      • Unit - move (Picked unit) to Loc[1])
  • Custom script: call DestroyGroup(udg_Group)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Custom scripts are easy to use (since it's just JASS... and only the easy JASS :p).

You always start with "call"

After that comes one of these:
DestroyGroup
RemoveLocation
DestroyForce
GroupClear
ForceClear
(did I miss one?)

And after that comes:
(udg_[Variable Name])
-> User Defined Global (meaning it's a global variable, set by a user... as simple as that :p)
Everything is case sensitive :)
 
Level 9
Joined
May 22, 2009
Messages
491
OK, what that makes no sense xD How does any of this move the certain unit to a certain place? If only Twilights Eve wasnt protected xD OK, all I need is how to move a unit owned by a player in a group to a point thats it and I have it figured out :D
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Well, some day you've got to learn this, I thought this would be a good occasion -.-

  • Actions
    • Set Group = (Units in (Playable map area) owned by [Your Player])
    • Player Group - Pick every player in [Player Group] and do (Actions)
      • Loop - Actions
        • Unit Group - Pick every unit in Group and do (Actions)
          • Loop - Actions
            • Set Loc[1] = (Center of (Playable map area))
            • Unit - Pause (Picked unit)
            • Unit - Move (Picked unit) instantly to Loc[1]
            • Unit - Unpause (Picked unit)
    • Custom script: call RemoveLocation(udg_Loc)
    • Custom script: call DestroyGroup(udg_Group)
That's it?

Edit: this is for if you've already got a player group variable (which I believe you do)
 
Level 9
Joined
May 22, 2009
Messages
491
So the Loc[1] would be the loot boxes? And I agree I would like to learn this but I am in the younger group of people on here so I'm not nearly as good as some people but I am trying ;) This will sound really gay and I think its odd but I cant get Set Group = (Units in (Playable Map Area) etc. I have a player group array variable is that right kind?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Oh yeah xD I though it would be player group because we were using the players units.... OK, do I really set Loc[1] as Playable map area or the region I want?

I will not answer this one, figure it out on your own, grasshopper :D
Think logically and the answer shall be yours.

Do you want me to create full trigger actually? This was erm... the partial trigger.
If so, you need to tell me the correct answer to your question ^^ (otherwise I won't do it, so it's up to you this time :p).
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Ohh, that's even easier.

Since I don't really like learning you more, I just give the trigger :p

  • Do you think this would do? ^^
    • Events
      • Player - Player 1 (Red) types a chat message containing -exit as An exact match
      • Player - Player 2 (Blue) types a chat message containing -exit as An exact match
      • Player - Player 3 (Teal) types a chat message containing -exit as An exact match
      • Player - Player 4 (Purple) types a chat message containing -exit as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -exit as An exact match
      • Player - Player 6 (Orange) types a chat message containing -exit as An exact match
      • Player - Player 7 (Green) types a chat message containing -exit as An exact match
      • Player - Player 8 (Pink) types a chat message containing -exit as An exact match
      • Player - Player 9 (Gray) types a chat message containing -exit as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -exit as An exact match
    • Conditions
      • Boolean[(Player number of (Triggering player))] Equal to True
    • Actions
      • Set Boolean[(Player number of (Triggering player))] = False
      • Set Group = (Units in (Playable map area) owned by (Triggering player))
      • Set Loc[1] = (Center of (Playable map area))
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to Loc[1]
          • Camera - Pan camera for (Triggering player) to Loc[1] over 0.00 seconds
      • Custom script: call RemoveLocation(udg_Loc[1])
      • Custom script: call DestroyGroup(udg_Group)
p.s.: click my dragon and my egg, please ;)

Edit: forgot to mention...
Set boolean to true when you enter the loot-area.
 
Status
Not open for further replies.
Top