Jump to content
  • 0

Question

Posted (edited)

This script not warp player after number 3 in line! help me! i need to warp to player number 4 , 5 , 6 . this is queue for enter to event!


prontera,152,186,4 script SpeedTest 123,{

mes "Wanna sign up";
if(select("yes:no")==2) close;
if(getarraysize(.signup_A) == 128) {mes "Sorry the whole queue is full"; close; }

set .signup_A[getarraysize(.signup_A)],getcharid(0); //Sets the player RID in the queue
mes "You are now signed to the BG  event";
dispbottom "Sua Posição na fila é : [ "+getarraysize(.signup_A)+" ]";
close2;

if (.bgon>=1) {end; }//If battlegrounds is ongoing script stops.
while  (1) {
set .@problem,0;
	if(getarraysize(.signup_A) >= 3) { //Check array size
		for ( set .@i,0; .@i<3; set .@i,.@i+1) { //Loop through the first three values
			if(!isloggedin(.signup_A[.@i])) { //Check if player is logged in, if not proceed to do the following.
				deletearray .signup[.@i],1; //Deletes the player from array and moves other values up
				set .@problem,1; //A check to indicate that someone in the first three spots wasn't logged.
			}

		}
	}
	else if (getarraysize(.signup_A) < 3){ end; }//If less than three people in array end the script.
if (!.@problem){ break; }//Break out of the loop if there weren't any issues

//Warp characters to BG map
warpchar "izlude",155,187,.signup_A[0];
warpchar "izlude",155,187,.signup_A[1];
warpchar "izlude",155,187,.signup_A[2];
deletearray .signup_A[0],3;

set .bgon,1;
initnpctimer "MCTimer5m";
end;
}	}
izlude,1,1,1 script MCTimer5m -1,{
OnTimer5000:
end;
OnTimer11000:
initnpctimer "MCTimer5m2";
end;
}
izlude,1,1,1 script MCTimer5m2 -1,{
OnTimer1000:
if( getmapusers("izlude") <= 1 ) goto L_WinR;
initnpctimer "MCTimer5m";
end;

L_WinR:
stopnpctimer;
set .bgon,0;
announce "Outra partida!",8;
mapwarp "izlude","prontera",155,180;
end;



}

Edited by brunoshp
Please use codebox for content longer than 10 lines.

16 answers to this question

Recommended Posts

Posted

This script not warp player after number 3 in line! help me! i need to warp to player number 4 , 5 , 6 . this is queue for enter to event!

6 players are allowed to enter :

prontera,152,186,4    script    SpeedTest    123,{
//-- How much player are allowed to enter
   set .allow_player, 6;


   mes "Wanna sign up";
   if( select("yes:no") -1 ) close;
   if( getarraysize(.signup_A) == 128 ) { mes "Sorry the whole queue is full"; close; }

   set .signup_A[ getarraysize(.signup_A) ], getcharid(0); //Sets the player RID in the queue
   mes "You are now signed to the BG  event";
   dispbottom "Sua Posição na fila é : [ "+getarraysize(.signup_A)+" ]";
   close2;

   if( .bgon >= 1 ) { end; }//If battlegrounds is ongoing script stops.
   while( 1 ) {
       set .@problem, 0;
           if( getarraysize( .signup_A ) >= .allow_player) { //Check array size
               for( set .@i,0; .@i < .allow_player; set .@i, .@i+1 ) { //Loop through the first three values
                   if( !isloggedin( .signup_A[.@i] ) ) { //Check if player is logged in, if not proceed to do the following.
                       deletearray .signup_A[.@i], 1; //Deletes the player from array and moves other values up
                       set .@problem, 1; //A check to indicate that someone in the first three spots wasn't logged.
                   }

               }
           } else if( getarraysize(.signup_A) < .allow_player ) { end; }//If less than three people in array end the script.
       if( !.@problem ){ break; }//Break out of the loop if there weren't any issues

       //Warp characters to BG map
       for( set .@i,0; .@i < .allow_player; set .@i, .@i+1 )
           warpchar "izlude",155,187,.signup_A[ .@i ];
       deletearray .signup_A[0], .allow_player;

       set .bgon,1;
       initnpctimer "MCTimer5m";
       end;
   }
   end;
}


izlude,1,1,1    script    MCTimer5m    -1,{

OnTimer11000:
   initnpctimer "MCTimer5m2";
   end;

}


izlude,1,1,1    script    MCTimer5m2    -1,{

OnTimer1000:
   if( getmapusers("izlude") <= 1 ) goto L_WinR;
   initnpctimer "MCTimer5m";
   end;

L_WinR:
   stopnpctimer;
   set getvariableofnpc( .bgon, "SpeedTest" ), 0;
   announce "Outra partida!",8;
   mapwarp "izlude","prontera",155,180;
   end;
}

  • Upvote 1
Posted

thz, but i need to enter 3 player, after round enter more 3 was registred in queue ! max players registred are 128. first 3 enter , after round other 3.

UP, i need so much!

Posted (edited)

prontera,156,185,5    script    kjdhfkdjsf    100,{
   mes "wanna sign up";
   if ( select( "yes", "no" ) == 2 ) close;
   else if ( .signup_count == 128 ) {
       mes "Sorry the whole queue is full";
       close;
   }
   while ( .signup_aid[.@i] != getcharid(3) && .@i < .signup_count ) .@i++;
   if ( .@i < .signup_count ) {
       mes "you have already sign up in this event";
       close;
   }
   .signup_aid[ .signup_count ] = getcharid(3);
   .signup_count++;
   mes "You are now signed to the BG event";
//    .@i = 0; // DEBUG
//    while ( .signup_aid[.@i] ) {
//        .@signup_name$[.@i] = rid2name( .signup_aid[.@i] );
//        .@i++;
//    }
//    mes "[Debug] Currently have "+ .signup_count +" sign-in and they are "+ implode( .@signup_name$, "," );
   close2;
L_start:
   if ( .signup_count < .min2start ) end;
   for ( .@i = 0; .@i < .signup_count; .@i++ ) {
       if ( attachrid( .signup_aid[.@i] ) ) {
           if ( getmapflag( strcharinfo(3), mf_nowarp ) ) { // player has went into another event
               deletearray .signup_aid[.@i], 1;
               .signup_count--;
               .@i--;
           }
       }
       else {
           deletearray .signup_aid[.@i], 1;
           .signup_count--;
           .@i--;
       }    
   }
   if ( .start || .signup_count < .min2start ) end;
   for ( .@i = 0; .@i < .signup_count; .@i++ )
       unitwarp .signup_aid[.@i], "guild_vs3", 50,50;
   deletearray .signup_aid, .min2start;
   .signup_count -= .min2start;
   end;
OnInit:
   .min2start = 2; // how many players to start the event

   while (1) {
       if ( !( .start = getmapusers( "guild_vs3" ) > 0 ) )
           goto L_start;
       sleep 5000;
   }
   end; // shouldn't reach
}

for battleground script, I don't think using while-loop is the correct way

if you want to make battleground script without using waitingroom

here's the source modification

http://rathena.org/board/topic/72571-battleground-system-without-waitingroom/#entry146937

prontera,156,185,5    script    kjdhfkdjsf    100,{
   mes "wanna sign up";
   if ( select( "yes", "no" ) == 2 ) close;
   else if ( .signup_count == 128 ) {
       mes "Sorry the whole queue is full";
       close;
   }
   while ( .signup_aid[.@i] != getcharid(3) && .@i < .signup_count ) .@i++;
   if ( .@i < .signup_count ) {
       mes "you have already sign up in this event";
       close;
   }
   .signup_aid[ .signup_count ] = getcharid(3);
   .signup_count++;
   mes "You are now signed to the BG event";
//    .@i = 0; // DEBUG
//    while ( .signup_aid[.@i] ) {
//        .@signup_name$[.@i] = rid2name( .signup_aid[.@i] );
//        .@i++;
//    }
//    mes "[Debug] Currently have "+ .signup_count +" sign-in and they are "+ implode( .@signup_name$, "," );
   close2;
L_start:
   if ( .signup_count < .min2start ) end;
   for ( .@i = 0; .@i < .signup_count; .@i++ ) {
       if ( attachrid( .signup_aid[.@i] ) ) {
           if ( getmapflag( strcharinfo(3), mf_nowarp ) ) { // player has went into another event
               deletearray .signup_aid[.@i], 1;
               .signup_count--;
               .@i--;
           }
       }
       else {
           deletearray .signup_aid[.@i], 1;
           .signup_count--;
           .@i--;
       }    
   }
   if ( .start || .signup_count < .min2start ) end;
   announce "event started", 0;
   .start = 1;
   for ( .@i = 0; .@i < .signup_count; .@i++ )
       setbgid ( .@i %2 )? .red : .blue, .signup_aid[.@i];
   deletearray .signup_aid, .min2start;
   bg_warp .red, "guild_vs3", 13,50;
   bg_warp .blue, "guild_vs3", 86,50;
   bg_updatescore "guild_vs3", 0,0;
   sleep .eventlasting * 1000;
   if ( .start == 1 ) {
       if ( .score[1] == .score[2] )
           mapannounce "guild_vs3", "Draw !", 0;
       else if ( .score[1] > .score[2] ) {
           mapannounce "guild_vs3", " Red side wins !", 0;
           callsub L_reward, .red;
       }
       else if ( .score[1] < .score[2] ) {
           mapannounce "guild_vs3", " Blue side wins !", 0;
           callsub L_reward, .blue;
       }
   }
   bg_warp .red, "prontera", 155,182;
   bg_warp .blue, "prontera", 158,182;
   bg_kickall .red;
   bg_kickall .blue;
   .start = .score[1] = .score[2] = 0;
   goto L_start;
L_reward:
   getbgusers getarg(0);
   for ( .@i = 0; .@i < $@arenamembersnum; .@i++ )
       getitem 501, 1, $@arenamembers[.@i]; // item reward
   return;
Onredout: callsub L_out, 2;
Onblueout: callsub L_out, 1;
L_out:
   announce strcharinfo(0) +" is out from the match !", 1;
   bg_leave;
   warp "SavePoint", 0,0;
   .score[ getarg(0) ]++;
   bg_updatescore "guild_vs3", .score[1], .score[2];
   if ( .score[ getarg(0) ] == .min2start /2 )
       awake strnpcinfo(0);
   end;
OnInit:
   .eventlasting = 30 * 60; // how long would the event last or it auto-reset. 30 *60 = 30 mins
   .min2start = 2; // minimum player to start

   .red = createbgid( "guild_vs3", 13,50, strnpcinfo(0)+"::Onredout", strnpcinfo(0)+"::Onredout" );
   .blue = createbgid( "guild_vs3", 86,50, strnpcinfo(0)+"::Onblueout", strnpcinfo(0)+"::Onblueout" );
   end;
}

btw I saw you make some post in plankt's queue system, which I think, its useless

if you want to use other member's algorithm function, its better that you duplicate out their script

and write them again with your own scripting style

and I found using queue system is not really practical choice ...

most people here prefer to not to use source modification ... dunno why

Edited by AnnieRuru
  • Upvote 1
Posted (edited)

in this script , i have 20 peoples registred, i will warp 3 only , others go to warp after round termined?

prontera,156,185,5 script kjdhfkdjsf 100,{
mes "wanna sign up";
if ( select( "yes", "no" ) == 2 ) close;
else if ( .signup_count == 128 ) {
 mes "Sorry the whole queue is full";
 close;
}
while ( .signup_aid[.@i] != getcharid(3) && .@i < .signup_count ) .@i++;
if ( .@i < .signup_count ) {
 mes "you have already sign up in this event";
 close;
}
.signup_aid[ .signup_count ] = getcharid(3);
.signup_count++;
mes "You are now signed to the BG event";
// .@i = 0; // DEBUG
// while ( .signup_aid[.@i] ) {
//  .@signup_name$[.@i] = rid2name( .signup_aid[.@i] );
//  .@i++;
// }
// mes "[Debug] Currently have "+ .signup_count +" sign-in and they are "+ implode( .@signup_name$, "," );
close2;
L_start:
if ( .signup_count < .min2start ) end;
for ( .@i = 0; .@i < .signup_count; .@i++ ) {
 if ( attachrid( .signup_aid[.@i] ) ) {
  if ( getmapflag( strcharinfo(3), mf_nowarp ) ) { // player has went into another event
   deletearray .signup_aid[.@i], 1;
   .signup_count--;
   .@i--;
  }
 }
 else {
  deletearray .signup_aid[.@i], 1;
  .signup_count--;
  .@i--;
 }
}
if ( .start || .signup_count < .min2start ) end;
announce "event started", 0;
.start = 1;
for ( .@i = 0; .@i < .signup_count; .@i++ )
 setbgid ( .@i %2 )? .red : .blue, .signup_aid[.@i];
deletearray .signup_aid, .min2start;
bg_warp .red, "guild_vs3", 13,50;
bg_warp .blue, "guild_vs3", 86,50;
bg_updatescore "guild_vs3", 0,0;
sleep .eventlasting * 1000;
if ( .start == 1 ) {
 if ( .score[1] == .score[2] )
  mapannounce "guild_vs3", "Draw !", 0;
 else if ( .score[1] > .score[2] ) {
  mapannounce "guild_vs3", " Red side wins !", 0;
  callsub L_reward, .red;
 }
 else if ( .score[1] < .score[2] ) {
  mapannounce "guild_vs3", " Blue side wins !", 0;
  callsub L_reward, .blue;
 }
}
bg_warp .red, "prontera", 155,182;
bg_warp .blue, "prontera", 158,182;
bg_kickall .red;
bg_kickall .blue;
.start = .score[1] = .score[2] = 0;
goto L_start;
L_reward:
getbgusers getarg(0);
for ( .@i = 0; .@i < $@arenamembersnum; .@i++ )
 getitem 501, 1, $@arenamembers[.@i]; // item reward
return;
Onredout: callsub L_out, 2;
Onblueout: callsub L_out, 1;
L_out:
announce strcharinfo(0) +" is out from the match !", 1;
bg_leave;
warp "SavePoint", 0,0;
.score[ getarg(0) ]++;
bg_updatescore "guild_vs3", .score[1], .score[2];
if ( .score[ getarg(0) ] == .min2start /2 )
 awake strnpcinfo(0);
end;
OnInit:
.eventlasting = 30 * 60; // how long would the event last or it auto-reset. 30 *60 = 30 mins
.min2start = 2; // minimum player to start
.red = createbgid( "guild_vs3", 13,50, strnpcinfo(0)+"::Onredout", strnpcinfo(0)+"::Onredout" );
.blue = createbgid( "guild_vs3", 86,50, strnpcinfo(0)+"::Onblueout", strnpcinfo(0)+"::Onblueout" );
end;
}

Edited by AnnieRuru
use [codebox] if the script > 10 lines
Posted

/swt sorry I misread your screenshot

Your error is the same as previously, for example

.signup_aid[ .signup_count ] = getcharid(3);
.signup_count++;

to

set .signup_aid[ .signup_count ], getcharid(3);
set .signup_count, .signup_count + 1;

  • Upvote 1
Posted (edited)

most people here prefer to not to use source modification ... dunno why

Because the mod breaks after we update our SVN /ok

doesn't make sense, this modification is just adding 4 script commands ... very simple patch :ani_swt3:

I bet this patch even works in eathena/3ceam ( by patch manually )

prontera,156,185,5	script	kjdhfkdjsf	100,{
mes "wanna sign up";
if ( select( "yes", "no" ) == 2 ) close;
else if ( .signup_count == 128 ) {
	mes "Sorry the whole queue is full";
	close;
}
while ( .signup_aid[.@i] != getcharid(3) && .@i < .signup_count )
	set .@i, .@i +1;
if ( .@i < .signup_count ) {
	mes "you have already sign up in this event";
	close;
}
set .signup_aid[ .signup_count ], getcharid(3);
set .signup_count, .signup_count +1;
mes "You are now signed to the BG event";
//	set .@i, 0; // DEBUG
//	while ( .signup_aid[.@i] ) {
//		set .@signup_name$, .@signup_name$ +","+ rid2name( .signup_aid[.@i] );
//		set .@i, .@i +1;
//	}
//	mes "[Debug] Currently have "+ .signup_count +" sign-in and they are "+ .@signup_name$;
close2;
L_start:
if ( .signup_count < .min2start ) end;
for ( set .@i, 0; .@i < .signup_count; set .@i, .@i +1 ) {
	if ( attachrid( .signup_aid[.@i] ) ) {
		if ( getmapflag( strcharinfo(3), mf_nowarp ) ) { // player has went into another event
			deletearray .signup_aid[.@i], 1;
			set .signup_count, .signup_count -1;
			set .@i, .@i -1;
		}
	}
	else {
		deletearray .signup_aid[.@i], 1;
		set .signup_count, .signup_count -1;
		set .@i, .@i -1;
	}	
}
if ( .start || .signup_count < .min2start ) end;
announce "event started", 0;
set .start, 1;
for ( set .@i, 0; .@i < .signup_count; set .@i, .@i +1 )
	setbgid ( .@i %2 )? .red : .blue, .signup_aid[.@i];
deletearray .signup_aid, .min2start;
set .signup_count, .signup_count - .min2start;
bg_warp .red, "guild_vs3", 13,50;
bg_warp .blue, "guild_vs3", 86,50;
bg_updatescore "guild_vs3", 0,0;
sleep .eventlasting * 1000;
if ( .start == 1 ) {
	if ( .score[1] == .score[2] )
		mapannounce "guild_vs3", "Draw !", 0;
	else if ( .score[1] > .score[2] ) {
		mapannounce "guild_vs3", " Red side wins !", 0;
		callsub L_reward, .red;
	}
	else if ( .score[1] < .score[2] ) {
		mapannounce "guild_vs3", " Blue side wins !", 0;
		callsub L_reward, .blue;
	}
}
bg_warp .red, "prontera", 155,182;
bg_warp .blue, "prontera", 158,182;
bg_kickall .red;
bg_kickall .blue;
set .start, 0;
deletearray .score;
goto L_start;
L_reward:
getbgusers getarg(0);
for ( set .@i, 0; .@i < .signup_count; set .@i, .@i +1 )
	getitem 501, 1, $@arenamembers[.@i]; // item reward
return;
Onredout: callsub L_out, 2;
Onblueout: callsub L_out, 1;
L_out:
announce strcharinfo(0) +" is out from the match !", 1;
bg_leave;
warp "SavePoint", 0,0;
set .score[ getarg(0) ], .score[ getarg(0) ] +1;
bg_updatescore "guild_vs3", .score[1], .score[2];
if ( .score[ getarg(0) ] == .min2start /2 )
	awake strnpcinfo(0);
end;
OnInit:
set .eventlasting, 30 * 60; // how long would the event last or it auto-reset. 30 *60 = 30 mins
set .min2start, 2; // minimum player to start

set .red, createbgid( "guild_vs3", 13,50, strnpcinfo(0)+"::Onredout", strnpcinfo(0)+"::Onredout" );
set .blue, createbgid( "guild_vs3", 86,50, strnpcinfo(0)+"::Onblueout", strnpcinfo(0)+"::Onblueout" );
end;
}

guild_vs3	mapflag	battleground	2
guild_vs3	mapflag	nosave	SavePoint
guild_vs3	mapflag	nowarp
guild_vs3	mapflag	nowarpto
guild_vs3	mapflag	noteleport
guild_vs3	mapflag	nomemo
guild_vs3	mapflag	nopenalty
guild_vs3	mapflag	nobranch
guild_vs3	mapflag	noicewall

try this

however, if your next question is about how to write a battleground script, I have to move into script request section =/

your question is about how to write queue system, not the battleground system lol

Edited by AnnieRuru
  • Upvote 1

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...