Jump to content
n0tttt

PVP, WoE, GVG: Rotative PvP Room

Recommended Posts

Rotative PvP Room


A PvP room which changes maps. Nothing else is required to the description, I guess.

 

Features:

- You can use @pvp command to enter the room. However, you can't use it if you're inside an instance of in middle of a battle.

- Anti repeating system. You can avoid the same map being repeated again and again.

- Some little effects when you're warped.


 

Link to comment
Share on other sites

Probably the map you warped to didn't have the mf_loadevent mapflag.

You can use this version anyways. I avoided doing it this way since it can cause a bit of lagging.

/*
	Changelog:

	v1.1 	Added option to debuff players when entering the room.
		Added command to rotate manually.
		Remove hiding when quitting room.
		Added lvl checking on command.

	v1.1a	Removed right curly which made dispell function don't work. Sorry.
		Added color to the npc name in dialog.
		Added F_InsertPlural use.

	v1.2    Added waitingroom with player count.

	v1.3    Use of pcblock command.
*/

// You can use this function with other scripts as well.
function	script	dispell	{

	while([email protected]++ < SC_SPL_MATK) {
		if(
			[email protected] != SC_WEIGHT50 &&
			[email protected] != SC_WEIGHT90 &&
			[email protected] != SC_NOCHAT &&
			[email protected] != SC_BABY &&
			/*
			[email protected] != SC_WEDDING &&
			[email protected] != SC_XMAS &&
			[email protected] != SC_SUMMER &&
			[email protected] != SC_HANBOK &&
			[email protected] != SC_OKTOBERFEST &&
			*/
			[email protected] != SC_JAILED &&
			[email protected] != SC_EXPBOOST &&
			[email protected] != SC_ITEMBOOST
		)
			sc_end [email protected];
	}
	[email protected] = SC_FEAR;
	while([email protected]++ < SC_AKAITSUKI)
		sc_end [email protected];

}

prontera,147,172,6	script	PvP#0	4_M_SAKRAYROYAL,{

	[email protected]$ = "^3227cd[PvP Room]^000000";
	mes [email protected]$;
	if(BaseLevel >= .min_lv) {
		mes "There are ^d40f00"+F_InsertPlural(getmapusers(.map$),"player")+"^000000 inside right now.";
		mes "Do you want to enter to the room?";
		if(.debuff)
			mes "^8b0d1fBe careful, because every buff you have will be lost upon entering the room.^000000";
		next;
		if(select("Yes.","No, thanks.") == 1) {
			specialeffect2 F_Rand(EF_STORMKICK1,EF_STORMKICK2,EF_STORMKICK3,EF_STORMKICK6,EF_STORMKICK7);
			sleep2 600;
			specialeffect2 F_Rand(EF_SPINMOVE,EF_CASTSPIN2);
			sleep2 550;
			if(.debuff)
				dispell();
			warp .map$,0,0;
			mapannounce .map$,strcharinfo(0)+" has entered the room.",bc_map,0xb50505;
			if(!.waiting_room)
				donpcevent "PvP#0::OnWaitingRoom";
		}
	} else {
		mes "You must be at least level "+.min_lv+" to be able to enter the room.";
		close;
	}
	end;

OnInit:

	// This command can be used to enter the PvP Room.
	bindatcmd "pvp","PvP#0::OnCommand";

	// Command to rotate the room maually.
	bindatcmd "rotatepvp","PvP#0::OnMinute00",60;

	// Min LvL to enter the room.
	.min_lv = 50;

	// Will players be dispelled upon entering the room?
	.debuff = false;

OnMinute00:
OnMinute30:

	// PvP maps go here. Change them as you wish.
	setarray [email protected]$[0], "guild_vs2","guild_vs3","guild_vs5","pvp_y_1-1","guild_vs4","guild_vs1","arena_room";

	// Max amount of times a map can be repeated. 0 = unlimited.
	[email protected] = 3;

	[email protected] = getarraysize([email protected]$);

	if(.map$ == "") {

		// You can edit the room mapflags here.
		setarray [email protected][0], 	mf_nosave,
					mf_nodrop,
					mf_novending,
					mf_noteleport,
					mf_noreturn,
					mf_nowarp,
					mf_nowarpto,
					mf_nomemo,
					mf_nopenalty,
					mf_nobranch,
					mf_hidemobhpbar,
					mf_pvp,
					mf_pvp_noguild,
					mf_pvp_noparty,
					mf_pvp_nocalcrank,
					mf_loadevent;

		[email protected] = getarraysize([email protected]);
		while([email protected]) {
			[email protected] = [email protected];
			while([email protected])
				setmapflag [email protected]$[[email protected]],[email protected][[email protected]];
		}

	}

	[email protected]$ = .map$;
	[email protected]    = rand([email protected]);
	.map$  = [email protected]$[[email protected]];
	if([email protected] && .map$ == [email protected]$) {
		if(++.row >= [email protected]) {
			deletearray [email protected]$[[email protected]],1;
			.map$ = [email protected]$[rand([email protected] - 1)];
			.row  = 0;
		}
	} else if(.row) {
		.row = 0;
	}
	if(.map$ != [email protected]$ && [email protected]$ != "") {
		mapwarp [email protected]$,.map$,0,0;
		sleep 2500;
		mapannounce .map$,"The PvP Room has changed!",bc_npc,0xe53a12;
	}
	end;

OnCommand:

	[email protected]_id = instance_id();
	[email protected]$ = strcharinfo(3);
	if(([email protected]_id || instance_mapname([email protected]$,[email protected]_id) == "") && BaseLevel >= .min_lv) {
		if([email protected]$ != .map$) {
			message strcharinfo(0),"Preparing to enter!";
		} else {
			message strcharinfo(0),"Quitting the room...";
			unitstopwalk getcharid(3);
			//pcblock PCBLOCK_MOVE|PCBLOCK_ATTACK|PCBLOCK_SKILL,true;
			pcblockmove getcharid(3),true;
			pcblockskill getcharid(3),true;
			setoption OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK,false;
		}
		[email protected] = HP;
		sleep2 1400;
		while([email protected]++ < 5) {
			message strcharinfo(0),(6 - [email protected])+"...";
			sleep2 990;
			if(HP < [email protected]) {
				message strcharinfo(0),"You can't do this in the middle of a battle.";
				//pcblock PCBLOCK_MOVE|PCBLOCK_ATTACK|PCBLOCK_SKILL,false;
				pcblockmove getcharid(3),false;
				pcblockskill getcharid(3),false;
				end;
			}
		}
		specialeffect2 F_Rand(EF_STORMKICK1,EF_STORMKICK2,EF_STORMKICK3,EF_STORMKICK6,EF_STORMKICK7);
		sleep2 600;
		specialeffect2 F_Rand(EF_SPINMOVE,EF_CASTSPIN2);
		sleep2 550;
		if([email protected]$ != .map$) {
			if(.debuff)
				dispell();
			warp .map$,0,0;
			mapannounce .map$,strcharinfo(0)+" has entered the room.",bc_map,0xb50505;
			if(!.waiting_room)
				donpcevent "PvP#0::OnWaitingRoom";
		} else {
			warp "SavePoint",0,0;
			//pcblock PCBLOCK_MOVE|PCBLOCK_ATTACK|PCBLOCK_SKILL,false;
			pcblockmove getcharid(3),false;
			pcblockskill getcharid(3),false;
		}
	} else if(BaseLevel < .min_lv) {
		message strcharinfo(0),"You must be at least level "+.min_lv+" to be able to enter the room.";
	} else {
		message strcharinfo(0),"You can't enter the room in the middle of an instance.";
	}
	end;

OnWaitingRoom:

	.waiting_room = true;
	while(true) {
		[email protected] = getmapusers(.map$);
		if([email protected] != [email protected]_count) {
			[email protected]_count = [email protected];
			delwaitingroom;
			waitingroom F_InsertPlural([email protected],"player")+".",0;
		}
		sleep 2500;
	}
	end;

}

 

  • Like 1
Link to comment
Share on other sites

On 6/12/2019 at 12:58 PM, fenrirdev said:

how to remove the @pvp command?

You could delete the bindatcmd line, but better use this one since I deleted it altogether:

/*
	Changelog:

	v1.1 	Added option to debuff players when entering the room.
		Added command to rotate manually.
		Remove hiding when quitting room.
		Added lvl checking on command.

	v1.1a	Removed right curly which made dispell function don't work. Sorry.
		Added color to the npc name in dialog.
		Added F_InsertPlural use.

	v1.2    Added waitingroom with player count.
*/

// You can use this function with other scripts as well.
function	script	dispell	{

	while(.@i++ < SC_SPL_MATK) {
		if(
			.@i != SC_WEIGHT50 &&
			.@i != SC_WEIGHT90 &&
			.@i != SC_NOCHAT &&
			.@i != SC_BABY &&
			/*
			[email protected] != SC_WEDDING &&
			[email protected] != SC_XMAS &&
			[email protected] != SC_SUMMER &&
			[email protected] != SC_HANBOK &&
			[email protected] != SC_OKTOBERFEST &&
			*/
			.@i != SC_JAILED &&
			.@i != SC_EXPBOOST &&
			.@i != SC_ITEMBOOST
		)
			sc_end .@i;
	}
	.@i = SC_FEAR;
	while(.@i++ < SC_AKAITSUKI)
		sc_end .@i;

}

prontera,147,172,6	script	PvP#0	4_M_SAKRAYROYAL,{

	.@n$ = "^3227cd[PvP Room]^000000";
	mes .@n$;
	if(BaseLevel >= .min_lv) {
		mes "There are ^d40f00"+F_InsertPlural(getmapusers(.map$),"player")+"^000000 inside right now.";
		mes "Do you want to enter to the room?";
		if(.debuff)
			mes "^8b0d1fBe careful, because every buff you have will be lost upon entering the room.^000000";
		next;
		if(select("Yes.","No, thanks.") == 1) {
			specialeffect2 F_Rand(EF_STORMKICK1,EF_STORMKICK2,EF_STORMKICK3,EF_STORMKICK6,EF_STORMKICK7);
			sleep2 600;
			specialeffect2 F_Rand(EF_SPINMOVE,EF_CASTSPIN2);
			sleep2 550;
			if(.debuff)
				dispell();
			warp .map$,0,0;
			mapannounce .map$,strcharinfo(0)+" has entered the room.",bc_map,0xb50505;
			if(!.waiting_room)
				donpcevent "PvP#0::OnWaitingRoom";
		}
	} else {
		mes "You must be at least level "+.min_lv+" to be able to enter the room.";
		close;
	}
	end;

OnInit:

	// Command to rotate the room maually.
	bindatcmd "rotatepvp","PvP#0::OnMinute00",60;

	// Min LvL to enter the room.
	.min_lv = 50;

	// Will players be dispelled upon entering the room?
	.debuff = false;

OnMinute00:
OnMinute30:

	// PvP maps go here. Change them as you wish.
	setarray .@maps$[0], "guild_vs2","guild_vs3","guild_vs5","pvp_y_1-1","guild_vs4","guild_vs1","arena_room";

	// Max amount of times a map can be repeated. 0 = unlimited.
	.@row = 3;

	.@size = getarraysize(.@maps$);

	if(.map$ == "") {

		// You can edit the room mapflags here.
		setarray .@mapfl[0], 	mf_nosave,
					mf_nodrop,
					mf_novending,
					mf_noteleport,
					mf_noreturn,
					mf_nowarp,
					mf_nowarpto,
					mf_nomemo,
					mf_nopenalty,
					mf_nobranch,
					mf_hidemobhpbar,
					mf_pvp,
					mf_pvp_noguild,
					mf_pvp_noparty,
					mf_pvp_nocalcrank,
					mf_loadevent;

		.@i = getarraysize(.@mapfl);
		while(.@i--) {
			.@j = .@size;
			while(.@j--)
				setmapflag .@maps$[.@j],.@mapfl[.@i];
		}

	}

	.@map$ = .map$;
	.@r    = rand(.@size);
	.map$  = .@maps$[.@r];
	if(.@row && .map$ == .@map$) {
		if(++.row >= .@row) {
			deletearray .@maps$[.@r],1;
			.map$ = .@maps$[rand(.@size - 1)];
			.row  = 0;
		}
	} else if(.row) {
		.row = 0;
	}
	if(.map$ != .@map$ && .@map$ != "") {
		mapwarp .@map$,.map$,0,0;
		sleep 2500;
		mapannounce .map$,"The PvP Room has changed!",bc_npc,0xe53a12;
	}
	end;

OnWaitingRoom:

	.waiting_room = true;
	while(true) {
		.@count = getmapusers(.map$);
		if(.@count != .@old_count) {
			.@old_count = .@count;
			delwaitingroom;
			waitingroom F_InsertPlural(.@count,"player")+".",0;
		}
		sleep 2500;
	}
	end;

}

 

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
Reply to this topic...

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