Jump to content
  • 0

BG_PVP countdown


celeron0134

Question


  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  194
  • Reputation:   1
  • Joined:  12/13/16
  • Last Seen:  

//===== rAthena Script =======================================
//= Battleground: PVP
//===== By: ==================================================
//= AnnieRuru
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= rAthena Project
//===== Description: =========================================
//= A simple battleground script:
//= Kill players from the other team.
//===== Additional Comments: =================================
//= 1.0 First version, edited. [Euphy]
//============================================================

-	script	bg_pvp#control	-1,{
OnInit:
	.minplayer2start = 5;      // minimum players to start (ex. if 3vs3, set to 3)
	.eventlasting    = 20*60;  // event duration before auto-reset (20 minutes * seconds)
	setarray .rewarditem[0],   // rewards for the winning team: <item>,<amount>,...
		7828, 10;
	setarray .rewarditemloss[0],   // rewards for the lossing team: <item>,<amount>,...
		7828, 5;
	end;
OnStart:
	if ( getwaitingroomstate( 0, .rednpcname$ ) < .minplayer2start || getwaitingroomstate( 0, .bluenpcname$ ) < .minplayer2start )
		end;

	// create Battleground and teams
	.red = waitingroom2bg( "guild_vs3", 13,50, strnpcinfo(0)+"::OnRedQuit", strnpcinfo(0)+"::OnRedDead", .rednpcname$ );
	copyarray .team1aid, $@arenamembers, $@arenamembersnum;
	.team1count = .minplayer2start;
	.blue = waitingroom2bg( "guild_vs3", 86,50, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDead", .bluenpcname$ );
	copyarray .team2aid, $@arenamembers, $@arenamembersnum;
	.team2count = .minplayer2start;
	delwaitingroom .rednpcname$;
	delwaitingroom .bluenpcname$;
	bg_warp .red, "guild_vs3", 13,50;
	bg_warp .blue, "guild_vs3", 86,50;
	.score[1] = .score[2] = .minplayer2start;
	bg_updatescore "guild_vs3", .score[1], .score[2];

	// match duration
	sleep .eventlasting * 1000;

	// end match, destroy Battleground, reset NPCs
	if ( .score[1] > .score[2] ) {
		mapannounce "guild_vs3", "- Red Team is victorious! -", bc_map;
		callsub L_Reward, 1, 2;
	}
	else if ( .score[1] < .score[2] ) {
		mapannounce "guild_vs3", "- Blue Team is victorious! -", bc_map;
		callsub L_Reward, 2, 1;
	}
	else
		mapannounce "guild_vs3", "- The match has ended in a draw! -", bc_map;
	bg_warp .red, "prontera",152,178;
	bg_warp .blue, "prontera",154,178;
	bg_destroy .red;
	bg_destroy .blue;
	donpcevent .rednpcname$ +"::OnStart";
	donpcevent .bluenpcname$ +"::OnStart";
	end;

L_Reward:
	for ( .@i = 0; .@i < getd(".team"+ getarg(0) +"count"); .@i++ )
		getitem .rewarditem[0], .rewarditem[1], getd(".team"+ getarg(0) +"aid["+ .@i +"]" );
	for ( .@i = 0; .@i < getd(".team"+ getarg(1) +"count"); .@i++ )
		getitem .rewarditemloss[0], .rewarditemloss[1], getd(".team"+ getarg(1) +"aid["+ .@i +"]" );
	return;

// "OnDeath" event
OnRedDead:  callsub L_Dead, 1;
OnBlueDead: callsub L_Dead, 2;
L_Dead:
	.score[ getarg(0) ]--;
	bg_updatescore "guild_vs3", .score[1], .score[2];
	while ( getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ) != getcharid(3) && .@i < getd(".team"+ getarg(0) +"count") ) .@i++;
	deletearray getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ), 1;
	setd ".team"+ getarg(0) +"count", getd(".team"+ getarg(0) +"count") -1;
	bg_leave;
	if ( !.score[ getarg(0) ] )
		awake strnpcinfo(0);
	sleep2 1250;
	percentheal 100,100;
	end;

// "OnQuit" event
OnRedQuit:  callsub L_Quit, 1;
OnBlueQuit: callsub L_Quit, 2;
L_Quit:
	.score[ getarg(0) ]--;
	bg_updatescore "guild_vs3", .score[1], .score[2];
	percentheal 100, 100;
	while ( getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ) != getcharid(3) && .@i < getd(".team"+ getarg(0) +"count") ) .@i++;
	deletearray getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ), 1;
	setd ".team"+ getarg(0) +"count", getd(".team"+ getarg(0) +"count") -1;
	if ( !.score[ getarg(0) ] )
		awake strnpcinfo(0);
	end;
}

quiz_02,247,383,5	script	Red Team#bg_pvp	733,{
	end;
OnInit:
	sleep 1;
	set getvariableofnpc( .rednpcname$, "bg_pvp#control" ), strnpcinfo(0);
OnStart:
	waitingroom "Red Team", getvariableofnpc( .minplayer2start, "bg_pvp#control" ) +1, "bg_pvp#control::OnStart", getvariableofnpc( .minplayer2start, "bg_pvp#control" );
	end;
}

quiz_02,252,383,5	script	Blue Team#bg_pvp	734,{
	end;
OnInit:
	sleep 1;
	set getvariableofnpc( .bluenpcname$, "bg_pvp#control" ), strnpcinfo(0);
OnStart:
	waitingroom "Blue Team", getvariableofnpc( .minplayer2start, "bg_pvp#control" ) +1, "bg_pvp#control::OnStart", getvariableofnpc( .minplayer2start, "bg_pvp#control" );
	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
guild_vs3	mapflag	hidemobhpbar

Can you add Countdown timer before it begin..  5 4 3 2 1 Start!! like that and a setwall so it blocks players before the countdown

after the count down disable walls Thankyou verry much

if i posted it on the wrong section letme know thanks

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

I saw your post in another topic says

On 3/30/2018 at 1:04 AM, celeron0134 said:

im still new and still learning how to script.

ok, so I just provide a topic link and let you figure out yourself 1st

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  194
  • Reputation:   1
  • Joined:  12/13/16
  • Last Seen:  

this is what i did didnt test it yet @AnnieRuru

//===== rAthena Script =======================================
//= Battleground: PVP
//===== By: ==================================================
//= AnnieRuru
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= rAthena Project
//===== Description: =========================================
//= A simple battleground script:
//= Kill players from the other team.
//===== Additional Comments: =================================
//= 1.0 First version, edited. [Euphy]
//============================================================

-	script	bg_pvp#control	-1,{
OnInit:
	.minplayer2start = 1;      // minimum players to start (ex. if 3vs3, set to 3)
	.eventlasting    = 20*60;  // event duration before auto-reset (20 minutes * seconds)
	setarray .rewarditem[0],   // rewards for the winning team: <item>,<amount>,...
		7828, 10;
	setarray .rewarditemloss[0],   // rewards for the lossing team: <item>,<amount>,...
		7828, 5;
	end;
OnStart:
	if ( getwaitingroomstate( 0, .rednpcname$ ) < .minplayer2start || getwaitingroomstate( 0, .bluenpcname$ ) < .minplayer2start )
		end;

	// create Battleground and teams
	.red = waitingroom2bg( "guild_vs3", 13,50, strnpcinfo(0)+"::OnRedQuit", strnpcinfo(0)+"::OnRedDead", .rednpcname$ );
	copyarray .team1aid, $@arenamembers, $@arenamembersnum;
	.team1count = .minplayer2start;
	.blue = waitingroom2bg( "guild_vs3", 86,50, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDead", .bluenpcname$ );
	copyarray .team2aid, $@arenamembers, $@arenamembersnum;
	.team2count = .minplayer2start;
	delwaitingroom .rednpcname$;
	delwaitingroom .bluenpcname$;
	setwall "guild_vs3", 19,55,12, 4, 0, "bg_pvp_town_blue";
    	setwall "guild_vs3", 80,55, 12, 4, 0, "bg_pvp_town_red";
	bg_warp .red, "guild_vs3", 13,50;
	bg_warp .blue, "guild_vs3", 86,50;
	.score[1] = .score[2] = .minplayer2start;
	bg_updatescore "guild_vs3", .score[1], .score[2];
    sleep 6000; 
    mapannounce "guild_vs3", "Rules are simple. The first one to break the opponent's emperium will get a score.", 0;
    sleep 3000;
    mapannounce "guild_vs3", "Score "+ .winningscore +" rounds to win ! ... GET READY", 0;
    sleep 2000;
    mapannounce "guild_vs3", "start!", 0;
    delwall "bg_pvp_town_red";
    delwall "bg_pvp_town_blue";


	// match duration
	sleep .eventlasting * 1000;

	// end match, destroy Battleground, reset NPCs
	if ( .score[1] > .score[2] ) {
		mapannounce "guild_vs3", "- Red Team is victorious! -", bc_map;
		callsub L_Reward, 1, 2;
	}
	else if ( .score[1] < .score[2] ) {
		mapannounce "guild_vs3", "- Blue Team is victorious! -", bc_map;
		callsub L_Reward, 2, 1;
	}
	else
		mapannounce "guild_vs3", "- The match has ended in a draw! -", bc_map;
	bg_warp .red, "prontera",152,178;
	bg_warp .blue, "prontera",154,178;
	bg_destroy .red;
	bg_destroy .blue;
	donpcevent .rednpcname$ +"::OnStart";
	donpcevent .bluenpcname$ +"::OnStart";
	end;

L_Reward:
	for ( .@i = 0; .@i < getd(".team"+ getarg(0) +"count"); .@i++ )
		getitem .rewarditem[0], .rewarditem[1], getd(".team"+ getarg(0) +"aid["+ .@i +"]" );
	for ( .@i = 0; .@i < getd(".team"+ getarg(1) +"count"); .@i++ )
		getitem .rewarditemloss[0], .rewarditemloss[1], getd(".team"+ getarg(1) +"aid["+ .@i +"]" );
	return;

// "OnDeath" event
OnRedDead:  callsub L_Dead, 1;
OnBlueDead: callsub L_Dead, 2;
L_Dead:
	.score[ getarg(0) ]--;
	bg_updatescore "guild_vs3", .score[1], .score[2];
	while ( getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ) != getcharid(3) && .@i < getd(".team"+ getarg(0) +"count") ) .@i++;
	deletearray getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ), 1;
	setd ".team"+ getarg(0) +"count", getd(".team"+ getarg(0) +"count") -1;
	bg_leave;
	if ( !.score[ getarg(0) ] )
		awake strnpcinfo(0);
	sleep2 1250;
	percentheal 100,100;
	end;
// "OnQuit" event
OnRedQuit:  callsub L_Quit, 1;
OnBlueQuit: callsub L_Quit, 2;
L_Quit:
	.score[ getarg(0) ]--;
	bg_updatescore "guild_vs3", .score[1], .score[2];
	percentheal 100, 100;
	while ( getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ) != getcharid(3) && .@i < getd(".team"+ getarg(0) +"count") ) .@i++;
	deletearray getd( ".team"+ getarg(0) +"aid["+ .@i +"]" ), 1;
	setd ".team"+ getarg(0) +"count", getd(".team"+ getarg(0) +"count") -1;
	if ( !.score[ getarg(0) ] )
		awake strnpcinfo(0);
	end;
}
quiz_02,247,383,5	script	Red Team#bg_pvp	733,{
	end;
OnInit:
	sleep 1;
	set getvariableofnpc( .rednpcname$, "bg_pvp#control" ), strnpcinfo(0);
OnStart:
	waitingroom "Red Team", getvariableofnpc( .minplayer2start, "bg_pvp#control" ) +1, "bg_pvp#control::OnStart", getvariableofnpc( .minplayer2start, "bg_pvp#control" );
	end;
}

quiz_02,252,383,5	script	Blue Team#bg_pvp	734,{
	end;
OnInit:
	sleep 1;
	set getvariableofnpc( .bluenpcname$, "bg_pvp#control" ), strnpcinfo(0);
OnStart:
	waitingroom "Blue Team", getvariableofnpc( .minplayer2start, "bg_pvp#control" ) +1, "bg_pvp#control::OnStart", getvariableofnpc( .minplayer2start, "bg_pvp#control" );
	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
guild_vs3	mapflag	hidemobhpbar

-	script	 BattleBadge#2	-1,{
OnPCKillEvent:
if (strcharinfo(3)=="guild_vs3" && killedrid != getcharid(3))
       getitem 7828,1;
end;
}

 

Edited by celeron0134
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

-    script     BattleBadge#2    -1,{
OnPCKillEvent:
if (strcharinfo(3)=="guild_vs3" && killedrid != getcharid(3))
       getitem 7828,1;
end;
}

I want to say, this kind of stuff should be discourage

on the MMORPG I played, I really do encounter people hiding in a corner of the map killing his/her own alt character to farm battleground points

I left it there 1st, but in time you'll take it out too when your players start abuse this system

 

hmm ...

mapannounce "guild_vs3", "Score "+ .winningscore +" rounds to win ! ... GET READY", 0;

... I tested in-game and it says "Score 0 rounds to win !"

you just copy-paste it from my other battleground script don't you ?

... there is no way Euphy revise my script and still have the 0 over there ... he would have changed it to bc_map

 

anyway ... yup, you did correctly

if you want to have ... multiple rounds to finish the battleground ... try this topic

t

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