Jump to content
  • 0

add reward for battle ground


BugSICK

Question


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  87
  • Reputation:   1
  • Joined:  01/18/18
  • Last Seen:  

this script is working but when i add additional reward, only the first reward give me, how to make it more than 1 reward? and how can i add reward for the losing characters. thanks

//===== 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    = 4*60;  // event duration before auto-reset (4 minutes * seconds)
	setarray .rewarditem[0],7828,2,7227,2;	// rewards for the winning team: <item>,<amount>,...
		
	end;
OnStart:
	if ( getwaitingroomstate( 0, .rednpcname$ ) < .minplayer2start || getwaitingroomstate( 0, .bluenpcname$ ) < .minplayer2start )
		end;

	// create Battleground and teams
	.red = waitingroom2bg( "guild_vs4", 8,49, strnpcinfo(0)+"::OnRedQuit", strnpcinfo(0)+"::OnRedDead", .rednpcname$ );
	copyarray .team1aid, $@arenamembers, $@arenamembersnum;
	.team1count = .minplayer2start;
	.blue = waitingroom2bg( "guild_vs4", 92,49, strnpcinfo(0)+"::OnBlueQuit", strnpcinfo(0)+"::OnBlueDead", .bluenpcname$ );
	copyarray .team2aid, $@arenamembers, $@arenamembersnum;
	.team2count = .minplayer2start;
	delwaitingroom .rednpcname$;
	delwaitingroom .bluenpcname$;
	bg_warp .red, "guild_vs4", 327,150;
	bg_warp .blue, "guild_vs4", 61,150;
	.score[1] = .score[2] = .minplayer2start;
	bg_updatescore "guild_vs4", .score[1], .score[2];

	// match duration
	sleep .eventlasting * 1000;

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

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

job3_arch03,24,30,5	script	Alpha	735,{
	end;
	
OnInit:
	sleep 1;
	set getvariableofnpc( .rednpcname$, "bg_pvp#control" ), strnpcinfo(0);
OnStart:
	waitingroom "Alpha", getvariableofnpc( .minplayer2start, "bg_pvp#control" ) +1, "bg_pvp#control::OnStart", getvariableofnpc( .minplayer2start, "bg_pvp#control" );
	end;
}

job3_arch03,33,30,5	script	Omega	792,{
	end;
	
OnInit:
	sleep 1;
	set getvariableofnpc( .bluenpcname$, "bg_pvp#control" ), strnpcinfo(0);
OnStart:
	waitingroom "Omega", getvariableofnpc( .minplayer2start, "bg_pvp#control" ) +1, "bg_pvp#control::OnStart", getvariableofnpc( .minplayer2start, "bg_pvp#control" );
	end;
}

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

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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