• 0
Sign in to follow this  
Strand

Battleground ' script_rid2sd: player not attached!

Question

I have this script for BG but what I want it to do is to add +1 point if Guillaume or Croix win at the end of the match.

 

	// =======================================================
	// Team Rewards
	// =======================================================
	if( .Guillaume_Score > .Croix_Score )
	{
		// Ganó Guillaume
		bg_item([email protected]_id1, 1);
		bg_item([email protected]_id2, 0);
		doevent "Flavius_CTF::OnGuillaumeWin";

	}
	else if( .Croix_Score > .Guillaume_Score )
	{
		// Ganó Croix
		bg_item([email protected]_id1, 0);
		bg_item([email protected]_id2, 1);
		doevent "Flavius_CTF::OnCroixWin";

	}
	else
	{
		// Empate, perdida ambos por default
		bg_item([email protected]_id1, 0);
		bg_item([email protected]_id2, 0);
		
	}

	mapannounce "bat_b02","Battle of Flavius CTF will start in 0 seconds!",1,0xA0522D;
	sleep 2000;
	bg_destroy [email protected]_id1;
	bg_destroy [email protected]_id2;
	set [email protected]_id1, 0;
	set [email protected]_id2, 0;
	mapwarp "bat_b02","arena_4",148,99;
	sleep 3000;
	initnpctimer;
	end;
	
	
	OnGuillaumeWin:
		query_sql "select rank_points from char_bg where char_id = "+ getcharid(0), [email protected];
		query_sql "insert into `char_bg` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 , 0 ) on duplicate key update `rank_points` = CASE WHEN rank_points >= 1 THEN points + 1 ELSE 0 END";	
		dispbottom "[Your Lost Battleground Rank -1 Total Pts: [email protected]]";
		
	OnCroixWin:			
		query_sql "select rank_points from char_bg where char_id = "+ getcharid(4), [email protected];
		query_sql "insert into `char_bg` value ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 , 0 ) on duplicate key update `rank_points` = CASE WHEN rank_points >= 1 THEN points + 1 ELSE 0 END";	
		dispbottom "[Your Lost Battleground Rank -1 Total Pts: [email protected]]";

But an error appears:

image.png.794f5dd4009ff73a1dd608ecaee3852c.png

What am I doing wrong? Can you please help?

Share this post


Link to post
Share on other sites

23 answers to this question

Recommended Posts

  • 0

I updated my post. Do anyone has an idea how to fix it?

Share this post


Link to post
Share on other sites
  • 0

This part is not correct, If im not mistaken.

dispbottom "[Your Lost Battleground Rank -1 Total Pts: [email protected]]";

it should be:

dispbottom "[Your Lost Battleground Rank -1 Total Pts: " + .@points + "]";

 

Share this post


Link to post
Share on other sites
  • 0

Hello @Radian

Thanks for the observation. About the player not attached, do you know how to attach the player? It is a script not a NPC.

Share this post


Link to post
Share on other sites
  • 0

The error says that this part

doevent "Flavius_CTF::OnGuillaumeWin";

or the npc is not active means its missing from your script. or maybe try putting the whole script here.

Share this post


Link to post
Share on other sites
  • 0

Hello @Radian,

I tried something different. I want for the team winner to earn points through "addfame" command, but, when triggering the OnGuillaumeWin event, the system says the player is not attached.

  Is there any way to attach the player? I've tried so many times but I just simply can't...

Here is the full script:

// ==============================================================================
// BattleGround System - Flavius Capture the Flag
// ==============================================================================


// Battleground Flags
// *********************************************************************

bat_b02,328,150,0	script	Guillaume Crystal::Guillaume_Flag	1914,1,1,{
	end;

OnTouch:
	if( [email protected] != 1 || HP < 1 )
		end;

	if( getcharid(4) == [email protected]_id2 && .Flag_Status < 2 )
	{ // Flag Captured
		set .Flag_Status, 2; // Taken
		set .Flag_Carrier, getcharid(0);

		sc_end SC_HIDING;
		sc_end SC_CLOAKING;
		sc_end SC_CHASEWALK;
		// Renewal invisibility
		sc_end SC_CLOAKINGEXCEED;
		sc_end SC_CAMOUFLAGE;
		sc_end SC__INVISIBILITY;

		pcblock 1,1; // Block Skills/Items

		mapannounce "bat_b02","Guillaume Crystal Taken by [ " + strcharinfo(0) + " ]",1,0xFF0000;
		bg_rankpoints "ctf_taken",1;
		disablenpc "Guillaume_Flag";
		addtimer 2000, "Flavius_CTF::OnBlueFlash";
		stopnpctimer;
	}
	else if( getcharid(4) == [email protected]_id1 )
	{
		if( .Flag_Status == 0 && getvariableofnpc(.Flag_Carrier,"Croix_Flag") == getcharid(0) )
		{
			set getvariableofnpc(.Flag_Carrier,"Croix_Flag"),0;
			set .Flag_Carrier, 0;
			mapannounce "bat_b02","Croix Crystal Captured by [ " + strcharinfo(0) + " ]!!",1,0x0000FF;
			bg_rankpoints "ctf_captured",1;
			pcblock 1,0; // UnBlock Skills/Items
			stopnpctimer;
			donpcevent "Flavius_CTF::OnGuillaumeScore";
		}
		else if( .Flag_Status == 1 )
		{
			mapannounce "bat_b02","Guillaume Crystal Returned by [ " + strcharinfo(0) + " ]!!",1,0x0000FF;
			bg_rankpoints "fame",1;
			disablenpc "Guillaume_Flag";
			sleep 2000;
			movenpc "Guillaume_Flag",328,150; // Back to Base
			set .Flag_Status, 0;
			initnpctimer;
			enablenpc "Guillaume_Flag";
		}
	}
	end;

OnTimer2000:
	stopnpctimer;
	if( .Flag_Status < 2 )
	{
		getmapxy [email protected]$, [email protected], [email protected], 1;
		viewpointmap "bat_b02",1, [email protected], [email protected], 1, 0x0000FF;
		specialeffect 223;
		initnpctimer;
	}
	end;

OnBase:
	movenpc "Guillaume_Flag",328,150;
	set .Flag_Status, 0;
	set .Flag_Carrier, 0;
	initnpctimer;
	enablenpc "Guillaume_Flag";
	end;
}

bat_b02,62,150,0	script	Croix Crystal::Croix_Flag	1915,1,1,{
	end;

OnTouch:
	if( [email protected] != 1 || HP < 1 )
		end;

	if( getcharid(4) == [email protected]_id1 && .Flag_Status < 2 )
	{ // Flag Captured
		set .Flag_Status, 2; // Taken
		set .Flag_Carrier, getcharid(0);

		sc_end SC_HIDING;
		sc_end SC_CLOAKING;
		sc_end SC_CHASEWALK;
		// Renewal invisibility
		sc_end SC_CLOAKINGEXCEED;
		sc_end SC_CAMOUFLAGE;
		sc_end SC__INVISIBILITY;

		pcblock 1,1; // Block Skills/Items

		mapannounce "bat_b02","Croix Crystal Taken by [ " + strcharinfo(0) + " ]",1,0x0000FF;
		bg_rankpoints "ctf_taken",1;
		disablenpc "Croix_Flag";
		addtimer 2000, "Flavius_CTF::OnRedFlash";
		stopnpctimer;
	}
	else if( getcharid(4) == [email protected]_id2 )
	{
		if( .Flag_Status == 0 && getvariableofnpc(.Flag_Carrier,"Guillaume_Flag") == getcharid(0) )
		{
			set getvariableofnpc(.Flag_Carrier,"Guillaume_Flag"),0;
			set .Flag_Carrier, 0;
			mapannounce "bat_b02","Guillaume Crystal Captured by [ " + strcharinfo(0) + " ]!!",1,0xFF0000;
			bg_rankpoints "ctf_captured",1;
			pcblock 1,0; // UnBlock Skills/Items
			stopnpctimer;
			donpcevent "Flavius_CTF::OnCroixScore";
		}
		else if( .Flag_Status == 1 )
		{
			mapannounce "bat_b02","Croix Crystal Returned by [ " + strcharinfo(0) + " ]!!",1,0xFF0000;
			bg_rankpoints "fame",1;
			disablenpc "Croix_Flag";
			sleep 2000;
			movenpc "Croix_Flag",62,150; // Back to Base
			set .Flag_Status, 0;
			initnpctimer;
			enablenpc "Croix_Flag";
		}
	}
	end;

OnTimer2000:
	stopnpctimer;
	if( .Flag_Status < 2 )
	{
		getmapxy [email protected]$, [email protected], [email protected], 1;
		viewpointmap "bat_b02",1, [email protected], [email protected], 2, 0xFF0000;
		specialeffect 223;
		initnpctimer;
	}
	end;

OnBase:
	movenpc "Croix_Flag",62,150;
	set .Flag_Status, 0;
	set .Flag_Carrier, 0;
	initnpctimer;
	enablenpc "Croix_Flag";
	end;
}

// Battleground Engine
// *********************************************************************

-	script	Flavius_CTF	-1,{
	end;

OnBlueFlash:
	if( getvariableofnpc(.Flag_Carrier,"Guillaume_Flag") == getcharid(0) && [email protected] == 1 )
	{
		getmapxy [email protected]$, [email protected], [email protected], 0;
		viewpointmap "bat_b02",1, [email protected], [email protected], 1, 0x0000FF;
		specialeffect2 73;
		emotion e_hlp,1;
		addtimer 2000, "Flavius_CTF::OnBlueFlash";
		percentheal -5,-5;
	}
	end;

OnRedFlash:
	if( getvariableofnpc(.Flag_Carrier,"Croix_Flag") == getcharid(0) && [email protected] == 1 )
	{
		getmapxy [email protected]$, [email protected], [email protected], 0;
		viewpointmap "bat_b02",1, [email protected], [email protected], 2, 0xFF0000;
		specialeffect2 73;
		emotion e_hlp,1;
		addtimer 2000, "Flavius_CTF::OnRedFlash";
		percentheal -5,-5;
	}
	end;

OnInit:
	disablenpc "Guillaume_Flag";
	disablenpc "Croix_Flag";
	end;

OnGuillaumeQuit:
OnCroixQuit:
	callfunc("bgsetwaittime","CTF",180);
	set @killer_bg_src, 0;
	if( [email protected] != 0 )
		donpcevent "Flavius_CTF::OnDoBalance";
OnGuillaumeDie:
	if( [email protected] == 1 && getvariableofnpc(.Flag_Carrier,"Croix_Flag") == getcharid(0) )
	{ // Drop Flag
		set getvariableofnpc(.Flag_Carrier,"Croix_Flag"), 0;
		pcblock 1,0; // UnBlock Skills/Items
		getmapxy [email protected]$, [email protected], [email protected], 0;
		movenpc "Croix_Flag", [email protected], [email protected];
		mapannounce "bat_b02","Croix Flag Droped by [ " + strcharinfo(0) + " ]",1,0xFF0000;
		bg_rankpoints "ctf_droped",1;
		bg_rankpoints "fame",1,@killer_bg_src;
		set getvariableofnpc(.Flag_Status,"Croix_Flag"), 1; // OnFloor
		initnpctimer "Croix_Flag";
		enablenpc "Croix_Flag";
	}
	end;
	
OnCroixDie:
	if( [email protected] == 1 && getvariableofnpc(.Flag_Carrier,"Guillaume_Flag") == getcharid(0) )
	{ // Drop Flag
		set getvariableofnpc(.Flag_Carrier,"Guillaume_Flag"), 0;
		pcblock 1,0; // UnBlock Skills/Items
		getmapxy [email protected]$, [email protected], [email protected], 0;
		movenpc "Guillaume_Flag", [email protected], [email protected];
		mapannounce "bat_b02","Guillaume Flag Droped by [ " + strcharinfo(0) + " ]",1,0x0000FF;
		bg_rankpoints "ctf_droped",1;
		bg_rankpoints "fame",1,@killer_bg_src;
		set getvariableofnpc(.Flag_Status,"Guillaume_Flag"), 1; // OnFloor
		initnpctimer "Guillaume_Flag";
		enablenpc "Guillaume_Flag";
	}
	end;

OnGuillaumeJoin:
OnCroixJoin:
	if( [email protected] == 0 )
		donpcevent "Flavius_CTF::OnReadyCheck";
	else
		donpcevent "Flavius_CTF::OnDoBalance";
	end;

OnDoBalance:
	if( [email protected] != 1 )
		end;

	set [email protected], bg_get_data([email protected]_id1, 0);
	set [email protected], bg_get_data([email protected]_id2, 0);

	if( [email protected] < [email protected] )
		waitingroom2bg_single [email protected]_id1,"bat_b02",311,224,"BGAZUL";
	else if( [email protected] > [email protected] )
		waitingroom2bg_single [email protected]_id2,"bat_b02",87,75,"BGROJO";
	else
	{
		set [email protected], getwaitingroomstate(0,"BGAZUL");
		set [email protected], getwaitingroomstate(0,"BGROJO");

		if( [email protected] <= [email protected] )
			set [email protected], [email protected];
		else
			set [email protected], [email protected];

		if( [email protected] + [email protected] > 35 )
			set [email protected], 35 - [email protected];
		if( [email protected] <= 0 ) end;

		for( set [email protected], 0; [email protected] < [email protected]; set [email protected], [email protected] + 1 )
		{
			waitingroom2bg_single [email protected]_id1,"bat_b02",311,224,"BGAZUL";
			waitingroom2bg_single [email protected]_id2,"bat_b02",87,75,"BGROJO";
		}

		set [email protected], [email protected] + [email protected];
		set [email protected], [email protected] + [email protected];
		mapannounce "arena_4","Battleground -- Flavius CTF [80-99] G: " + [email protected] + "/35, C: " + [email protected] + "/35 (Playing)",1,0xA0522D;
	}
	end;

OnReadyCheck:
	if( [email protected] || $CURRENTBG != 5 )
		end;
	set [email protected], getwaitingroomstate(0,"BGAZUL");
	set [email protected], getwaitingroomstate(0,"BGROJO");
	
	if( [email protected] < ($MINBGLIMIT - 1) || [email protected] < ($MINBGLIMIT - 1) )
	{
		if( [email protected] > 3 && [email protected] > 3 && !agitcheck() && [email protected]_Flood < gettimetick(2) )
		{
			announce "Battleground -- Flavius CTF [80-99] G: " + [email protected] + "/"+($MINBGLIMIT - 1)+", C: " + [email protected] + "/"+($MINBGLIMIT - 1),0,0xA0522D;
			set [email protected]_Flood, gettimetick(2) + 15;
		}
		else
			mapannounce "arena_4","Battleground -- Flavius CTF [80-99] G: " + [email protected] + "/"+($MINBGLIMIT - 1)+", C: " + [email protected] + "/"+($MINBGLIMIT - 1),1,0xA0522D;
		end;
	}

	set [email protected], 1;
	initnpctimer;

	donpcevent "BGROJO::OnEnterBG";
	donpcevent "BGAZUL::OnEnterBG";
	// BG Variables
	set .Guillaume_Score, 0;
	set .Croix_Score, 0;
	announce "Battleground -- Flavius CTF [80-99] has started!",0,0xA0522D;
	sleep 2000;
	bg_warp [email protected]_id1,"bat_b02",311,224;
	bg_warp [email protected]_id2,"bat_b02",87,75;
	sleep 3000;
	// Respawn NPC's
	donpcevent "#guictf_respawn::OnBGStart";
	donpcevent "#croctf_respawn::OnBGStart";
	// Start Match!!
	donpcevent "Flavius_CTF::OnMatchStart";
	end;

OnMatchStart:
	if( [email protected] != 1 )
		end;

	// Flags2Base
	donpcevent "Guillaume_Flag::OnBase";
	donpcevent "Croix_Flag::OnBase";
	mapannounce "bat_b02","The Flags have been set to their Bases!!",8;
	end;

OnGuillaumeScore:
	set .Guillaume_Score, .Guillaume_Score + 1;
	donpcevent "Flavius_CTF::OnMatchStop";
	end;

OnCroixScore:
	set .Croix_Score, .Croix_Score + 1;
	donpcevent "Flavius_CTF::OnMatchStop";
	end;

OnMatchStop:
	disablenpc "Guillaume_Flag";
	disablenpc "Croix_Flag";
	bg_updatescore "bat_b02",.Guillaume_Score,.Croix_Score;

	viewpointmap "bat_b02",2, 0, 0, 1, 0x0000FF;
	viewpointmap "bat_b02",2, 0, 0, 2, 0xFF0000;
	
	if( .Guillaume_Score > 2 )
	{ // Guillaume Won
		mapannounce "bat_b02","The Guillaume army has won the Battle of Flavius CTF!",1,0x0000FF;
		donpcevent "Flavius_CTF::OnMatchEnd";
	}
	else if( .Croix_Score > 2 )
	{ // Croix Won
		mapannounce "bat_b02","The Croix army has won the Battle of Flavius CTF!",1,0xFF0000;
		donpcevent "Flavius_CTF::OnMatchEnd";
	}
	else
	{ // Keep Playing
		sleep 8000;
		donpcevent "Flavius_CTF::OnMatchStart";
	}
	end;

OnTimer600000:
	mapannounce "bat_b02","The Battle will ends in 5 minutes!!",1,0xA0522D;
	end;

OnTimer840000:
	mapannounce "bat_b02","The Battle will ends in 1 minute!!",1,0xA0522D;
	end;

OnTimer900000:
	disablenpc "Guillaume_Flag";
	disablenpc "Croix_Flag";

	viewpointmap "bat_b02",2, 0, 0, 1, 0x0000FF;
	viewpointmap "bat_b02",2, 0, 0, 2, 0xFF0000;

	if( .Guillaume_Score > .Croix_Score )
		mapannounce "bat_b02","The Guillaume army has won the Battle of Flavius CTF!",1,0x0000FF;
	else if( .Guillaume_Score < .Croix_Score )
		mapannounce "bat_b02","The Croix army has won the Battle of Flavius CTF!",1,0xFF0000;
	else
		mapannounce "bat_b02","The battle is over. This is a Tie...!",1,0xA0522D;
	donpcevent "Flavius_CTF::OnMatchEnd";
	end;

OnMatchEnd:
	stopnpctimer;
	disablenpc "Guillaume_Flag";
	disablenpc "Croix_Flag";
	donpcevent "#guictf_respawn::OnBGStop";
	donpcevent "#croctf_respawn::OnBGStop";
	set [email protected], 2; //bg_status
	
	//[Oboro] Rotacion de BG
	ChangeBG();
	
	// =======================================================
	// Team Rewards
	// =======================================================
	if( .Guillaume_Score > .Croix_Score )
	{
		// Ganó Guillaume
		bg_item([email protected]_id1, 1);
		bg_item([email protected]_id2, 0);
		donpcevent "Flavius_CTF::OnGuillaumeWin";
	}
	else if( .Croix_Score > .Guillaume_Score )
	{
		// Ganó Croix
		bg_item([email protected]_id1, 0);
		bg_item([email protected]_id2, 1);
	}
	else
	{
		// Empate, perdida ambos por default
		bg_item([email protected]_id1, 0);
		bg_item([email protected]_id2, 0);
	}

	mapannounce "bat_b02","Battle of Flavius CTF will start in 0 seconds!",1,0xA0522D;
	sleep 2000;
	bg_destroy [email protected]_id1;
	bg_destroy [email protected]_id2;
	set [email protected]_id1, 0;
	set [email protected]_id2, 0;
	mapwarp "bat_b02","arena_4",148,99;
	sleep 3000;
	initnpctimer;
	end;

OnGuillaumeWin:
atcommand "#addfame "+strcharinfo(0)" 2 100";
// atcommand "@addfame 2 100";
end;

OnTimer10000:
	if( [email protected] == 2 )
		mapannounce "bat_b02","Battle of Flavius CTF will start in 5 seconds!",1,0xA0522D;
	end;

OnTimer15000:
	if( [email protected] != 2 )
		end;
OnReset:
	stopnpctimer;
	set .Guillaume_Score, 0;
	set .Croix_Score, 0;
	disablenpc "Guillaume_Flag";
	disablenpc "Croix_Flag";
	sleep 1000;
	mapwarp "bat_b02","arena_4",148,99;
	sleep 1000;
	maprespawnguildid "bat_b02",0,3; // Just in case someone else
	bg_updatescore "bat_b02",0,0;
	set [email protected], 0;
	donpcevent "Flavius_CTF::OnReadyCheck";
	end;
}

// Battleground Therapist
// *********************************************************************

bat_b02,390,13,5	script	Therapist in battle#ctf1	95,{
	percentheal 100,100;
	sc_start 32,  250000, 10;  // Increase Agi
	sc_start 30,  250000, 10;  // Blessing
	repairall;
	end;
OnTouch:
	percentheal 100,100;
	sc_start 32,  250000, 10;  // Increase Agi
	sc_start 30,  250000, 10;  // Blessing
	repairall;
	end;
}

bat_b02,10,293,5	script	Therapist in battle#ctf2	95,{
	percentheal 100,100;
	sc_start 32,  250000, 10;  // Increase Agi
	sc_start 30,  250000, 10;  // Blessing
	repairall;
	end;
OnTouch:
	percentheal 100,100;
	sc_start 32,  250000, 10;  // Increase Agi
	sc_start 30,  250000, 10;  // Blessing
	repairall;
	end;
}

// Battleground Respawn
// *********************************************************************

bat_b02,390,10,0	script	#guictf_respawn	139,{
	end;

OnBGStart:
	initnpctimer;
	end;

OnBGStop:
	stopnpctimer;
	end;

OnTimer24000:
	misceffect 83;
	end;

OnTimer25000:
	areapercentheal "bat_b02",382,2,397,17,100,100;
	areawarp "bat_b02",382,2,397,17,"bat_b02",311,224;
	initnpctimer;
	end;
}

bat_b02,10,290,0	script	#croctf_respawn	139,{
	end;

OnBGStart:
	initnpctimer;
	end;

OnBGStop:
	stopnpctimer;
	end;

OnTimer24000:
	misceffect 83;
	end;

OnTimer25000:
	areapercentheal "bat_b02",2,282,17,297,100,100;
	areawarp "bat_b02",2,282,17,297,"bat_b02",87,75;
	initnpctimer;
	end;
}

// Flags
// *********************************************************************

bat_b02,304,231,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat23	973
bat_b02,319,231,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat24	973
bat_b02,304,218,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat25	973
bat_b02,319,218,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat26	973
bat_b02,304,231,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat27	973
bat_b02,304,231,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat28	973
bat_b02,335,142,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat29	973
bat_b02,335,157,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat30	973
bat_b02,390,16,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat31	973
bat_b02,292,163,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat32	973
bat_b02,292,136,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat33	973
bat_b02,241,185,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat34	973
bat_b02,247,179,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat35	973

bat_b02,96,81,1	duplicate(Croix camp#bat)	Croix camp#bat22	974
bat_b02,96,68,1	duplicate(Croix camp#bat)	Croix camp#bat23	974
bat_b02,79,81,1	duplicate(Croix camp#bat)	Croix camp#bat24	974
bat_b02,79,68,1	duplicate(Croix camp#bat)	Croix camp#bat25	974
bat_b02,96,81,1	duplicate(Croix camp#bat)	Croix camp#bat26	974
bat_b02,96,81,1	duplicate(Croix camp#bat)	Croix camp#bat27	974
bat_b02,59,164,1	duplicate(Croix camp#bat)	Croix camp#bat28	974
bat_b02,59,137,1	duplicate(Croix camp#bat)	Croix camp#bat29	974
bat_b02,10,296,1	duplicate(Croix camp#bat)	Croix camp#bat30	974
bat_b02,110,162,1	duplicate(Croix camp#bat)	Croix camp#bat31	974
bat_b02,110,137,1	duplicate(Croix camp#bat)	Croix camp#bat32	974
bat_b02,152,120,1	duplicate(Croix camp#bat)	Croix camp#bat33	974
bat_b02,158,114,1	duplicate(Croix camp#bat)	Croix camp#bat34	974

// MapFlags
// *********************************************************************

bat_b02	mapflag	battleground	2
bat_b02	mapflag	nomemo
bat_b02	mapflag	nosave	SavePoint
bat_b02	mapflag	noteleport
bat_b02	mapflag	nowarp
bat_b02	mapflag	nowarpto
bat_b02	mapflag	noreturn
bat_b02	mapflag	nobranch
bat_b02	mapflag	nopenalty
bat_b02	mapflag	noemergencycall

 

Hello community,

Is there anyone that could possibly help me on this?

Thanks a lot in advance.

Share this post


Link to post
Share on other sites
  • 0
	// =======================================================
	// Team Rewards
	// =======================================================
	if( .Guillaume_Score > .Croix_Score )
	{
		// Ganó Guillaume
		bg_item([email protected]_id1, 1);
		bg_item([email protected]_id2, 0);
	}
	else if( .Croix_Score > .Guillaume_Score )
	{
		// Ganó Croix
		bg_item([email protected]_id1, 0);
		bg_item([email protected]_id2, 1);
	}
	else
	{
		// Empate, perdida ambos por default
		bg_item([email protected]_id1, 0);
		bg_item([email protected]_id2, 0);
	}
	donpcevent strnpcinfo(3)+"::OnAddPoint";   // <------ ADD THIS

and add this part

OnAddPoint:
	if( .Guillaume_Score > .Croix_Score )
		[email protected]_id = [email protected]_id1;
	else if( .Croix_Score > .Guillaume_Score )
		[email protected]_id = [email protected]_id2;
	
	if ([email protected]_id) {
		[email protected] = bg_get_data([email protected]_id, 1);
		copyarray [email protected], [email protected], [email protected];
		for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
			if (attachrid([email protected][[email protected]])) {
				atcommand "@addfame 2 100";
				dispbottom "You gained 100 Fame for winning.";
				detachrid;
			}
		}
	}
	end;

 

Edited by Emistry

Share this post


Link to post
Share on other sites
  • 0

Thanks @Emistry, you are such a monster!

I have another question, how do I do to also recognize the team loser and lose points? atcommand "@addfame 2 -100";

Share this post


Link to post
Share on other sites
  • 0
6 minutes ago, Strand said:

Thanks @Emistry, you are such a monster!

I have another question, how do I do to also recognize the team loser and lose points? atcommand "@addfame 2 -100";

OnAddPoint:
	if( .Guillaume_Score > .Croix_Score ) {
		[email protected]_bg_id = [email protected]_id1;
		[email protected]_bg_id = [email protected]_id2;
	}
	else if( .Croix_Score > .Guillaume_Score ) {
		[email protected]_bg_id = [email protected]_id2;
		[email protected]_bg_id = [email protected]_id1;
	}
	
	if ([email protected]_bg_id) {
		[email protected] = bg_get_data([email protected]_bg_id, 1);
		copyarray [email protected], [email protected], [email protected];
		for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
			if (attachrid([email protected][[email protected]])) {
				atcommand "@addfame 2 100";
				dispbottom "You gained 100 Fame for winning.";
				detachrid;
			}
		}
	}
	if ([email protected]_bg_id) {
		[email protected] = bg_get_data([email protected]_bg_id, 1);
		copyarray [email protected], [email protected], [email protected];
		for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
			if (attachrid([email protected][[email protected]])) {
				atcommand "@addfame 2 -100";
				dispbottom "You lose 100 Fame for losing.";
				detachrid;
			}
		}
	}
	end;

 

Share this post


Link to post
Share on other sites
  • 0

Thanks @Emistry,

  Apparently, it is considering the same team as the loser. The team who lose does not get their points removed:

image.png.ebf4434b0232a9489609661c0948db22.png

I tried so many different ways as I could but the only one who receives and loses points is just one team. The team loser is not losing points at all.

Share this post


Link to post
Share on other sites
  • 0

@Strand

Maybe try changing

atcommand "@addfame 2 -100";

into this?

charcommand "#addfame 2 -100";

 

Edited by Radian

Share this post


Link to post
Share on other sites
  • 0

@Radian,

The thing is: Player in team winner is receiving both commands for winner and loser:

image.png.3cae05f7558631f117112671edb4a492.png

And Player in team loser is receiving none:

image.png.bd804738b3aa3ec68f7bb274e4f57de7.png

Share this post


Link to post
Share on other sites
  • 0
9 minutes ago, Strand said:

@Radian,

The thing is: Player in team winner is receiving both commands for winner and loser:

image.png.3cae05f7558631f117112671edb4a492.png

And Player in team loser is receiving none:

image.png.bd804738b3aa3ec68f7bb274e4f57de7.png

Put end after this

detachrid;
end; // < like this

and then revert the suggestion i made.

Edited by Radian

Share this post


Link to post
Share on other sites
  • 0

@Radian,

Yes, you are right. Now, the player in the losing team is not losing points. Like if the script is wrong or something.

Share this post


Link to post
Share on other sites
  • 0

try

OnAddPoint:
	if( .Guillaume_Score > .Croix_Score ) {
		[email protected]_bg_id = [email protected]_id1;
		[email protected]_bg_id = [email protected]_id2;
	}
	else if( .Croix_Score > .Guillaume_Score ) {
		[email protected]_bg_id = [email protected]_id2;
		[email protected]_bg_id = [email protected]_id1;
	}
	else end;
	
	[email protected] = bg_get_data([email protected]_bg_id, 1);
	copyarray [email protected], [email protected], [email protected];
	[email protected] = bg_get_data([email protected]_bg_id, 1);
	copyarray [email protected], [email protected], [email protected];
	
	for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
		if (attachrid([email protected][[email protected]])) {
			atcommand "@addfame 2 100";
			dispbottom "You gained 100 Fame for winning.";
			detachrid;
		}
	}
	
	for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
		if (attachrid([email protected][[email protected]])) {
			atcommand "@addfame 2 -100";
			dispbottom "You lose 100 Fame for losing.";
			detachrid;
		}
	}
	end;

 

Share this post


Link to post
Share on other sites
  • 0

@Emistry,

The player in the team winner is still receiving and losing points. The other player in team loser is not losing anything like if the script is not recognizing him.

image.png.0d8d99ccc598ec5cd3145a08af1e38c4.png

Whole script:

// ==============================================================================
// BattleGround System - Flavius Capture the Flag
// ==============================================================================


// Battleground Flags
// *********************************************************************

bat_b02,328,150,0	script	Guillaume Crystal::Guillaume_Flag	1914,1,1,{
	end;

OnTouch:
	if( [email protected] != 1 || HP < 1 )
		end;

	if( getcharid(4) == [email protected]_id2 && .Flag_Status < 2 )
	{ // Flag Captured
		set .Flag_Status, 2; // Taken
		set .Flag_Carrier, getcharid(0);

		sc_end SC_HIDING;
		sc_end SC_CLOAKING;
		sc_end SC_CHASEWALK;
		// Renewal invisibility
		sc_end SC_CLOAKINGEXCEED;
		sc_end SC_CAMOUFLAGE;
		sc_end SC__INVISIBILITY;

		pcblock 1,1; // Block Skills/Items

		mapannounce "bat_b02","Guillaume Crystal Taken by [ " + strcharinfo(0) + " ]",1,0xFF0000;
//		bg_rankpoints "ctf_taken",1;
		disablenpc "Guillaume_Flag";
		addtimer 2000, "Flavius_CTF::OnBlueFlash";
		stopnpctimer;
	}
	else if( getcharid(4) == [email protected]_id1 )
	{
		if( .Flag_Status == 0 && getvariableofnpc(.Flag_Carrier,"Croix_Flag") == getcharid(0) )
		{
			set getvariableofnpc(.Flag_Carrier,"Croix_Flag"),0;
			set .Flag_Carrier, 0;
			mapannounce "bat_b02","Croix Crystal Captured by [ " + strcharinfo(0) + " ]!!",1,0x0000FF;
//			bg_rankpoints "ctf_captured",1;
			pcblock 1,0; // UnBlock Skills/Items
			stopnpctimer;
			donpcevent "Flavius_CTF::OnGuillaumeScore";
		}
		else if( .Flag_Status == 1 )
		{
			mapannounce "bat_b02","Guillaume Crystal Returned by [ " + strcharinfo(0) + " ]!!",1,0x0000FF;
//			bg_rankpoints "fame",1;
			disablenpc "Guillaume_Flag";
			sleep 2000;
			movenpc "Guillaume_Flag",328,150; // Back to Base
			set .Flag_Status, 0;
			initnpctimer;
			enablenpc "Guillaume_Flag";
		}
	}
	end;

OnTimer2000:
	stopnpctimer;
	if( .Flag_Status < 2 )
	{
		getmapxy [email protected]$, [email protected], [email protected], 1;
		viewpointmap "bat_b02",1, [email protected], [email protected], 1, 0x0000FF;
		specialeffect 223;
		initnpctimer;
	}
	end;

OnBase:
	movenpc "Guillaume_Flag",328,150;
	set .Flag_Status, 0;
	set .Flag_Carrier, 0;
	initnpctimer;
	enablenpc "Guillaume_Flag";
	end;
}

bat_b02,62,150,0	script	Croix Crystal::Croix_Flag	1915,1,1,{
	end;

OnTouch:
	if( [email protected] != 1 || HP < 1 )
		end;

	if( getcharid(4) == [email protected]_id1 && .Flag_Status < 2 )
	{ // Flag Captured
		set .Flag_Status, 2; // Taken
		set .Flag_Carrier, getcharid(0);

		sc_end SC_HIDING;
		sc_end SC_CLOAKING;
		sc_end SC_CHASEWALK;
		// Renewal invisibility
		sc_end SC_CLOAKINGEXCEED;
		sc_end SC_CAMOUFLAGE;
		sc_end SC__INVISIBILITY;

		pcblock 1,1; // Block Skills/Items

		mapannounce "bat_b02","Croix Crystal Taken by [ " + strcharinfo(0) + " ]",1,0x0000FF;
//		bg_rankpoints "ctf_taken",1;
		disablenpc "Croix_Flag";
		addtimer 2000, "Flavius_CTF::OnRedFlash";
		stopnpctimer;
	}
	else if( getcharid(4) == [email protected]_id2 )
	{
		if( .Flag_Status == 0 && getvariableofnpc(.Flag_Carrier,"Guillaume_Flag") == getcharid(0) )
		{
			set getvariableofnpc(.Flag_Carrier,"Guillaume_Flag"),0;
			set .Flag_Carrier, 0;
			mapannounce "bat_b02","Guillaume Crystal Captured by [ " + strcharinfo(0) + " ]!!",1,0xFF0000;
//			bg_rankpoints "ctf_captured",1;
			pcblock 1,0; // UnBlock Skills/Items
			stopnpctimer;
			donpcevent "Flavius_CTF::OnCroixScore";
		}
		else if( .Flag_Status == 1 )
		{
			mapannounce "bat_b02","Croix Crystal Returned by [ " + strcharinfo(0) + " ]!!",1,0xFF0000;
//			bg_rankpoints "fame",1;
			disablenpc "Croix_Flag";
			sleep 2000;
			movenpc "Croix_Flag",62,150; // Back to Base
			set .Flag_Status, 0;
			initnpctimer;
			enablenpc "Croix_Flag";
		}
	}
	end;

OnTimer2000:
	stopnpctimer;
	if( .Flag_Status < 2 )
	{
		getmapxy [email protected]$, [email protected], [email protected], 1;
		viewpointmap "bat_b02",1, [email protected], [email protected], 2, 0xFF0000;
		specialeffect 223;
		initnpctimer;
	}
	end;

OnBase:
	movenpc "Croix_Flag",62,150;
	set .Flag_Status, 0;
	set .Flag_Carrier, 0;
	initnpctimer;
	enablenpc "Croix_Flag";
	end;
}

// Battleground Engine
// *********************************************************************

-	script	Flavius_CTF	-1,{

OnPCLoadMapEvent:
//if (strcharinfo(3) == "pvp_arena2"):
set [email protected]$, strcharinfo(0);
end;

OnBlueFlash:
	if( getvariableofnpc(.Flag_Carrier,"Guillaume_Flag") == getcharid(0) && [email protected] == 1 )
	{
		getmapxy [email protected]$, [email protected], [email protected], 0;
		viewpointmap "bat_b02",1, [email protected], [email protected], 1, 0x0000FF;
		specialeffect2 73;
		emotion e_hlp,1;
		addtimer 2000, "Flavius_CTF::OnBlueFlash";
		percentheal -5,-5;
	}
	end;

OnRedFlash:
	if( getvariableofnpc(.Flag_Carrier,"Croix_Flag") == getcharid(0) && [email protected] == 1 )
	{
		getmapxy [email protected]$, [email protected], [email protected], 0;
		viewpointmap "bat_b02",1, [email protected], [email protected], 2, 0xFF0000;
		specialeffect2 73;
		emotion e_hlp,1;
		addtimer 2000, "Flavius_CTF::OnRedFlash";
		percentheal -5,-5;
	}
	end;

OnInit:
	disablenpc "Guillaume_Flag";
	disablenpc "Croix_Flag";
	end;

OnGuillaumeQuit:
OnCroixQuit:
	callfunc("bgsetwaittime","CTF",180);
	set @killer_bg_src, 0;
	if( [email protected] != 0 )
		donpcevent "Flavius_CTF::OnDoBalance";
OnGuillaumeDie:
	if( [email protected] == 1 && getvariableofnpc(.Flag_Carrier,"Croix_Flag") == getcharid(0) )
	{ // Drop Flag
		set getvariableofnpc(.Flag_Carrier,"Croix_Flag"), 0;
		pcblock 1,0; // UnBlock Skills/Items
		getmapxy [email protected]$, [email protected], [email protected], 0;
		movenpc "Croix_Flag", [email protected], [email protected];
		mapannounce "bat_b02","Croix Flag Droped by [ " + strcharinfo(0) + " ]",1,0xFF0000;
//		bg_rankpoints "ctf_droped",1;
//		bg_rankpoints "fame",1,@killer_bg_src;
		set getvariableofnpc(.Flag_Status,"Croix_Flag"), 1; // OnFloor
		initnpctimer "Croix_Flag";
		enablenpc "Croix_Flag";
	}
	end;
	
OnCroixDie:
	if( [email protected] == 1 && getvariableofnpc(.Flag_Carrier,"Guillaume_Flag") == getcharid(0) )
	{ // Drop Flag
		set getvariableofnpc(.Flag_Carrier,"Guillaume_Flag"), 0;
		pcblock 1,0; // UnBlock Skills/Items
		getmapxy [email protected]$, [email protected], [email protected], 0;
		movenpc "Guillaume_Flag", [email protected], [email protected];
		mapannounce "bat_b02","Guillaume Flag Droped by [ " + strcharinfo(0) + " ]",1,0x0000FF;
//		bg_rankpoints "ctf_droped",1;
//		bg_rankpoints "fame",1,@killer_bg_src;
		set getvariableofnpc(.Flag_Status,"Guillaume_Flag"), 1; // OnFloor
		initnpctimer "Guillaume_Flag";
		enablenpc "Guillaume_Flag";
	}
	end;

OnGuillaumeJoin:
OnCroixJoin:
	if( [email protected] == 0 )
		donpcevent "Flavius_CTF::OnReadyCheck";
	else
		donpcevent "Flavius_CTF::OnDoBalance";
		
	end;

OnDoBalance:
	if( [email protected] != 1 )
		end;
	
	set [email protected], bg_get_data([email protected]_id1, 0);
	set [email protected], bg_get_data([email protected]_id2, 0);

	if( [email protected] < [email protected] )
		waitingroom2bg_single [email protected]_id1,"bat_b02",311,224,"BGAZUL";
	else if( [email protected] > [email protected] )
		waitingroom2bg_single [email protected]_id2,"bat_b02",87,75,"BGROJO";
	else
	{
		set [email protected], getwaitingroomstate(0,"BGAZUL");
		set [email protected], getwaitingroomstate(0,"BGROJO");

		if( [email protected] <= [email protected] )
			set [email protected], [email protected];
		else
			set [email protected], [email protected];

		if( [email protected] + [email protected] > 35 )
			set [email protected], 35 - [email protected];
		if( [email protected] <= 0 ) end;

		for( set [email protected], 0; [email protected] < [email protected]; set [email protected], [email protected] + 1 )
		{
			waitingroom2bg_single [email protected]_id1,"bat_b02",311,224,"BGAZUL";
			waitingroom2bg_single [email protected]_id2,"bat_b02",87,75,"BGROJO";
		}

		set [email protected], [email protected] + [email protected];
		set [email protected], [email protected] + [email protected];
		mapannounce "arena_4","Battleground -- Flavius CTF [80-99] G: " + [email protected] + "/35, C: " + [email protected] + "/35 (Playing)",1,0xA0522D;
	}
	end;

OnReadyCheck:
	if( [email protected] || $CURRENTBG != 5 )
		end;
	set [email protected], getwaitingroomstate(0,"BGAZUL");
	set [email protected], getwaitingroomstate(0,"BGROJO");
	
	if( [email protected] < ($MINBGLIMIT - 1) || [email protected] < ($MINBGLIMIT - 1) )
	{
		if( [email protected] > 3 && [email protected] > 3 && !agitcheck() && [email protected]_Flood < gettimetick(2) )
		{
			announce "Battleground -- Flavius CTF [80-99] G: " + [email protected] + "/"+($MINBGLIMIT - 1)+", C: " + [email protected] + "/"+($MINBGLIMIT - 1),0,0xA0522D;
			set [email protected]_Flood, gettimetick(2) + 15;
		}
		else
			mapannounce "arena_4","Battleground -- Flavius CTF [80-99] G: " + [email protected] + "/"+($MINBGLIMIT - 1)+", C: " + [email protected] + "/"+($MINBGLIMIT - 1),1,0xA0522D;
		end;
	}

	set [email protected], 1;
	initnpctimer;

	donpcevent "BGROJO::OnEnterBG";
	donpcevent "BGAZUL::OnEnterBG";
	// BG Variables
	set .Guillaume_Score, 0;
	set .Croix_Score, 0;
	announce "Battleground -- Flavius CTF [80-99] has started!",0,0xA0522D;
	sleep 2000;
	bg_warp [email protected]_id1,"bat_b02",311,224;
	bg_warp [email protected]_id2,"bat_b02",87,75;
	sleep 3000;
	// Respawn NPC's
	donpcevent "#guictf_respawn::OnBGStart";
	donpcevent "#croctf_respawn::OnBGStart";
	// Start Match!!
	donpcevent "Flavius_CTF::OnMatchStart";
	end;

OnMatchStart:
	if( [email protected] != 1 )
		end;

	// Flags2Base
	donpcevent "Guillaume_Flag::OnBase";
	donpcevent "Croix_Flag::OnBase";
	mapannounce "bat_b02","The Flags have been set to their Bases!!",8;
	end;

OnGuillaumeScore:
	set .Guillaume_Score, .Guillaume_Score + 1;
	donpcevent "Flavius_CTF::OnMatchStop";
	end;

OnCroixScore:
	set .Croix_Score, .Croix_Score + 1;
	donpcevent "Flavius_CTF::OnMatchStop";
	end;

OnMatchStop:
	disablenpc "Guillaume_Flag";
	disablenpc "Croix_Flag";
	bg_updatescore "bat_b02",.Guillaume_Score,.Croix_Score;

	viewpointmap "bat_b02",2, 0, 0, 1, 0x0000FF;
	viewpointmap "bat_b02",2, 0, 0, 2, 0xFF0000;
	
	if( .Guillaume_Score > 2 )
	{ // Guillaume Won
		mapannounce "bat_b02","The Guillaume army has won the Battle of Flavius CTF!",1,0x0000FF;
		donpcevent "Flavius_CTF::OnMatchEnd";
	}
	else if( .Croix_Score > 2 )
	{ // Croix Won
		mapannounce "bat_b02","The Croix army has won the Battle of Flavius CTF!",1,0xFF0000;
		donpcevent "Flavius_CTF::OnMatchEnd";
	}
	else
	{ // Keep Playing
		sleep 8000;
		donpcevent "Flavius_CTF::OnMatchStart";
	}
	end;

OnTimer600000:
	mapannounce "bat_b02","The Battle will ends in 5 minutes!!",1,0xA0522D;
	end;

OnTimer840000:
	mapannounce "bat_b02","The Battle will ends in 1 minute!!",1,0xA0522D;
	end;

OnTimer900000:
	disablenpc "Guillaume_Flag";
	disablenpc "Croix_Flag";

	viewpointmap "bat_b02",2, 0, 0, 1, 0x0000FF;
	viewpointmap "bat_b02",2, 0, 0, 2, 0xFF0000;

	if( .Guillaume_Score > .Croix_Score )
		mapannounce "bat_b02","The Guillaume army has won the Battle of Flavius CTF!",1,0x0000FF;
	else if( .Guillaume_Score < .Croix_Score )
		mapannounce "bat_b02","The Croix army has won the Battle of Flavius CTF!",1,0xFF0000;
	else
		mapannounce "bat_b02","The battle is over. This is a Tie...!",1,0xA0522D;
	donpcevent "Flavius_CTF::OnMatchEnd";
	end;

OnMatchEnd:
	stopnpctimer;
	disablenpc "Guillaume_Flag";
	disablenpc "Croix_Flag";
	donpcevent "#guictf_respawn::OnBGStop";
	donpcevent "#croctf_respawn::OnBGStop";
	set [email protected], 2; //bg_status
	
	//[Oboro] Rotacion de BG
//	ChangeBG();
	atcommand "@changebg";
	
	// =======================================================
	// Team Rewards
	// =======================================================
	if( .Guillaume_Score > .Croix_Score )
	{
		// Ganó Guillaume
		bg_item([email protected]_id1, 1);
		bg_item([email protected]_id2, 0);
		
	}
	else if( .Croix_Score > .Guillaume_Score )
	{
		// Ganó Croix
		bg_item([email protected]TF_id1, 0);
		bg_item([email protected]_id2, 1);


	}
	
	else
	{
		// Empate, perdida ambos por default
		bg_item([email protected]_id1, 0);
		bg_item([email protected]_id2, 0);
		
	}
	donpcevent strnpcinfo(3)+"::OnAddPoint";
	mapannounce "bat_b02","Battle of Flavius CTF will start in 0 seconds!",1,0xA0522D;
	sleep 2000;
	bg_destroy [email protected]_id1;
	bg_destroy [email protected]_id2;
	set [email protected]_id1, 0;
	set [email protected]_id2, 0;
	mapwarp "bat_b02","arena_4",148,99;
	sleep 3000;
	initnpctimer;
	end;
	
OnAddPoint:
	if( .Guillaume_Score > .Croix_Score ) {
		[email protected]_bg_id = [email protected]_id1;
		[email protected]_bg_id = [email protected]_id2;
	}
	else if( .Croix_Score > .Guillaume_Score ) {
		[email protected]_bg_id = [email protected]_id2;
		[email protected]_bg_id = [email protected]_id1;
	}
	else end;
	
	[email protected] = bg_get_data([email protected]_bg_id, 1);
	copyarray [email protected], [email protected], [email protected];
	[email protected] = bg_get_data([email protected]_bg_id, 1);
	copyarray [email protected], [email protected], [email protected];
	
	for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
		if (attachrid([email protected][[email protected]])) {
			atcommand "@addfame 2 100";
			dispbottom "You gained 100 Fame for winning.";
			detachrid;
		}
	}
	
	for ([email protected] = 0; [email protected] < [email protected]; [email protected]++) {
		if (attachrid([email protected][[email protected]])) {
			atcommand "@addfame 2 -100";
			dispbottom "You lose 100 Fame for losing.";
			detachrid;
		}
	}
	end;

OnTimer10000:
	if( [email protected] == 2 )
		mapannounce "bat_b02","Battle of Flavius CTF will start in 5 seconds!",1,0xA0522D;
	end;

OnTimer15000:
	if( [email protected] != 2 )
		end;
OnReset:
	stopnpctimer;
	set .Guillaume_Score, 0;
	set .Croix_Score, 0;
	disablenpc "Guillaume_Flag";
	disablenpc "Croix_Flag";
	sleep 1000;
	mapwarp "bat_b02","arena_4",148,99;
	sleep 1000;
	maprespawnguildid "bat_b02",0,3; // Just in case someone else
	bg_updatescore "bat_b02",0,0;
	set [email protected], 0;
	donpcevent "Flavius_CTF::OnReadyCheck";
	end;
	
}

// Battleground Therapist
// *********************************************************************

bat_b02,390,13,5	script	Therapist in battle#ctf1	95,{
	percentheal 100,100;
	sc_start 32,  250000, 10;  // Increase Agi
	sc_start 30,  250000, 10;  // Blessing
	repairall;
	end;
OnTouch:
	percentheal 100,100;
	sc_start 32,  250000, 10;  // Increase Agi
	sc_start 30,  250000, 10;  // Blessing
	repairall;
	end;
}

bat_b02,10,293,5	script	Therapist in battle#ctf2	95,{
	percentheal 100,100;
	sc_start 32,  250000, 10;  // Increase Agi
	sc_start 30,  250000, 10;  // Blessing
	repairall;
	end;
OnTouch:
	percentheal 100,100;
	sc_start 32,  250000, 10;  // Increase Agi
	sc_start 30,  250000, 10;  // Blessing
	repairall;
	end;
}

// Battleground Respawn
// *********************************************************************

bat_b02,390,10,0	script	#guictf_respawn	139,{
	end;

OnBGStart:
	initnpctimer;
	end;

OnBGStop:
	stopnpctimer;
	end;

OnTimer24000:
	misceffect 83;
	end;

OnTimer25000:
	areapercentheal "bat_b02",382,2,397,17,100,100;
	areawarp "bat_b02",382,2,397,17,"bat_b02",311,224;
	initnpctimer;
	end;
}

bat_b02,10,290,0	script	#croctf_respawn	139,{
	end;

OnBGStart:
	initnpctimer;
	end;

OnBGStop:
	stopnpctimer;
	end;

OnTimer24000:
	misceffect 83;
	end;

OnTimer25000:
	areapercentheal "bat_b02",2,282,17,297,100,100;
	areawarp "bat_b02",2,282,17,297,"bat_b02",87,75;
	initnpctimer;
	end;
}

// Flags
// *********************************************************************

bat_b02,304,231,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat23	973
bat_b02,319,231,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat24	973
bat_b02,304,218,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat25	973
bat_b02,319,218,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat26	973
bat_b02,304,231,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat27	973
bat_b02,304,231,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat28	973
bat_b02,335,142,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat29	973
bat_b02,335,157,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat30	973
bat_b02,390,16,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat31	973
bat_b02,292,163,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat32	973
bat_b02,292,136,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat33	973
bat_b02,241,185,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat34	973
bat_b02,247,179,1	duplicate(Guillaume camp#bat)	Guillaume camp#bat35	973

bat_b02,96,81,1	duplicate(Croix camp#bat)	Croix camp#bat22	974
bat_b02,96,68,1	duplicate(Croix camp#bat)	Croix camp#bat23	974
bat_b02,79,81,1	duplicate(Croix camp#bat)	Croix camp#bat24	974
bat_b02,79,68,1	duplicate(Croix camp#bat)	Croix camp#bat25	974
bat_b02,96,81,1	duplicate(Croix camp#bat)	Croix camp#bat26	974
bat_b02,96,81,1	duplicate(Croix camp#bat)	Croix camp#bat27	974
bat_b02,59,164,1	duplicate(Croix camp#bat)	Croix camp#bat28	974
bat_b02,59,137,1	duplicate(Croix camp#bat)	Croix camp#bat29	974
bat_b02,10,296,1	duplicate(Croix camp#bat)	Croix camp#bat30	974
bat_b02,110,162,1	duplicate(Croix camp#bat)	Croix camp#bat31	974
bat_b02,110,137,1	duplicate(Croix camp#bat)	Croix camp#bat32	974
bat_b02,152,120,1	duplicate(Croix camp#bat)	Croix camp#bat33	974
bat_b02,158,114,1	duplicate(Croix camp#bat)	Croix camp#bat34	974

// MapFlags
// *********************************************************************

bat_b02	mapflag	battleground	2
bat_b02	mapflag	nomemo
bat_b02	mapflag	nosave	SavePoint
bat_b02	mapflag	noteleport
bat_b02	mapflag	nowarp
bat_b02	mapflag	nowarpto
bat_b02	mapflag	noreturn
bat_b02	mapflag	nobranch
bat_b02	mapflag	nopenalty
bat_b02	mapflag	noemergencycall

 

Edited by Strand

Share this post


Link to post
Share on other sites
  • 0

try 

OnAddPoint:
	if (.Guillaume_Score > .Croix_Score)
		[email protected]_bg = [email protected]_id1;
	else if (.Croix_Score > .Guillaume_Score)
		[email protected]_bg = [email protected]_id2;
	
	[email protected]_id = getcharid(4);
	if ([email protected]_bg) {
		addrid(5, 1, "bat_b02");
		if ([email protected]_id == [email protected]_bg) {
				atcommand "@addfame 2 -100";
				dispbottom "You lose 100 Fame for losing.";
		}
		else {
			atcommand "@addfame 2 -100";
			dispbottom "You lose -100 Fame for losing.";
		}
	}
	end;

 

Share this post


Link to post
Share on other sites
  • 0
OnAddPoint:
	if (.Guillaume_Score > .Croix_Score)
		[email protected]_bg = [email protected]_id1;
	else if (.Croix_Score > .Guillaume_Score)
		[email protected]_bg = [email protected]_id2;
	
	if ([email protected]_bg) {
		addrid(5, 1, "bat_b02");
		if (getcharid(4) == [email protected]_bg) {
				atcommand "@addfame 2 -100";
				dispbottom "You lose 100 Fame for losing.";
		}
		else {
			atcommand "@addfame 2 -100";
			dispbottom "You lose -100 Fame for losing.";
		}
	}
	end;

 

Share this post


Link to post
Share on other sites
  • 0

Hello @Emistry,

Now it is working but, the player in the losing team is actually losing points but the player in the winner team is not receiving anything.

Team loser:

image.png.e281f067643ca36f475567bc26ab3f91.png

Team winner:

image.png.515863d4990bfe34fcce8007264c5059.png

Share this post


Link to post
Share on other sites
  • 0
OnAddPoint:
	[email protected]_bg = 0;
	if (.Guillaume_Score > .Croix_Score)
		[email protected]_bg = [email protected]_id1;
	else if (.Croix_Score > .Guillaume_Score)
		[email protected]_bg = [email protected]_id2;
	
	if ([email protected]_bg) {
		addrid(5, 1, "bat_b02");
		if (getcharid(4) == [email protected]_bg) {
				atcommand "@addfame 2 -100";
				dispbottom "You lose 100 Fame for losing.";
		}
		else {
			atcommand "@addfame 2 -100";
			dispbottom "You lose -100 Fame for losing.";
		}
		[email protected]_bg = 0;
	}
	end;

 

Share this post


Link to post
Share on other sites
  • 0

@Emistry,

I know I might be so annoying at this point and I´m sorry, but, I just tested it and the player in the losing team is losing point but the winner is not earning points. Like if the script is not recognizing him.

I really appreciate your help at this point.

Edited by Strand

Share this post


Link to post
Share on other sites
  • 0
OnAddPoint:
	[email protected]_bg = 0;
	if (.Guillaume_Score > .Croix_Score)
		[email protected]_bg = [email protected]_id1;
	else if (.Croix_Score > .Guillaume_Score)
		[email protected]_bg = [email protected]_id2;
	
	if ([email protected]_bg) {
		addrid(5, 1, "bat_b02");
		if (getcharid(4) == [email protected]_bg) {
				atcommand "@addfame 2 -100";
				dispbottom "You lose 100 Fame for losing.";
		}
		else {
			atcommand "@addfame 2 -100";
			dispbottom "You lose -100 Fame for losing.";
		}
	}
	end;

 

Share this post


Link to post
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.

Loading...
Sign in to follow this