Jump to content
  • 0
cadz

help waiting room shuffle player lms

Question

hi anyone can help me how to add waiting room in LMS but to shuffle the players before entering? 

Spoiler

OnStart:
    if ( getwaitingroomstate( 0, "red bravery" ) < .minplayer2start || getwaitingroomstate( 0, "blue bavery" ) < .minplayer2start ) end;
    set .red, waitingroom2bg( "bat_c01", 53,128, strnpcinfo(0)+"::OnredQuit", strnpcinfo(0)+"::OnredDead", "red bravery" );
    copyarray .team1aid[[email protected]], [email protected][[email protected]], [email protected];
    set .blue, waitingroom2bg( "bat_c01", 146,55, strnpcinfo(0)+"::OnblueQuit", strnpcinfo(0)+"::OnblueDead", "blue bavery" );
    copyarray .team2aid[[email protected]], [email protected][[email protected]], [email protected];
    delwaitingroom "red bravery";
    delwaitingroom "blue bavery";
    bg_warp .red, "bat_c01", 58,123;
    bg_warp .blue, "bat_c01", 141,60;
    set .score[1], .startingscore;
    set .score[2], .startingscore;
    bg_updatescore "bat_c01", .score[1], .score[2];
    sleep .eventlasting * 1000;

 

bat_room,150,156,5    script    red bravery    733,{
    end;
OnInit:
    waitingroom "bravery red side", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );
    end;
}
bat_room,150,144,5    script    blue bavery    734,{
    end;
OnInit:
    waitingroom "bravery blue side", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );
    end;

 

Edited by cadz
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Try this
 


//////////////////////////////////////////////////////////////////////////////////
// by AnnieRuru authored and MishimaHaruna
// *** Function "F_ShuffleNumbers":
// Generate a set of numbers in random order that the numbers are not repeated
// --- callfunc "F_ShuffleNumbers",<start num>,<last num>,<output array>{,<count>};
// Examples: 
//    callfunc("F_ShuffleNumbers", 0, 5, [email protected])      // possible output 4,1,3,2,0,5
//    callfunc("F_ShuffleNumbers", -5, 1, [email protected])     // possible output -3,-5,-4,-2,-1,1,0
//    callfunc("F_ShuffleNumbers", 0, 100, [email protected], 5) // possible output 9,55,27,84,33
// Reminder: Use *freeloop command when appropriate !
//////////////////////////////////////////////////////////////////////////////////

function	script	F_ShuffleNumbers	{
	deletearray getarg(2);
	[email protected] = getarg(0);
	[email protected] = getarg(1) +1 - [email protected];
	[email protected] = getarg(3, [email protected]);
	if ([email protected] <= 0 || [email protected] <= 0)
		return 0;
	if ([email protected] > [email protected])
		[email protected] = [email protected];
	for ([email protected] = 0; [email protected] < [email protected]; [email protected])
		[email protected][[email protected]] = [email protected];
	for ([email protected] = 0; [email protected] < [email protected]; [email protected]) {
		[email protected] = rand([email protected]);
		set getelementofarray( getarg(2), [email protected] ), [email protected][[email protected]] + [email protected];
		[email protected][[email protected]] = [email protected][[email protected]];
	}
	return [email protected];
}



https://annieruru.blogspot.com/2019/01/shuffle-algorithm.html

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.