cadz Posted April 6, 2021 Share Posted April 6, 2021 (edited) 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]rsnum; 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 April 14, 2021 by cadz Quote Link to comment Share on other sites More sharing options...
0 buraquera Posted April 16, 2021 Share Posted April 16, 2021 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 Quote Link to comment Share on other sites More sharing options...
hi anyone can help me how to add waiting room in LMS but to shuffle the players before entering?
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]rsnum;
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 cadzLink to comment
Share on other sites