Jump to content
  • 0
Sign in to follow this  
caspa

custom_bg (3ceam)

Question

Spoiler

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

-	script	bg_pvp#control	-1,{
OnInit:
	.minplayer2start = 2;      // 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>,...
		501, 10;
	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$ );
	.blue = waitingroom2bg( "guild_vs3", 86,50, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDead", .bluenpcname$ );
	delwaitingroom .rednpcname$;
	delwaitingroom .bluenpcname$;
	bg_warp .red, "guild_vs3", 13,50;
	bg_warp .blue, "guild_vs3", 86,50;
	.red_score = .blue_score = .minplayer2start;
	bg_updatescore "guild_vs3", .red_score, .blue_score;

	// match duration
	sleep .eventlasting * 1000;

	// end match, destroy Battleground, reset NPCs
	if ( .red_score > .blue_score ) {
		mapannounce "guild_vs3", "- Red Team is victorious! -", bc_map;
		callsub L_Reward, .red;
	}
	else if ( .blue_score > .red_score ) {
		mapannounce "guild_vs3", "- Blue Team is victorious! -", bc_map;
		callsub L_Reward, .blue;
	}
	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:
	bg_get_data getarg(0), 1;
	for ( .@i = 0; .@i < $@arenamemberscount; ++.@i )
		getitem .rewarditem[0], .rewarditem[1], $@arenamembers[.@i];
	return;

// "OnDeath" event
OnRedDead:  callsub L_Dead, .red_score;
OnBlueDead: callsub L_Dead, .blue_score;
L_Dead:
	set getarg(0), getarg(0) -1;
	bg_updatescore "guild_vs3", .red_score, .blue_score;
	bg_leave;
	if ( !getarg(0) )
		awake strnpcinfo(0);
	sleep2 1250;
	percentheal 100,100;
	end;

// "OnQuit" event
OnRedQuit:  callsub L_Quit, .red_score;
OnBlueQuit: callsub L_Quit, .blue_score;
L_Quit:
	set getarg(0), getarg(0) -1;
	bg_updatescore "guild_vs3", .red_score, .blue_score;
	percentheal 100, 100;
	if ( !getarg(0) )
		awake strnpcinfo(0);
	end;
}

prontera,152,178,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;
}

prontera,154,178,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

 


good evening gent and ladies....... i have a script above that was created i think by euphy in collaboration with ms. annie or is it ms. annieruru's work only..
anyway the script above is set to have a starting score of 2 only or the amount of the people needed to activate the event... now what i would like for the script is that both team starts with 99 score.. then within 5 minutes the side with most kills wins the game! like when i kill someone from the other side, he/she just respawn to a part of the map and then can participate to the battle again.. and then after 5 mins both side gets warped out and whoever has the most kills from either side wins it... also.. 
 

Spoiler

-	script	custom_bg#control	-1,{
OnInit:
	set .minplayer2start, 2; // minimum player to start ... please do not set to 1
	setarray .rewarditem,
		501, 10, // reward to the winning team
		501, 3; // reward to the losing team
	set .startingscore, 15; // score at start
	set .eventlasting, 20*60; // event last 20 minutes or the system abort itself
	set .red_cloth, 1; // color value from red clothing
	set .blue_cloth, 2; // color value from blue clothing
	set .grey_cloth, 3; // color value from grey clothing
	end;
OnStart:
	if ( getwaitingroomstate( 0, .rednpcname$ ) < .minplayer2start || getwaitingroomstate( 0, .bluenpcname$ ) < .minplayer2start ) end;
	.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] =.startingscore;
	bg_updatescore "guild_vs3", .score[1], .score[2];
	callsub L_setleader, 1;
	callsub L_setleader, 2;
	for ( .@i = 0; .@i < .minplayer2start; .@i++ ) {
		attachrid .team1aid[.@i];
		@clotes_color = getlook( look_clothes_color );
		setlook look_clothes_color, ( .leader_aid[1] == getcharid(3) )? .grey_cloth : .red_cloth;
	}
	for ( .@i = 0; .@i < .minplayer2start; .@i++ ) {
		attachrid .team2aid[.@i];
		@clotes_color = getlook( look_clothes_color );
		setlook look_clothes_color, ( .leader_aid[2] == getcharid(3) )? .grey_cloth : .blue_cloth;
	}
	sleep .eventlasting * 1000;
	if ( .score[1] > .score[2] ) {
		mapannounce "guild_vs3", "red side wins !", 0;
		callsub L_reward, 1, 0;
		callsub L_reward, 2, 2;
	}
	else if ( .score[1] < .score[2] ) {
		mapannounce "guild_vs3", "blue side wins !", 0;
		callsub L_reward, 2, 0;
		callsub L_reward, 1, 2;
	}
	else {
		mapannounce "guild_vs3", "Draw !", 0;
		callsub L_reward, 1, 2;
		callsub L_reward, 2, 2;
	}
	bg_warp .red, "prontera",152,178;
	bg_warp .blue, "prontera",154,178;
	bg_destroy .red;
	bg_destroy .blue;
	donpcevent .rednpcname$ +"::OnStart";
	donpcevent .bluenpcname$ +"::OnStart";
	.leader_aid[1] = .leader_aid[2] = 0;
	for ( .@i = 0; .@i < .team1count; .@i++ ) {
		attachrid .team1aid[.@i];
		setlook look_clothes_color, @clotes_color;
		@clotes_color = 0;
	}
	for ( .@i = 0; .@i < .team2count; .@i++ ) {
		attachrid .team2aid[.@i];
		setlook look_clothes_color, @clotes_color;
		@clotes_color = 0;
	}
	end;
L_reward:
	for ( .@i = 0; .@i < getd(".team"+ getarg(0) +"count"); .@i++ )
		getitem .rewarditem[ getarg(1) ], .rewarditem[ getarg(1) +1 ], getd(".team"+ getarg(0) +"aid["+ .@i +"]" );
	return;
OnredDead: callsub L_dead, 1;
OnblueDead: callsub L_dead, 2;
L_dead:
	if ( .leader_aid[ getarg(0) ] != getcharid(3) )
		.score[ getarg(0) ]--;
	else {
		callsub L_setleader, getarg(0);
		.score[ getarg(0) ] -= 2;
	}
	bg_updatescore "guild_vs3", .score[1], .score[2];
	if ( .score[ getarg(0) ] <= 0 )
		awake strnpcinfo(0);
	sleep2 1250;
	percentheal 100,100;
	end;
OnredQuit: callsub L_quit, 1, .red;
OnblueQuit: callsub L_quit, 2, .blue;
L_quit:
	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 ( .leader_aid[ getarg(0) ] == getcharid(3) )
		callsub L_setleader, getarg(0);
	setlook look_clothes_color, @clotes_color;
	@clotes_color = 0;
	if ( bg_get_data( getarg(1), 0 ) > 1 ) end;
	.score[ getarg(0) ] = 0;
	awake strnpcinfo(0);
	end;
L_setleader:
	while ( ( .@tmp = getd( ".team"+ getarg(0) +"aid["+ rand( getd(".team"+ getarg(0) +"count") ) +"]" ) ) == playerattached() );
	.leader_aid[ getarg(0) ] = .@tmp;
	.@origin = playerattached();
	attachrid .leader_aid[ getarg(0) ];
	addtimer 1, strnpcinfo(0) +"::Onteam"+ getarg(0) +"leader";
	attachrid .@origin;
	return;
Onteam1leader: callsub L_lead, 1, 548;
Onteam2leader: callsub L_lead, 2, 549;
L_lead:
	while ( .leader_aid[ getarg(0) ] == getcharid(3) ) {
		specialeffect2 getarg(1);
		sleep2 1000;
	}
	end;
}

prontera,152,178,5	script	red side	733,{
	end;
OnInit:
	set getvariableofnpc( .rednpcname$, "custom_bg#control" ), strnpcinfo(0);
OnStart:
	waitingroom "Red Team", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );
	end;
}
prontera,154,178,5	script	blue side	734,{
	end;
OnInit:
	set getvariableofnpc( .bluenpcname$, "custom_bg#control" ), strnpcinfo(0);
OnStart:
	waitingroom "Blue Team", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#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

 

i'm using this script where the leader turns into grey and the members into red and i think if you kill the leader you get more points while if you kill the member you only get 1 point.. however i'm getting this kind of error and i can guess 100% that its probably because i'm using 3ceam...   ( kindly see the image below/uploaded below ) thank you so much everyone.. i hope you can help me.. thx in advance ...


P.S .... Also if possible.. i would like the to add a mapannounce function that if you join the red side... it would tell how many are currently in the waitingroom 

ex. "Fairy side has ["+ getwaitingroomstate(0) +"/"+ getvariableofnpc( .minplayer2start, "bg_emp#control" ) +"] Users.",0; " or something like that!!

2222.PNG

Edited by AnnieRuru
use [spoiler]+[code] tag when posting script > 10 lines

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

you're missing a set...
in the error line, it must be

while ( ( set .@tmp, getd( [...]

 

Share this post


Link to post
Share on other sites
  • 0
48 minutes ago, 15peaces said:

you're missing a set...
in the error line, it must be


while ( ( set .@tmp, getd( [...]

 

i'm still getting the error message... even though i put set already... :'(

222222.PNG

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.