Jump to content
  • 0

Help! Pvp warper max player room count


Question

Posted

Hi, I need a little help for my PVP warper script. I added couple more maps and they have different room player limits. I would like to have them not able to warp on the map when limit is reached. I have a limit working right now, but it's for ALL of them, I want it to be Map specific please.

 

Here's the script im using:

-	script	PVP Warper#01::pvp	946,{
	set .@mapcount_1,getmapusers("guild_vs1");
	set .@mapcount_2,getmapusers("guild_vs3");
	set .@mapcount_3,getmapusers("pvp_n_8-1");
	set .@mapcount_4,getmapusers("pvp_y_1-1");

	while(1) {
		switch(select("Epsilon Arena [ "+.@mapcount_1+" / 15 ]:Square Arena [ "+.@mapcount_2+" / 20 ]:Sandwich Arena [ "+.@mapcount_3+" / 30 ]:Prontera Arena [ "+.@mapcount_4+" / 60 ]")) {
		case 1:
			callsub S_CheckPVPRoom,@mapcount_1,"guild_vs1";
			break;
		case 2:
			callsub S_CheckPVPRoom,@mapcount_2,"guild_vs3";
			break;
		case 3:
			callsub S_CheckPVPRoom,@mapcount_3,"pvp_n_8-1";
			break;
		case 4:
			callsub S_CheckPVPRoom,@mapcount_4,"pvp_y_1-1";
			break;

		}
	}

S_CheckPVPRoom:
	if (getarg(0) >= 25) {
		mes "[PVP Warper]";
		mes "This map is currently full.";
		next;
		return;
	}
	else {
		warp getarg(1),0,0; 
		//if(getarg(1) == pvp_y_1-2) announce ""+strcharinfo(0)+" has Entered Izlude Arena",bc_all,0xFF0000;
		//if(getarg(1) == guild_vs3) announce ""+strcharinfo(0)+" has Entered Square Arena",bc_all,0xFF0000;
		//announce ""+strcharinfo(0)+" has Entered the PVP Arena",bc_all,0xFF0000;
		end;
	}

 

As you can see on the script, I had 1st Map to be 15/15max, 2nd 20/20max, 3rd 30/30max and 4th 60/60max.

But my script only works for 25/25 in general. Thank you in advance!

7 answers to this question

Recommended Posts

  • 1
Posted (edited)

try this

prontera,155,181,5	script	PVP Warper::pvp	946,{

	while(1) {
		mes "["+strnpcinfo(0)+"]";
		.@menu$ = "";
		for (.@i = 0; .@i < .map_size; .@i++)
			.@menu$ = .@menu$ + sprintf("%s [ %d / %d ]", .map_name$[.@i], getmapusers(.map$[.@i]), .map_max_player[.@i]) + ":";
		.@i = select(.@menu$) - 1;
		if (.map_max_player[.@i] && getmapusers(.map$[.@i]) >= .map_max_player[.@i]) {
			mes "This map is currently full.";
			next;
		}
		else {
			warp .map$[.@i], 0, 0;
			end;
		}
	}
	close;
	
	OnInit:
		setarray .map_name$, "Epsilon Arena", "Square Arena", "Sandwich Arena", "Prontera Arena";
		setarray .map$, "guild_vs1", "guild_vs3", "pvp_n_8-1", "pvp_y_1-1";
		setarray .map_max_player, 15, 20, 30, 60;
		.map_size = getarraysize(.map$);
		end;
}

 

Edited by Emistry
updated script.
  • Upvote 1
  • 0
Posted

Change

case 1:
	callsub S_CheckPVPRoom,@mapcount_1,"guild_vs1";
	break;
case 2:
	callsub S_CheckPVPRoom,@mapcount_2,"guild_vs3";
	break;
case 3:
	callsub S_CheckPVPRoom,@mapcount_3,"pvp_n_8-1";
	break;
case 4:
	callsub S_CheckPVPRoom,@mapcount_4,"pvp_y_1-1";
	break;

To 

case 1:
	callsub S_CheckPVPRoom,@mapcount_1,"guild_vs1",15;
	break;
case 2:
	callsub S_CheckPVPRoom,@mapcount_2,"guild_vs3",20;
	break;
case 3:
	callsub S_CheckPVPRoom,@mapcount_3,"pvp_n_8-1",30;
	break;
case 4:
	callsub S_CheckPVPRoom,@mapcount_4,"pvp_y_1-1",60;
	break;

and then change

if (getarg(0) >= 25) {

to 

if (getarg(0) >= getarg(2)) {

 

  • 0
Posted
1 minute ago, Patskie said:

Change


case 1:
	callsub S_CheckPVPRoom,@mapcount_1,"guild_vs1";
	break;
case 2:
	callsub S_CheckPVPRoom,@mapcount_2,"guild_vs3";
	break;
case 3:
	callsub S_CheckPVPRoom,@mapcount_3,"pvp_n_8-1";
	break;
case 4:
	callsub S_CheckPVPRoom,@mapcount_4,"pvp_y_1-1";
	break;

To 


case 1:
	callsub S_CheckPVPRoom,@mapcount_1,"guild_vs1",15;
	break;
case 2:
	callsub S_CheckPVPRoom,@mapcount_2,"guild_vs3",20;
	break;
case 3:
	callsub S_CheckPVPRoom,@mapcount_3,"pvp_n_8-1",30;
	break;
case 4:
	callsub S_CheckPVPRoom,@mapcount_4,"pvp_y_1-1",60;
	break;

and then change


if (getarg(0) >= 25) {

to 


if (getarg(0) >= getarg(2)) {

 

Thank you! will try this!

  • 0
Posted

Tried the changes but the limit doesn't seem to work? I tried changing it to 1/1 to test it, then warp another character. And it still warped inside. @Patskie any idea why bro?

 

22 hours ago, Emistry said:

try this


prontera,155,181,5	script	PVP Warper::pvp	946,{

	OnInit:
		setarray .map_name$, "Epsilon Arena", "Square Arena", "Sandwich Arena", "Prontera Arena";
		setarray .map$, "guild_vs1", "guild_vs3", "pvp_n_8-1", "pvp_y_1-1";
		setarray .map_max_player, 15, 20, 30, 60;
		.map_size = getarraysize(.map$);
		end;
		
	while(1) {
		mes "["+strnpcinfo(0)+"]";
		.@menu$ = "";
		for (.@i = 0; .@i < .map_size; .@i++)
			.@menu$ = .@menu$ + sprintf("%s [ %d / %d ]", .map_name$[.@i], getmapusers(.map$[.@i]), .map_max_player[.@i]) + ":";
		.@i = select(.@menu$) - 1;
		if (.map_max_player[.@i] && getmapusers(.map$[.@i]) >= .map_max_player[.@i]) {
			mes "This map is currently full.";
			next;
		}
		else {
			warp .map$[.@i], 0, 0;
			end;
		}
	}
	close;
}

 

Thank you Emistry, will try this as soon as I can.

 

Thank you @Emistry. Script worked perfectly! Thank you much!

  • 0
Posted (edited)

@Emistry, Hi sorry for the ping. But one more thing, Can we add an effect on the NPC when someone is inside any of the PVP rooms? Like the woe_controller script that makes the npc glow when WOE is active. Something like that.

I looked at that script and got this part, but I'm not sure how to integrate it with this pvp script. Can help please?

 

Something like this, but when players are inside any of the rooms instead of when WOE is active.
 

OnAgitStart:
	while(agitcheck()) {
		specialeffect EF_BEGINSPELL6;
		sleep 425;
	}
	end;

 Edit:
This is to make players know that people are inside PVP room since we removed the "Entered PVP Room" announcement.

Edited by Yami
  • 0
Posted
prontera,155,181,5	script	PVP Warper::pvp	946,{

	while(1) {
		mes "["+strnpcinfo(0)+"]";
		.@menu$ = "";
		for (.@i = 0; .@i < .map_size; .@i++)
			.@menu$ = .@menu$ + sprintf("%s [ %d / %d ]", .map_name$[.@i], getmapusers(.map$[.@i]), .map_max_player[.@i]) + ":";
		.@i = select(.@menu$) - 1;
		if (.map_max_player[.@i] && getmapusers(.map$[.@i]) >= .map_max_player[.@i]) {
			mes "This map is currently full.";
			next;
		}
		else {
			warp .map$[.@i], 0, 0;
			end;
		}
	}
	close;
	
	OnInit:
		setarray .map_name$, "Epsilon Arena", "Square Arena", "Sandwich Arena", "Prontera Arena";
		setarray .map$, "guild_vs1", "guild_vs3", "pvp_n_8-1", "pvp_y_1-1";
		setarray .map_max_player, 15, 20, 30, 60;
		.map_size = getarraysize(.map$);

	OnTimer1000:
		for (.@i = 0; .@i < .map_size; .@i++) {
			if (getmapusers(.map$[.@i]) > 0) {
				specialeffect EF_BEGINSPELL6;
				break;
			}
		}
		initnpctimer;
		end;
}

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...