• 🏆 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!

Help with Player group

Status
Not open for further replies.
Level 4
Joined
Feb 17, 2014
Messages
11
Hello guys. Im new on the forum here on the forum and Iam creating one map and i need some help on my triggers, for some reasons its not working..

First
I want make a trigger where i kick all players not controlled by users. already tried

If: (Player 9 (Gray) Controller) Not equal to user
Then: Game defeat player 9 with a text message !

But its not working..
Can someone help me with this one?

Second problem
The second one is, i want make a trigger where add all players to a groupX and then change a random player from GroupX to a groupY and remove him from GroupX. Same with other groups. Can someone help me with this one guys?

Ty all in advanced :)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,206
I want make a trigger where i kick all players not controlled by users. already tried
This is not possible as only users have clients. You can defeat non-user players and probably even disable their AI but they will still exist and can still do stuff.

You might want to define what you mean by "kick" better.

The second one is, i want make a trigger where add all players to a groupX and then change a random player from GroupX to a groupY and remove him from GroupX. Same with other groups
Use a player variable as temporary storage. It can even be local (JASS only) if you want. The idea is you pick the appropriate players and add them to a group. You then pick a random player from that group and place it in the player variable. You then remove the player in the player variable from the group and add him to the other group.
 
Level 4
Joined
Feb 17, 2014
Messages
11
Thanks for the fast reply Dr. Super Good.
First question: I have on my map 12 units spawned by default on someplace of the map each unit represent one player, what i want is a trigger where i can remove theses units if they are not controlled by any player.

Second: I dont know nothing about jass :(. Can anyone Link anyplace where i can learn how to do it? or It is possible to do it by another way.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,206
First question: I have on my map 12 units spawned by default on someplace of the map each unit represent one player, what i want is a trigger where i can remove theses units if they are not controlled by any player.
Are each of the units owned by a separate player? If so then you can pick all units owned by the player who is not active and then remove the picked unit. Do remember to clean any unit group leaks since JASS (what GUI turns into) is not really garbage collected.

If they are all owned by a single player and will be randomly allocated to players after map initialization the process is only slightly more tricky. In that case you pick X random units from the group of all the units and remove the picked unit. Remember to remove the unit from the unit group before they are removed as otherwise it could leak if the unit group is used for the entire session.

Second: I dont know nothing about jass :(. Can anyone Link anyplace where i can learn how to do it? or It is possible to do it by another way.
Instead of using a local variable you can use a global variable (called Variables in GUI). The JASS method is just neater but in the end makes little difference in game (maybe +/- a few clock cycles, nothing worth even considering).
 
Level 25
Joined
May 11, 2007
Messages
4,651
Use:
If: (Player 9 (Gray) Controller) Not equal to user and Player Status of Player 9 (Gray) is EQUAL TO PLAYING = false
Then: Game defeat player 9 with a text message !

Because when a player slot is user and unused, it's not set to be a computer slot.
And you could of course fancy it up a bit more by using a player group instead of checking every player manually.
 
Level 4
Joined
Feb 17, 2014
Messages
11
Use:
If: (Player 9 (Gray) Controller) Not equal to user and Player Status of Player 9 (Gray) is EQUAL TO PLAYING = false
Then: Game defeat player 9 with a text message !

Because when a player slot is user and unused, it's not set to be a computer slot.
And you could of course fancy it up a bit more by using a player group instead of checking every player manually.

Just what i was looking for :)
Thanks man
 
Status
Not open for further replies.
Top