| 02-17-2004, 07:17 PM | #1 |
I have got a variable number of players ranging from 1 to 12. They need to be put into teams. I have got a variable number of teams that need a variable number of player to be put in it. The players cannot be put into 2 teams so the player of all teams together equals the number of players. I need a coding block that tries all possible combinations of teams. I already have some ideas and a partial solution: You need to have 12 For next loops within each other; their variable (normally Integer A) will be an integer array of which each index (ranging from 1 to the number of players) represents a spot within a team to which a player can be set to and of which the worth represent a player number; every time a loop is run the loop checks whether the player the loops's variable's value currently directs to has already been given a spot within a team, if not it runs the next loop until all the spots within teams have been dealt with. Now this method does work.., but it has a disadvantage: It gives out multiple of the the same teams that only differ in the order in which the players are in the team. It does not only give out the team: player 1,2,3,4 , but also the team: 2,3,4,1 and 3,4,1,2 and so on... This is nót what I want. If anyone followed my explanation, I would gladly appreciate any help you can give me;) I would be reaaaally thankful:), Remy. |
| 02-17-2004, 07:25 PM | #2 |
can you rephrase your problem into 1 sentence? |
| 02-17-2004, 07:37 PM | #3 |
I should file a complaint against you to one of the moderators you know:P |
| 02-17-2004, 07:49 PM | #4 |
LOL. I have to ask, what are you trying to do with this math? Perhaps understanding what you want to accomplish will help with coming up with an answer. how many teams do you want? Do you want them randomly set up? why do you need to try every combination of team? I would think that you could just use a simple algebraic formula to do this. Is there a specific number of players you want in a team? 2 members per team? 3? Or do you want all? |
| 02-17-2004, 08:02 PM | #5 |
Edited by Cubasis in cause of flames: (And this wasn't reported). But i agree with the 2 other people here... You should try to reword your problem/question, as the main Q (1'st paragraph) is quite hard to understand. |
| 02-17-2004, 08:21 PM | #6 |
Yeah I think it would be easier if you explain what the final result should be, rather than how your trying to achieve that result. And how do you put 1 player into teams? |
| 02-18-2004, 01:52 PM | #7 |
He already explained what he wants to do, he wants custom teams to be possible for his custom map like in Vexorian Hero Arena. What I did was kinda like this: you need: An integer variable, TeamN An integer array: PlayerTeam[] A player group array: Team[] Map initialization For each integer a from 1 to 12 ---Set TeamN=0 ---(If Convert index to Player (integer A) slot status equal to is playing) and PlayerTeam[integer A] equal to 0 then -------Set TeamN=TeamN+1 -------Set PlayerTeam[integer A]=TeamN -------player group - Add Convert index to Player (integer A) to Team[TeamN] -------Player Group - Pick every player in (all allies of (Convert index to Player (integer A)) ) and do actions: ----------------Set PlayerTeam[player number of Picked Player]=TeamN ----------------player group - Add Picked Player to Team[TeamN] After that trigger: You can use PlayerTeam[ player number of player] to know his team number, TeamN to know the total number of teams and Team[team number] to get a team That was the first version of my trigger that recognizes the teams, I found a better way later that kept the team numbers and the order, but I can't currently remember it. |
| 02-18-2004, 02:50 PM | #8 |
Hmm I didn't explain quite well enough.. Let me refrase:): I am trying to make a system which lets players choose their allies in-game. I need this because my map also lets players vote for the number of forces so you cannot pick your allies before the game. It's a maximum of 4forces Aos and players need to vote whether to play with 2-,3-, or 4forces, after that they need to vote for whom they want to team up with. Then I need to calculate which combination of teams gets as much satisfaction. I already tried to find out a system to find out which combination of teams gives the most satisfaction but I concluded there is no system and the only way to do it is to try all possible combinations of teams and compare their satisfactory rates and then pick the one with the best rate. I already now how to compare the satisfactory rates, I just need a block of code that tries out all possible combinations of teams and runs my trigger after creating a new combination. Everyone still follow me?;) |
| 02-18-2004, 02:54 PM | #9 |
If they choose the allies in game, just add them to their forces after they use the option you gave to join the force |
| 02-18-2004, 02:54 PM | #10 | |
Quote:
Ah.. comeone dexll.. don't take this so hard, I was just joking. I won't file you to anyone and you know that;) Or are you saying you made a serieus post? |
| 02-18-2004, 02:55 PM | #11 |
Or you can disable fixed player settings from your map and use my trigger -) Edit: Or you can use that trigger after the moment the players select their allies |
| 02-18-2004, 03:50 PM | #12 | |
Quote:
It's not that simpel, I don't think you understand my problem, if I do as you explained then this problem will occur: Suppose there are 8players; they want to have 4forces; so 2players per force. Suppose everyone votes to be in a team with player1, now we've got a problem. I can't just add all of them in a team with player1. |
| 02-18-2004, 04:46 PM | #13 |
Appology accepted. Yeah my post was serious. Your original post was kind of all over the place, I wanted to see if you could put it into concise sentence so i could understand and help you. Seems like i wasnt the only one who didn't know exactly what you wanted. No hard feelings. I'll reread your post to see if you still need help. |
