Jump to content
  • 0

Add announcement when joining - custom BG


Yami

Question


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

Hi there, I would like to add an announcement when players join the custom battleground waiting room.

Script is the one provided @ npc/custom/battleground with just a little modification to my setup.

 

I would like to add this announcement everytime a player joins in. Thank you in advance!!

announce "Battleground 5v5 : "+.@Guillaume+"/5 Red Side | "+.@Croix+"/5 Blue Side",16;

And here's the script:

//===== 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_pvp1#control1	-1,{
OnInit:
	.minplayer2start = 5;      // minimum players to start (ex. if 3vs3, set to 3)
	.eventlasting    = 15*60;  // event duration before auto-reset (20 minutes * seconds)
	setarray .rewarditem[0],   // rewards for the winning team: <item>,<amount>,...
		7773, 15;
	end;
OnStart:
	if ( getwaitingroomstate( 0, .rednpcname$ ) < .minplayer2start || getwaitingroomstate( 0, .bluenpcname$ ) < .minplayer2start )
		end;

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

	// match duration
	sleep .eventlasting * 1000;

	// end match, destroy Battleground, reset NPCs
	if ( .score[1] > .score[2] ) {
		mapannounce "guild_vs1", "- Red Team is victorious! -", bc_map;
		callsub L_Reward, 1;
	}
	else if ( .score[1] < .score[2] ) {
		mapannounce "guild_vs1", "- Blue Team is victorious! -", bc_map;
		callsub L_Reward, 2;
	}
	else
		mapannounce "guild_vs1", "- The match has ended in a draw! -", bc_map;
	bg_warp .red, "prontera",156,182;
	bg_warp .blue, "prontera",156,182;
	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 +"]" );
	return;

// "OnDeath" event
OnRedDead:  callsub L_Dead, 1;
OnBlueDead: callsub L_Dead, 2;
L_Dead:
	.score[ getarg(0) ]--;
	bg_updatescore "guild_vs1", .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_vs1", .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;
}

prontera,147,162,5	script	Red Team#bg_pvp1	413,{
	mes "5v5 Battleground";
	mes "Time Limit : 15 minutes";
	mes "Cooldown : 0 minute";
	mes "Rewards";
	mes "Winner : 15";
	mes "Loser : 0";
	end;
OnInit:
	sleep 1;
	set getvariableofnpc( .rednpcname$, "bg_pvp1#control1" ), strnpcinfo(0);
OnStart:
	waitingroom "Battleground - 5v5", getvariableofnpc( .minplayer2start, "bg_pvp1#control1" ) +1, "bg_pvp1#control1::OnStart", getvariableofnpc( .minplayer2start, "bg_pvp1#control1" );
	end;
}

prontera,164,162,3	script	Blue Team#bg_pvp1	413,{
	mes "5v5 Battleground";
	mes "Time Limit : 15 minutes";
	mes "Cooldown : 0 minute";
	mes "Rewards";
	mes "Winner : 15";
	mes "Loser : 0";
	end;
OnInit:
	sleep 1;
	set getvariableofnpc( .bluenpcname$, "bg_pvp1#control1" ), strnpcinfo(0);
OnStart:
	waitingroom "Battleground - 5v5", getvariableofnpc( .minplayer2start, "bg_pvp1#control1" ) +1, "bg_pvp1#control1::OnStart", getvariableofnpc( .minplayer2start, "bg_pvp1#control1" );
	end;
}

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

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  82
  • Reputation:   40
  • Joined:  01/03/12
  • Last Seen:  

In both waitingroom of [Red Team#bg_pvp1] and [Blue Team#bg_pvp1] you need to chance the Trigger value from [ "bg_pvp1#control1::OnStart", getvariableofnpc( .minplayer2start, "bg_pvp1#control1" ) ] to 1. This will trigger the event "bg_pvp1#control1::OnStart" everytime a player enters the waiting room.

 

Then add your announce in OnStart label, just after the first if conditional:

OnStart:
	if ( getwaitingroomstate( 0, .rednpcname$ ) < .minplayer2start || getwaitingroomstate( 0, .bluenpcname$ ) < .minplayer2start ){
		announce "Battleground 5v5 : "+.@Guillaume+"/5 Red Side | "+.@Croix+"/5 Blue Side",16;
		end;
	}
Edited by Ragno
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

Hi ragno, thanks for the help. But I actually know where I'd put this script.

The thing is, that "+.@Guillaume+"/5 Red Side | "+.@Croix+"/5 doesn't belong in this script. This is from the official BG script I had. I wanted to know what's the correct variable to use that's why I provided the whole script for ppl to see.

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  


.@Guillaume = getwaitingroomstate( 0, .rednpcname$ );

.@Croix = getwaitingroomstate( 0, .bluenpcname$ );

if ( .@Guillaume < .minplayer2start || .@Croix < .minplayer2start ){

announce "Battleground 5v5 : "+.@Guillaume+"/5 Red Side | "+.@Croix+"/5 Blue Side",16;

end;

}

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   2
  • Joined:  01/02/14
  • Last Seen:  

Hi emistry, thank you for the codes you provided. But still no announcement upon joining. What's wrong :( please help

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  82
  • Reputation:   40
  • Joined:  01/03/12
  • Last Seen:  

Emistry's code is correct, Yami. Here is the complete script with the suggested editions:

//===== 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_pvp1#control1	-1,{
OnInit:
	.minplayer2start = 5;      // minimum players to start (ex. if 3vs3, set to 3)
	.eventlasting    = 15*60;  // event duration before auto-reset (20 minutes * seconds)
	setarray .rewarditem[0],   // rewards for the winning team: <item>,<amount>,...
		7773, 15;
	end;
OnStart:
	.@Guillaume = getwaitingroomstate( 0, .rednpcname$ );
	.@Croix = getwaitingroomstate( 0, .bluenpcname$ );
	if ( .@Guillaume < .minplayer2start || .@Croix < .minplayer2start ){
		announce "Battleground 5v5 : "+.@Guillaume+"/5 Red Side | "+.@Croix+"/5 Blue Side",16;
		end;
	}

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

	// match duration
	sleep .eventlasting * 1000;

	// end match, destroy Battleground, reset NPCs
	if ( .score[1] > .score[2] ) {
		mapannounce "guild_vs1", "- Red Team is victorious! -", bc_map;
		callsub L_Reward, 1;
	}
	else if ( .score[1] < .score[2] ) {
		mapannounce "guild_vs1", "- Blue Team is victorious! -", bc_map;
		callsub L_Reward, 2;
	}
	else
		mapannounce "guild_vs1", "- The match has ended in a draw! -", bc_map;
	bg_warp .red, "prontera",156,182;
	bg_warp .blue, "prontera",156,182;
	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 +"]" );
	return;

// "OnDeath" event
OnRedDead:  callsub L_Dead, 1;
OnBlueDead: callsub L_Dead, 2;
L_Dead:
	.score[ getarg(0) ]--;
	bg_updatescore "guild_vs1", .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_vs1", .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;
}

prontera,147,162,5	script	Red Team#bg_pvp1	413,{
	mes "5v5 Battleground";
	mes "Time Limit : 15 minutes";
	mes "Cooldown : 0 minute";
	mes "Rewards";
	mes "Winner : 15";
	mes "Loser : 0";
	end;
OnInit:
	sleep 1;
	set getvariableofnpc( .rednpcname$, "bg_pvp1#control1" ), strnpcinfo(0);
OnStart:
	waitingroom "Battleground - 5v5", getvariableofnpc( .minplayer2start, "bg_pvp1#control1" ) +1, "bg_pvp1#control1::OnStart", 1;
	end;
}

prontera,164,162,3	script	Blue Team#bg_pvp1	413,{
	mes "5v5 Battleground";
	mes "Time Limit : 15 minutes";
	mes "Cooldown : 0 minute";
	mes "Rewards";
	mes "Winner : 15";
	mes "Loser : 0";
	end;
OnInit:
	sleep 1;
	set getvariableofnpc( .bluenpcname$, "bg_pvp1#control1" ), strnpcinfo(0);
OnStart:
	waitingroom "Battleground - 5v5", getvariableofnpc( .minplayer2start, "bg_pvp1#control1" ) +1, "bg_pvp1#control1::OnStart", 1;
	end;
}

guild_vs1	mapflag	battleground	2
guild_vs1	mapflag	nosave	SavePoint
guild_vs1	mapflag	nowarp
guild_vs1	mapflag	nowarpto
guild_vs1	mapflag	noteleport
guild_vs1	mapflag	nomemo
guild_vs1	mapflag	nopenalty
guild_vs1	mapflag	nobranch
guild_vs1	mapflag	noicewall
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...