Results 1 to 8 of 8
  1. #1
    Banned
    Join Date
    May 2011
    Posts
    917
    Points
    1,182
         User Info     Contact     Gamer ID
    Join Date
    May 2011
    Posts
    917
    Points
    1,182

    Default [RELEASE] Balance teams perfectly SOTM entry

    Code:
    AssignTeam()
    {
    	self [[level.spectator]]();
    	if( level.playerCount["spectator"] == 2 )
    	{
    		self thread MakeAMatch( 1 );
    	}
    	else if( level.playerCount["spectator"] == 4 )
    	{
    		self thread MakeAMatch( 2, 2 );
    	}
    	else if( level.playerCount["spectator"] == 6 )
    	{
    		self thread MakeAMatch( 3, 3 );
    	}
    	else if( level.playerCount["spectator"] == 8 )
    	{
    		self thread MakeAMatch( 4, 4 );
    	}
    	else if( level.playerCount["spectator"] == 10 )
    	{
    		self thread MakeAMatch( 5, 5 );
    	}
            else if( level.playerCount["spectator"] == 12 )
            {
                    self thread MakeAMatch( 6, 6 );
            }
    }
    
    
    MakeAMatch( Number, howMany )
    {
    	switch( Number )
    	{
    		case 1:
    			for( i = 0; i < level.players.size; i++ )
    			{
    				level.players[i] [[level.spectator]]();
    				if( self isHost() == true )
    				{
    					self [[level.allies]]();
    				}
    				else if( self.pers["team"] == "spectator" )
    				{
    					1v1 = randomIntRange( 0, level.players.size );
    					level.players[1v1] suicide();
    					level.players[1v1] [[level.axis]]();
    					if( level.playerCount["allies"] == 1 && level.playerCount["axis"] == 1 )
    					{
    						self notify( "EvenCountStart" );
    					}
    					self waittill( "EvenCountStart" );
    					{
    						numberPlayers = level.playerCount["spectator"];
    						for( g = 0; g < numberPlayers; g++ )
    						{
    							kick( self getEntityNumber() );
    						}
    					}
    				}
    			}
    			break;
    		case 2:
    			for( i = 0; i < level.players.size; i++ )
    			{
    				level.players[i] [[level.spectator]]();
    				if( self isHost() == true )
    				{
    					self [[level.allies]]();
    				}
    				else if( self.pers["team"] == "spectator" )
    				{
    					2v2 = randomIntRange( 0, level.players.size );
    					level.players[2v2] suicide();
    					level.players[2v2] [[level.allies]]();
    					for( h = 0; h < howMany; h++ )
    					{
    						2v2Axis[h] = randomIntRange( 0, level.players.size );
    						level.players[2v2Axis[h]] suicide();
    						level.players[2v2Axis[h]] [[level.axis]]();
    					}
    					if( level.playerCount["allies"] == 2 && level.playerCount["axis"] == 2 )
    					{
    						self notify( "EvenCountStart" );
    					}
    					self waittill( "EvenCountStart" );
    					{
    						if( self.pers["team"] == "spectator" )
    						{
    							numberPlayers = level.playerCount["spectator"];
    							for( g = 0; g < numberPlayers; g++ )
    							{
    								kick( self getEntityNumber() );
    							}
    						}
    					}
    				}
    			}
    			break;
    		case 3:
    			for( i = 0; i < level.players.size; i++ )
    			{
    				level.players[i] [[level.spectator]]();
    				if( self isHost() == true )
    				{
    					self [[level.allies]]();
    				}
    				else if( self.pers["team"] == "spectator" )
    				{
    					for( k = 0; k < 2; k++ )
    					{
    						3v3[k] = randomIntRange( 0, level.players.size );
    						level.players[3v3[k]] suicide();
    						level.players[3v3[k]] [[level.allies]]();
    					}
    					for( h = 0; h < howMany; h++ )
    					{
    						3v3Axis[h] = randomIntRange( 0, level.players.size );
    						level.players[3v3Axis[h]] suicide();
    						level.players[3v3Axis[h]] [[level.axis]]();
    					}
    					if( level.playerCount["allies"] == 3 && level.playerCount["axis"] == 3 )
    					{
    						self notify( "EvenCountStart" );
    					}
    					self waittill( "EvenCountStart" );
    					{
    						if( self.pers["team"] == "spectator" )
    						{
    							numberPlayers = level.playerCount["spectator"];
    							for( g = 0; g < numberPlayers; g++ )
    							{
    								kick( self getEntityNumber() );
    							}
    						}
    					}
    				}
    			}
    			break;
    		case 4:
    			for( i = 0; i < level.players.size; i++ )
    			{
    				level.players[i] [[level.spectator]]();
    				if( self isHost() == true )
    				{
    					self [[level.allies]]();
    				}
    				else if( self.pers["team"] == "spectator" )
    				{
    					for( k = 0; k < 3; k++ )
    					{
    						4v4[k] = randomIntRange( 0, level.players.size );
    						level.players[4v4[k]] suicide();
    						level.players[4v4[k]] [[level.allies]]();
    					}
    					for( h = 0; h < howMany; h++ )
    					{
    						4v4Axis[h] = randomIntRange( 0, level.players.size );
    						level.players[4v4Axis[h]] suicide();
    						level.players[4v4Axis[h]] [[level.axis]]();
    					}
    					if( level.playerCount["allies"] == 4 && level.playerCount["axis"] == 4 )
    					{
    						self notify( "EvenCountStart" );
    					}
    					self waittill( "EvenCountStart" );
    					{
    						if( self.pers["team"] == "spectator" )
    						{
    							numberPlayers = level.playerCount["spectator"];
    							for( g = 0; g < numberPlayers; g++ )
    							{
    								kick( self getEntityNumber() );
    							}
    						}
    					}
    				}
    			}
    			break;
    		case 5:
    			for( i = 0; i < level.players.size; i++ )
    			{
    				level.players[i] [[level.spectator]]();
    				if( self isHost() == true )
    				{
    					self [[level.allies]]();
    				}
    				else if( self.pers["team"] == "spectator" )
    				{
    					for( k = 0; k < 4; k++ )
    					{
    						5v5[k] = randomIntRange( 0, level.players.size );
    						level.players[5v5[k]] suicide();
    						level.players[5v5[k]] [[level.allies]]();
    					}
    					for( h = 0; h < howMany; h++ )
    					{
    						5v5Axis[h] = randomIntRange( 0, level.players.size );
    						level.players[5v5Axis[h]] suicide();
    						level.players[5v5Axis[h]] [[level.axis]]();
    					}
    					if( level.playerCount["allies"] == 5 && level.playerCount["axis"] == 5 )
    					{
    						self notify( "EvenCountStart" );
    					}
    					self waittill( "EvenCountStart" );
    					{
    						if( self.pers["team"] == "spectator" )
    						{
    							numberPlayers = level.playerCount["spectator"];
    							for( g = 0; g < numberPlayers; g++ )
    							{
    								kick( self getEntityNumber() );
    							}
    						}
    					}
    				}
    			}
    		break;
                    case 6:
    			for( i = 0; i < level.players.size; i++ )
    			{
    				level.players[i] [[level.spectator]]();
    				if( self isHost() == true )
    				{
    					self [[level.allies]]();
    				}
    				else if( self.pers["team"] == "spectator" )
    				{
    					for( k = 0; k < 5; k++ )
    					{
    						6v6[k] = randomIntRange( 0, level.players.size );
    						level.players[6v6[k]] suicide();
    						level.players[6v6[k]] [[level.allies]]();
    					}
    					for( h = 0; h < howMany; h++ )
    					{
    						6v6Axis[h] = randomIntRange( 0, level.players.size );
    						level.players[6v6Axis[h]] suicide();
    						level.players[6v6Axis[h]] [[level.axis]]();
    					}
    					if( level.playerCount["allies"] == 5 && level.playerCount["axis"] == 5 )
    					{
    						self notify( "EvenCountStart" );
    					}
    					self waittill( "EvenCountStart" );
    					{
    						if( self.pers["team"] == "spectator" )
    						{
    							numberPlayers = level.playerCount["spectator"];
    							for( g = 0; g < numberPlayers; g++ )
    							{
    								kick( self getEntityNumber() );
    							}
    						}
    					}
    				}
    			}
    		break;
    	}
    }
    Shorter version( thanks Haxzing.. )
    Code:
    BalanceTeam()
    {
    	self [[level.axis]])();
    	if( level.playerCount["axis"] == 12 )
    	{
    		for( h = 0; h < 6; h++ )
    		{
    			Assign[h] = randomIntRange( 0, level.players.size );
    			level.players[Assign[h]] suicide();
    			level.players[Assign[h]] [[level.allies]]();
    		}
    	}
    	else if( level.playerCount["axis"] == 10 )
    	{
    		for( h = 0; h < 5; h++ )
    		{
    			Assign[h] = randomIntRange( 0, level.players.size );
    			level.players[Assign[h]] suicide();
    			level.players[Assign[h]] [[level.allies]]();
    		}
    	}
    	else if( level.playerCount["axis"] == 8 )
    	{
    		for( h = 0; h < 4; h++ )
    		{
    			Assign[h] = randomIntRange( 0, level.players.size );
    			level.players[Assign[h]] suicide();
    			level.players[Assign[h]] [[level.allies]]();
    			
    		}
    	}
    	else if( level.playerCount["axis"] == 6 )
    	{
    		for( h = 0; h < 3; h++ )
    		{
    			Assign[h] = randomIntRange( 0, level.players.size );
    			level.players[Assign[h]] suicide();
    			level.players[Assign[h]] [[level.allies]]();
    		}
    	}
    	else if( level.playerCount["axis"] == 4 )
    	{
    		for( h = 0; h < 2; h++ )
    		{
    			Assign[h] = randomIntRange( 0, level.players.size );
    			level.players[Assign[h]] suicide();
    			level.players[Assign[h]] [[level.allies]]();
    		}
    	}
    	else if( level.playerCount["axis"] == 2 )
    	{
    		Assign = randomIntRange( 0, level.players.size );
    		level.players[Assign] suicide();
    		level.players[Assign] [[level.allies]]();
    	}
    }
    Comment if you like it

    0 Not allowed! Not allowed!
    Last edited by MorderVonJuden; 06-20-2012 at 09:48 AM. Reason: Added shorter version

  2. #2
    Tig O Bitties
    Grey's Avatar
    Join Date
    May 2011
    Location
    Candy Mountain
    Posts
    2,935
    Points
    2,964
         User Info     Contact     Gamer ID
    Join Date
    May 2011
    Location
    Candy Mountain
    Posts
    2,935
    Points
    2,964

    Contact info:

    Youtube Channel: http://www.youtube.com/l3g3darymods

    Default

    no comment

    0 Not allowed! Not allowed!

  3. #3
    Notorious B.I.G
    http://xat.com/cleaker
    Goober.'s Avatar
    Join Date
    Dec 2011
    Location
    A Safe Haven
    Posts
    6,713
    Points
    10,699
         User Info     Contact     Gamer ID
    Join Date
    Dec 2011
    Location
    A Safe Haven
    Posts
    6,713
    Points
    10,699

    Contact info:

    Youtube Channel: http://www.youtube.com/user/Goober1337FX?feature=mhee

    Default

    AssignTeam()
    {
    self [[level.spectator]]();
    if( level.playerCount["spectator"] == 2 )
    {
    self thread MakeAMatch( 1 )
    }
    else if( level.playerCount["spectator"] == 4 )
    {
    self thread MakeAMatch( 2, 2 )
    }
    else if( level.playerCount["spectator"] == 6 )
    {
    self thread MakeAMatch( 3, 3 )
    }
    else if( level.playerCount["spectator"] == 8 )
    {
    self thread MakeAMatch( 4, 4 )
    }
    else if( level.playerCount["spectator"] == 10 )
    {
    self thread MakeAMatch( 5, 5 )
    }
    else if( level.playerCount["spectator"] == 12 )
    {
    self thread MakeAMatch( 6, 6 )
    }

    }

    could you add that for 6v6...Idk much about modding but cool

    0 Not allowed! Not allowed!

  4. #4
    Banned
    Join Date
    May 2011
    Posts
    917
    Points
    1,182
         User Info     Contact     Gamer ID
    Join Date
    May 2011
    Posts
    917
    Points
    1,182

    Default

    and you can't say shit about me already making it! I changed the coding and the idea C: plus I think it'll be a great thing to use in a gametype.

    0 Not allowed! Not allowed!

  5. #5
    Banned
    Join Date
    May 2011
    Posts
    917
    Points
    1,182
         User Info     Contact     Gamer ID
    Join Date
    May 2011
    Posts
    917
    Points
    1,182

    Default

    You'd have to run a code to allow 6 players in a lobby but yes you could. but thats not all you'd have to do here I will add it:
    Code:
    AssignTeam()
    {
    	self [[level.spectator]]();
    	if( level.playerCount["spectator"] == 2 )
    	{
    		self thread MakeAMatch( 1 );
    	}
    	else if( level.playerCount["spectator"] == 4 )
    	{
    		self thread MakeAMatch( 2, 2 );
    	}
    	else if( level.playerCount["spectator"] == 6 )
    	{
    		self thread MakeAMatch( 3, 3 );
    	}
    	else if( level.playerCount["spectator"] == 8 )
    	{
    		self thread MakeAMatch( 4, 4 );
    	}
    	else if( level.playerCount["spectator"] == 10 )
    	{
    		self thread MakeAMatch( 5, 5 );
    	}
            else if( level.playerCount["spectator"] == 12 )
            {
                    self thread MakeAMatch( 6, 6 );
            }
    }
    
    
    MakeAMatch( Number, howMany )
    {
    	switch( Number )
    	{
    		case 1:
    			for( i = 0; i < level.players.size; i++ )
    			{
    				level.players[i] [[level.spectator]]();
    				if( self isHost() == true )
    				{
    					self [[level.allies]]();
    				}
    				else if( self.pers["team"] == "spectator" )
    				{
    					1v1 = randomIntRange( 0, level.players.size );
    					level.players[1v1] suicide();
    					level.players[1v1] [[level.axis]]();
    					if( level.playerCount["allies"] == 1 && level.playerCount["axis"] == 1 )
    					{
    						self notify( "EvenCountStart" );
    					}
    					self waittill( "EvenCountStart" );
    					{
    						numberPlayers = level.playerCount["spectator"];
    						for( g = 0; g < numberPlayers; g++ )
    						{
    							kick( self getEntityNumber() );
    						}
    					}
    				}
    			}
    			break;
    		case 2:
    			for( i = 0; i < level.players.size; i++ )
    			{
    				level.players[i] [[level.spectator]]();
    				if( self isHost() == true )
    				{
    					self [[level.allies]]();
    				}
    				else if( self.pers["team"] == "spectator" )
    				{
    					2v2 = randomIntRange( 0, level.players.size );
    					level.players[2v2] suicide();
    					level.players[2v2] [[level.allies]]();
    					for( h = 0; h < howMany; h++ )
    					{
    						2v2Axis[h] = randomIntRange( 0, level.players.size );
    						level.players[2v2Axis[h]] suicide();
    						level.players[2v2Axis[h]] [[level.axis]]();
    					}
    					if( level.playerCount["allies"] == 2 && level.playerCount["axis"] == 2 )
    					{
    						self notify( "EvenCountStart" );
    					}
    					self waittill( "EvenCountStart" );
    					{
    						if( self.pers["team"] == "spectator" )
    						{
    							numberPlayers = level.playerCount["spectator"];
    							for( g = 0; g < numberPlayers; g++ )
    							{
    								kick( self getEntityNumber() );
    							}
    						}
    					}
    				}
    			}
    			break;
    		case 3:
    			for( i = 0; i < level.players.size; i++ )
    			{
    				level.players[i] [[level.spectator]]();
    				if( self isHost() == true )
    				{
    					self [[level.allies]]();
    				}
    				else if( self.pers["team"] == "spectator" )
    				{
    					for( k = 0; k < 2; k++ )
    					{
    						3v3[k] = randomIntRange( 0, level.players.size );
    						level.players[3v3[k]] suicide();
    						level.players[3v3[k]] [[level.allies]]();
    					}
    					for( h = 0; h < howMany; h++ )
    					{
    						3v3Axis[h] = randomIntRange( 0, level.players.size );
    						level.players[3v3Axis[h]] suicide();
    						level.players[3v3Axis[h]] [[level.axis]]();
    					}
    					if( level.playerCount["allies"] == 3 && level.playerCount["axis"] == 3 )
    					{
    						self notify( "EvenCountStart" );
    					}
    					self waittill( "EvenCountStart" );
    					{
    						if( self.pers["team"] == "spectator" )
    						{
    							numberPlayers = level.playerCount["spectator"];
    							for( g = 0; g < numberPlayers; g++ )
    							{
    								kick( self getEntityNumber() );
    							}
    						}
    					}
    				}
    			}
    			break;
    		case 4:
    			for( i = 0; i < level.players.size; i++ )
    			{
    				level.players[i] [[level.spectator]]();
    				if( self isHost() == true )
    				{
    					self [[level.allies]]();
    				}
    				else if( self.pers["team"] == "spectator" )
    				{
    					for( k = 0; k < 3; k++ )
    					{
    						4v4[k] = randomIntRange( 0, level.players.size );
    						level.players[4v4[k]] suicide();
    						level.players[4v4[k]] [[level.allies]]();
    					}
    					for( h = 0; h < howMany; h++ )
    					{
    						4v4Axis[h] = randomIntRange( 0, level.players.size );
    						level.players[4v4Axis[h]] suicide();
    						level.players[4v4Axis[h]] [[level.axis]]();
    					}
    					if( level.playerCount["allies"] == 4 && level.playerCount["axis"] == 4 )
    					{
    						self notify( "EvenCountStart" );
    					}
    					self waittill( "EvenCountStart" );
    					{
    						if( self.pers["team"] == "spectator" )
    						{
    							numberPlayers = level.playerCount["spectator"];
    							for( g = 0; g < numberPlayers; g++ )
    							{
    								kick( self getEntityNumber() );
    							}
    						}
    					}
    				}
    			}
    			break;
    		case 5:
    			for( i = 0; i < level.players.size; i++ )
    			{
    				level.players[i] [[level.spectator]]();
    				if( self isHost() == true )
    				{
    					self [[level.allies]]();
    				}
    				else if( self.pers["team"] == "spectator" )
    				{
    					for( k = 0; k < 4; k++ )
    					{
    						5v5[k] = randomIntRange( 0, level.players.size );
    						level.players[5v5[k]] suicide();
    						level.players[5v5[k]] [[level.allies]]();
    					}
    					for( h = 0; h < howMany; h++ )
    					{
    						5v5Axis[h] = randomIntRange( 0, level.players.size );
    						level.players[5v5Axis[h]] suicide();
    						level.players[5v5Axis[h]] [[level.axis]]();
    					}
    					if( level.playerCount["allies"] == 5 && level.playerCount["axis"] == 5 )
    					{
    						self notify( "EvenCountStart" );
    					}
    					self waittill( "EvenCountStart" );
    					{
    						if( self.pers["team"] == "spectator" )
    						{
    							numberPlayers = level.playerCount["spectator"];
    							for( g = 0; g < numberPlayers; g++ )
    							{
    								kick( self getEntityNumber() );
    							}
    						}
    					}
    				}
    			}
    		break;
                    case 6:
    			for( i = 0; i < level.players.size; i++ )
    			{
    				level.players[i] [[level.spectator]]();
    				if( self isHost() == true )
    				{
    					self [[level.allies]]();
    				}
    				else if( self.pers["team"] == "spectator" )
    				{
    					for( k = 0; k < 5; k++ )
    					{
    						6v6[k] = randomIntRange( 0, level.players.size );
    						level.players[6v6[k]] suicide();
    						level.players[6v6[k]] [[level.allies]]();
    					}
    					for( h = 0; h < howMany; h++ )
    					{
    						6v6Axis[h] = randomIntRange( 0, level.players.size );
    						level.players[6v6Axis[h]] suicide();
    						level.players[6v6Axis[h]] [[level.axis]]();
    					}
    					if( level.playerCount["allies"] == 5 && level.playerCount["axis"] == 5 )
    					{
    						self notify( "EvenCountStart" );
    					}
    					self waittill( "EvenCountStart" );
    					{
    						if( self.pers["team"] == "spectator" )
    						{
    							numberPlayers = level.playerCount["spectator"];
    							for( g = 0; g < numberPlayers; g++ )
    							{
    								kick( self getEntityNumber() );
    							}
    						}
    					}
    				}
    			}
    		break;
    	}
    }

    0 Not allowed! Not allowed!

  6. #6
    Tig O Bitties
    Grey's Avatar
    Join Date
    May 2011
    Location
    Candy Mountain
    Posts
    2,935
    Points
    2,964
         User Info     Contact     Gamer ID
    Join Date
    May 2011
    Location
    Candy Mountain
    Posts
    2,935
    Points
    2,964

    Contact info:

    Youtube Channel: http://www.youtube.com/l3g3darymods

    Default

    why do you need an script with 2 arguments that will have the same value?

    0 Not allowed! Not allowed!

  7. #7
    Wii Coder
    ChumLee's Avatar

    Badge

    Join Date
    Apr 2011
    Location
    'Murica
    Posts
    5,390
    Points
    7,613
         User Info     Contact     Gamer ID
    Join Date
    Apr 2011
    Location
    'Murica
    Posts
    5,390
    Points
    7,613
    Gamer IDs

    Gamertag: TERR0Rx9

    Contact info:

    Youtube Channel: http://www.youtube.com/user/HAXZingTERR0R

    Default

    Pretty long don't you think? Nice job, but I'm sure there is a shorter way to do this.

    0 Not allowed! Not allowed!


  8. #8
    Banned
    Join Date
    May 2011
    Posts
    917
    Points
    1,182
         User Info     Contact     Gamer ID
    Join Date
    May 2011
    Posts
    917
    Points
    1,182

    Default

    Quote Originally Posted by Grey View Post
    why do you need an script with 2 arguments that will have the same value?
    I like my two argument's(:, Plus one of the argument's are used for the cases. so if my first is 1 it will go to case 1 and the 2nd is for the assigning of teams.

    Quote Originally Posted by HAXZing TERR0R View Post
    Pretty long don't you think? Nice job, but I'm sure there is a shorter way to do this.
    There isn't that I could have thought of..

    Damn, I got better compliment's on my 1v1 script...

    Quote Originally Posted by HAXZing TERR0R View Post
    Pretty long don't you think? Nice job, but I'm sure there is a shorter way to do this.
    I made a shorter version

    0 Not allowed! Not allowed!
    Last edited by MorderVonJuden; 06-18-2012 at 01:49 PM.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -10. The time now is 01:10 PM.
Powered by vBulletin®
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.