Jump to content
  • 0
Tio Akima

combat arena error

Question

guys, someone help me fix this script

it is not working properly.

sometimes he announces as a winner the player who is dead

gives the prize to the wrong player ... etc

 

https://pastebin.com/eFv2B5QX

 

this is a combat arena where the last to survive is the winner.

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 1
8 hours ago, Tio Akima said:

 

hi Cretino, Thanks for the answer..
I did a test with two fighters ... And when one of them dies, the prize label is not triggered.
the console error

[Error]: script_rid2sd: fatal error ! player not attached!
[Debug]: Function: strcharinfo (1 parameter):
[Debug]: Data: number value=0

I made a little mistake, now is tested and working:

Spoiler

//===== Arena de Combate ==========================================

kame_house,196,151,3	script	[RR] Tenente	4_EP16_STOLZ,{

	mes $npc$;
	mes "Olá "+strcharinfo(0)+"!";
	mes "Deseja entrar na Arena de Combate da Destruição?";
	next;
	
switch(select("Entrar:Informações:Não, obrigado")){

	case 1:
		mes $npc$;
		if($aberto == 1) goto entrar;
		if($aberto == 0) mes "As porta para a Arena de Combate estão fechadas. Evento abre a cada 3 horas...";
		close;
		end;
	case 2:
		mes $npc$;
		mes "Na Arena de Combate nós testaremos sua força.";
		mes "Você ira para uma arena onde terá uma guerra, o ultimo(a) player sobrevivente será o vencedor.";
		mes "Lembrando que, não é fácil. Por isso, prepare-se bem.";
		mes "Não será permitido o uso de poções e iteus consumiveis que abram vantagens.";
		mes "Caso você sejá o ultimo sobrevivente da Arena de Combate, você será recompensado!";
		close;
	case 3: 
		close;
end;

}


OnArenaEvnt: if($aberto == 0){ donpcevent strnpcinfo(0)+"::OnArenaEvnt2"; } else { dispbottom "Evento Cancelado!"; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; } end;


//======================================================= init config's
OnInit:
	
	$npc$ = "[ ^FF0000Red Rebbon^000000 ] ^9400D3 Tenente^000000 ";	//nome npc

	bindatcmd "goarena",strnpcinfo(0)+"::OnArenaEvnt",99;

	waitingroom "Arena da Destruição",0;
	
	$@MaxMin = 1;						// Minutos max pro jogador entrar na arena
	
	$@award = 1002;					//id award

end;
//======================================================= end init


entrar:
	announce "O jogador ["+strcharinfo(0)+"] entrou na Arena da Destruição!",bc_all;
	percentheal 100,100;
	warp "fight_05",0,0;
end;


OnArenaEvnt2:		// Abre-Inicia  A ARENA

	announce "[Arena de Combate] Arena da Destruição está ABERTA!",0;
	set $aberto,1;	//evento aberto para os player entrar
	set $arenaon,1;
	pvpoff "fight_05";

	for(.@i = $@MaxMin; .@i  > 0; .@i--)
	{
		announce "Arena da Desrtuição começará em " + .@i + " minutos!", 0;
		sleep 60000;
	}

	announce "[Arena de Combate] Arena da Destruição COMEÇOU!",0;
	
	//fecha o evento para não entrar mais ninguem
	set $aberto,0;
	
	//liga o pvp
	pvpon "fight_05";
	
	
	set $@qnton,getmapusers("fight_05"); //pega a quantidade de usuarios que tem no mapa

	if($@qnton < 2){
	
		announce "[Arena de Combate] Arena da Destruição foi encerrada por falta de lutadores!",bc_all;
		donpcevent strnpcinfo(0)+"::OnArenaEvntOff";

	}
	
end;


OnPCDieEvent:

	getmapxy(.@mapa$,.@xi,.@yi,0);
	
	if($arenaon){
	
		if(strcharinfo(3) == "fight_05" ) {
			announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all;
			$@qnton--;
			sleep2 2000;
			warp "kame_house",174,177;
		}
		
		if(.@mapa$ == "fight_05"){
			
			if($@qnton < 1){
				announce "Arena da Destruição: Ninguém ganhou a Arena de Combate!",bc_all;
				donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
				end;
			}
				
			if($@qnton == 2){
				announce "[Arena da Destruição]: O grande momento chegou! Restam apenas 2 guerreiros na ARENA! Quem irá vencer?",bc_all;
				end;
			}

			if($@qnton == 1)
			{
				if (isloggedin(killerrid))
				{
					if (attachrid(killerrid))
					{
						doevent strnpcinfo(0)+"::OnArenaPremio";
						end;
					}
					else
					{
						donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
						end;
					}
				}
				else
				{
					donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
					end;
				}
			}
		}
	}
	
end;

OnArenaEvntOff:

	//fecha o evento
	set $arenaon,0;
	set $aberto,0;
	
	//desliga o pvp
	pvpoff "fight_05";

	announce "[Arena da Destruição] Arena finalizada!", 0;
	mapwarp "fight_05","kame_house",174,177;

end;

OnArenaPremio:
	
	announce "[Arena da Destruição]: ACABOU! O ganhador da Arena da Destruição foi " + strcharinfo(0) + "!",bc_all;
	sleep2 2000;
	mapannounce "fight_05", "Parabéns! Você é o grande vencedor!", 0;
	
	getitem $@award, 1;	//entrega o premio
	
	sleep2 1000;
	donpcevent strnpcinfo(0)+"::OnArenaEvntOff";	//closed event

end;



}






////////////////////////////////////////

fight_05	mapflag	nowarp
fight_05	mapflag	nowarpto
fight_05	mapflag	noteleport
fight_05	mapflag	nosave	SavePoint
fight_05	mapflag	nomemo
fight_05	mapflag	nobranch
fight_05	mapflag	nopenalty
fight_05	mapflag	nostorage
fight_05	mapflag	pvp_noparty
fight_05	mapflag	pvp_noguild

////////////////////////////////////////

 

 

Share this post


Link to post
Share on other sites
  • 1
5 hours ago, Tio Akima said:

oh nice... I tested it with OnPCLogoutEvent:
but... he warned that the player gave up, but did not trigger the label OnArenaEvntCheck; LOL
 

he stopped for here:

FeI0wNZ.png

I made some changes, now is working fine.

 

OnPCDieEvent part:

Spoiler

OnPCDieEvent:

	getmapxy(.@mapa$,.@xi,.@yi,0);
	
	if($arenaon){
	
		if(strcharinfo(3) == "fight_05" ) {
			announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all;
			$@qnton--;
			sleep2 2000;
			warp "kame_house",174,177;
		}

		if(.@mapa$ == "fight_05"){
ARENA_CHECK:
			if($@qnton < 1){
				announce "Arena da Destruição: Ninguém ganhou a Arena de Combate!",bc_all;
				donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
				end;
			}
				
			if($@qnton == 2){
				announce "[Arena da Destruição]: O grande momento chegou! Restam apenas 2 guerreiros na ARENA! Quem irá vencer?",bc_all;
				end;
			}

			if($@qnton == 1)
			{
				if (isloggedin(killerrid))
				{
					if (attachrid(killerrid))
					{
						doevent strnpcinfo(0)+"::OnArenaPremio";
						end;
					}
					else
					{
						donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
						end;
					}
				}
				else
				{
					deletearray(.@units);
					.@count = getunits(BL_PC, .@units, false, "fight_05");

					if (.@count == 1)
					{
						if (attachrid(.@units[0]))
						{
							doevent strnpcinfo(0)+"::OnArenaPremio";
							end;
						}
						else
						{
							donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
							end;
						}
					}
					else
					{
						donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
						end;
					}
				}
			}
		}
	}
	
end;

 

 

OnPCLogoutEvent part:

Spoiler

OnPCLogoutEvent:
	if (strcharinfo(PC_MAP) == "fight_05" && @enter_arena == true)
	{
		@enter_arena = false;

		if ($arenaon && !$aberto)
		{
			announce "[Arena da Destruição]: "+strcharinfo(0)+" fugiu da batalha!",bc_all;

			$@qnton--;

			warp "kame_house",174,177;
			goto ARENA_CHECK;
		}
	}
end;

 

 

Share this post


Link to post
Share on other sites
  • 0
5 hours ago, Tio Akima said:

guys, someone help me fix this script

it is not working properly.

sometimes he announces as a winner the player who is dead

gives the prize to the wrong player ... etc

 

https://pastebin.com/eFv2B5QX

 

this is a combat arena where the last to survive is the winner.

Not tested, but I think now is working fine.

Spoiler

//===== Arena de Combate ==========================================

kame_house,196,151,3	script	[RR] Tenente	4_EP16_STOLZ,{

	mes $npc$;
	mes "Olá "+strcharinfo(0)+"!";
	mes "Deseja entrar na Arena de Combate da Destruição?";
	next;
	
switch(select("Entrar:Informações:Não, obrigado")){

	case 1:
		mes $npc$;
		if($aberto == 1) goto entrar;
		if($aberto == 0) mes "As porta para a Arena de Combate estão fechadas. Evento abre a cada 3 horas...";
		close;
		end;
	case 2:
		mes $npc$;
		mes "Na Arena de Combate nós testaremos sua força.";
		mes "Você ira para uma arena onde terá uma guerra, o ultimo(a) player sobrevivente será o vencedor.";
		mes "Lembrando que, não é fácil. Por isso, prepare-se bem.";
		mes "Não será permitido o uso de poções e iteus consumiveis que abram vantagens.";
		mes "Caso você sejá o ultimo sobrevivente da Arena de Combate, você será recompensado!";
		close;
	case 3: 
		close;
end;

}


OnArenaEvnt: if($aberto == 0){ donpcevent strnpcinfo(0)+"::OnArenaEvnt2"; } else { dispbottom "Evento Cancelado!"; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; } end;


//======================================================= init config's
OnInit:
	
	$npc$ = "[ ^FF0000Red Rebbon^000000 ] ^9400D3 Tenente^000000 ";	//nome npc

	bindatcmd "goarena",strnpcinfo(0)+"::OnArenaEvnt",99;

	waitingroom "Arena da Destruição",0;
	
	$@MaxMin = 1;						// Minutos max pro jogador entrar na arena
	
	$@award = 1002;					//id award

end;
//======================================================= end init


entrar:
	announce "O jogador ["+strcharinfo(0)+"] entrou na Arena da Destruição!",bc_all;
	percentheal 100,100;
	warp "fight_05",0,0;
end;


OnArenaEvnt2:		// Abre-Inicia  A ARENA

	announce "[Arena de Combate] Arena da Destruição está ABERTA!",0;
	set $aberto,1;	//evento aberto para os player entrar
	set $arenaon,1;
	pvpoff "fight_05";

	for(.@i = $@MaxMin; .@i  > 0; .@i--)
	{
		announce "Arena da Desrtuição começará em " + .@i + " minutos!", 0;
		sleep 60000;
	}

	announce "[Arena de Combate] Arena da Destruição COMEÇOU!",0;
	
	//fecha o evento para não entrar mais ninguem
	set $aberto,0;
	
	//liga o pvp
	pvpon "fight_05";
	
	
	set $@qnton,getmapusers("fight_05"); //pega a quantidade de usuarios que tem no mapa

	if($@qnton < 2){
	
		announce "[Arena de Combate] Arena da Destruição foi encerrada por falta de lutadores!",bc_all;
		donpcevent strnpcinfo(0)+"::OnArenaEvntOff";

	}
	
end;


OnPCDieEvent:

	getmapxy(.@mapa$,.@xi,.@yi,0);
	
	if($arenaon){
	
		if(strcharinfo(3) == "fight_05" ) {
			announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all;
			$@qnton--;
			sleep2 2000;
			warp "kame_house",174,177;
		}
		
		if(.@mapa$ == "fight_05"){
			
			if($@qnton < 1){
				announce "Arena da Destruição: Ninguém ganhou a Arena de Combate!",bc_all;
				donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
				end;
			}
				
			if($@qnton == 2){
				announce "[Arena da Destruição]: O grande momento chegou! Restam apenas 2 guerreiros na ARENA! Quem irá vencer?",bc_all;
				end;
			}

			if($@qnton == 1)
			{
				if (isloggedin(killerrid))
				{
					if (attachrid(killerrid))
					{
						donpcevent strnpcinfo(0)+"::OnArenaPremio";
						end;
					}
					else
					{
						donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
						end;
					}
				}
				else
				{
					donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
					end;
				}
			}
		}
	}
	
end;

OnArenaEvntOff:

	//fecha o evento
	set $arenaon,0;
	set $aberto,0;
	
	//desliga o pvp
	pvpoff "fight_05";

	announce "[Arena da Destruição] Arena finalizada!", 0;
	mapwarp "fight_05","kame_house",174,177;

end;


OnArenaPremio:
	
	announce "[Arena da Destruição]: ACABOU! O ganhador da Arena da Destruição foi " + strcharinfo(0) + "!",bc_all;
	sleep2 2000;
	mapannounce "fight_05", "Parabéns! Você é o grande vencedor!", 0;
	
	getitem $@award;	//entrega o premio
	
	sleep2 1000;
	donpcevent strnpcinfo(0)+"::OnArenaEvntOff";	//closed event

end;



}






////////////////////////////////////////

fight_05	mapflag	nowarp
fight_05	mapflag	nowarpto
fight_05	mapflag	noteleport
fight_05	mapflag	nosave	SavePoint
fight_05	mapflag	nomemo
fight_05	mapflag	nobranch
fight_05	mapflag	nopenalty
fight_05	mapflag	nostorage
fight_05	mapflag	pvp_noparty
fight_05	mapflag	pvp_noguild

////////////////////////////////////////

 

 

Share this post


Link to post
Share on other sites
  • 0
26 minutes ago, Cretino said:

Not tested, but I think now is working fine.

  Reveal hidden contents

//===== Arena de Combate ========================================== kame_house,196,151,3 script [RR] Tenente 4_EP16_STOLZ,{ mes $npc$; mes "Olá "+strcharinfo(0)+"!"; mes "Deseja entrar na Arena de Combate da Destruição?"; next; switch(select("Entrar:Informações:Não, obrigado")){ case 1: mes $npc$; if($aberto == 1) goto entrar; if($aberto == 0) mes "As porta para a Arena de Combate estão fechadas. Evento abre a cada 3 horas..."; close; end; case 2: mes $npc$; mes "Na Arena de Combate nós testaremos sua força."; mes "Você ira para uma arena onde terá uma guerra, o ultimo(a) player sobrevivente será o vencedor."; mes "Lembrando que, não é fácil. Por isso, prepare-se bem."; mes "Não será permitido o uso de poções e iteus consumiveis que abram vantagens."; mes "Caso você sejá o ultimo sobrevivente da Arena de Combate, você será recompensado!"; close; case 3: close; end; } OnArenaEvnt: if($aberto == 0){ donpcevent strnpcinfo(0)+"::OnArenaEvnt2"; } else { dispbottom "Evento Cancelado!"; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; } end; //======================================================= init config's OnInit: $npc$ = "[ ^FF0000Red Rebbon^000000 ] ^9400D3 Tenente^000000 "; //nome npc bindatcmd "goarena",strnpcinfo(0)+"::OnArenaEvnt",99; waitingroom "Arena da Destruição",0; $@MaxMin = 1; // Minutos max pro jogador entrar na arena $@award = 1002; //id award end; //======================================================= end init entrar: announce "O jogador ["+strcharinfo(0)+"] entrou na Arena da Destruição!",bc_all; percentheal 100,100; warp "fight_05",0,0; end; OnArenaEvnt2: // Abre-Inicia A ARENA announce "[Arena de Combate] Arena da Destruição está ABERTA!",0; set $aberto,1; //evento aberto para os player entrar set $arenaon,1; pvpoff "fight_05"; for(.@i = $@MaxMin; .@i > 0; .@i--) { announce "Arena da Desrtuição começará em " + .@i + " minutos!", 0; sleep 60000; } announce "[Arena de Combate] Arena da Destruição COMEÇOU!",0; //fecha o evento para não entrar mais ninguem set $aberto,0; //liga o pvp pvpon "fight_05"; set $@qnton,getmapusers("fight_05"); //pega a quantidade de usuarios que tem no mapa if($@qnton < 2){ announce "[Arena de Combate] Arena da Destruição foi encerrada por falta de lutadores!",bc_all; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; } end; OnPCDieEvent: getmapxy(.@mapa$,.@xi,.@yi,0); if($arenaon){ if(strcharinfo(3) == "fight_05" ) { announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all; $@qnton--; sleep2 2000; warp "kame_house",174,177; } if(.@mapa$ == "fight_05"){ if($@qnton < 1){ announce "Arena da Destruição: Ninguém ganhou a Arena de Combate!",bc_all; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } if($@qnton == 2){ announce "[Arena da Destruição]: O grande momento chegou! Restam apenas 2 guerreiros na ARENA! Quem irá vencer?",bc_all; end; } if($@qnton == 1) { if (isloggedin(killerrid)) { if (attachrid(killerrid)) { donpcevent strnpcinfo(0)+"::OnArenaPremio"; end; } else { donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } } else { donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } } } } end; OnArenaEvntOff: //fecha o evento set $arenaon,0; set $aberto,0; //desliga o pvp pvpoff "fight_05"; announce "[Arena da Destruição] Arena finalizada!", 0; mapwarp "fight_05","kame_house",174,177; end; OnArenaPremio: announce "[Arena da Destruição]: ACABOU! O ganhador da Arena da Destruição foi " + strcharinfo(0) + "!",bc_all; sleep2 2000; mapannounce "fight_05", "Parabéns! Você é o grande vencedor!", 0; getitem $@award; //entrega o premio sleep2 1000; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; //closed event end; } //////////////////////////////////////// fight_05 mapflag nowarp fight_05 mapflag nowarpto fight_05 mapflag noteleport fight_05 mapflag nosave SavePoint fight_05 mapflag nomemo fight_05 mapflag nobranch fight_05 mapflag nopenalty fight_05 mapflag nostorage fight_05 mapflag pvp_noparty fight_05 mapflag pvp_noguild ////////////////////////////////////////



//===== Arena de Combate ==========================================

kame_house,196,151,3	script	[RR] Tenente	4_EP16_STOLZ,{

	mes $npc$;
	mes "Olá "+strcharinfo(0)+"!";
	mes "Deseja entrar na Arena de Combate da Destruição?";
	next;
	
switch(select("Entrar:Informações:Não, obrigado")){

	case 1:
		mes $npc$;
		if($aberto == 1) goto entrar;
		if($aberto == 0) mes "As porta para a Arena de Combate estão fechadas. Evento abre a cada 3 horas...";
		close;
		end;
	case 2:
		mes $npc$;
		mes "Na Arena de Combate nós testaremos sua força.";
		mes "Você ira para uma arena onde terá uma guerra, o ultimo(a) player sobrevivente será o vencedor.";
		mes "Lembrando que, não é fácil. Por isso, prepare-se bem.";
		mes "Não será permitido o uso de poções e iteus consumiveis que abram vantagens.";
		mes "Caso você sejá o ultimo sobrevivente da Arena de Combate, você será recompensado!";
		close;
	case 3: 
		close;
end;

}


OnArenaEvnt: if($aberto == 0){ donpcevent strnpcinfo(0)+"::OnArenaEvnt2"; } else { dispbottom "Evento Cancelado!"; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; } end;


//======================================================= init config's
OnInit:
	
	$npc$ = "[ ^FF0000Red Rebbon^000000 ] ^9400D3 Tenente^000000 ";	//nome npc

	bindatcmd "goarena",strnpcinfo(0)+"::OnArenaEvnt",99;

	waitingroom "Arena da Destruição",0;
	
	$@MaxMin = 1;						// Minutos max pro jogador entrar na arena
	
	$@award = 1002;					//id award

end;
//======================================================= end init


entrar:
	announce "O jogador ["+strcharinfo(0)+"] entrou na Arena da Destruição!",bc_all;
	percentheal 100,100;
	warp "fight_05",0,0;
end;


OnArenaEvnt2:		// Abre-Inicia  A ARENA

	announce "[Arena de Combate] Arena da Destruição está ABERTA!",0;
	set $aberto,1;	//evento aberto para os player entrar
	set $arenaon,1;
	pvpoff "fight_05";

	for(.@i = $@MaxMin; .@i  > 0; .@i--)
	{
		announce "Arena da Desrtuição começará em " + .@i + " minutos!", 0;
		sleep 60000;
	}

	announce "[Arena de Combate] Arena da Destruição COMEÇOU!",0;
	
	//fecha o evento para não entrar mais ninguem
	set $aberto,0;
	
	//liga o pvp
	pvpon "fight_05";
	
	
	set $@qnton,getmapusers("fight_05"); //pega a quantidade de usuarios que tem no mapa

	if($@qnton < 2){
	
		announce "[Arena de Combate] Arena da Destruição foi encerrada por falta de lutadores!",bc_all;
		donpcevent strnpcinfo(0)+"::OnArenaEvntOff";

	}
	
end;


OnPCDieEvent:

	getmapxy(.@mapa$,.@xi,.@yi,0);
	
	if($arenaon){
	
		if(strcharinfo(3) == "fight_05" ) {
			announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all;
			$@qnton--;
			sleep2 2000;
			warp "kame_house",174,177;
		}
		
		if(.@mapa$ == "fight_05"){
			
			if($@qnton < 1){
				announce "Arena da Destruição: Ninguém ganhou a Arena de Combate!",bc_all;
				donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
				end;
			}
				
			if($@qnton == 2){
				announce "[Arena da Destruição]: O grande momento chegou! Restam apenas 2 guerreiros na ARENA! Quem irá vencer?",bc_all;
				end;
			}

			if($@qnton == 1)
			{
				if (isloggedin(killerrid))
				{
					if (attachrid(killerrid))
					{
						donpcevent strnpcinfo(0)+"::OnArenaPremio";
						end;
					}
					else
					{
						donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
						end;
					}
				}
				else
				{
					donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
					end;
				}
			}
		}
	}
	
end;

OnArenaEvntOff:

	//fecha o evento
	set $arenaon,0;
	set $aberto,0;
	
	//desliga o pvp
	pvpoff "fight_05";

	announce "[Arena da Destruição] Arena finalizada!", 0;
	mapwarp "fight_05","kame_house",174,177;

end;


OnArenaPremio:
	
	announce "[Arena da Destruição]: ACABOU! O ganhador da Arena da Destruição foi " + strcharinfo(0) + "!",bc_all;
	sleep2 2000;
	mapannounce "fight_05", "Parabéns! Você é o grande vencedor!", 0;
	
	getitem $@award;	//entrega o premio
	
	sleep2 1000;
	donpcevent strnpcinfo(0)+"::OnArenaEvntOff";	//closed event

end;



}






////////////////////////////////////////

fight_05	mapflag	nowarp
fight_05	mapflag	nowarpto
fight_05	mapflag	noteleport
fight_05	mapflag	nosave	SavePoint
fight_05	mapflag	nomemo
fight_05	mapflag	nobranch
fight_05	mapflag	nopenalty
fight_05	mapflag	nostorage
fight_05	mapflag	pvp_noparty
fight_05	mapflag	pvp_noguild

////////////////////////////////////////

 

 

 

hi Cretino, Thanks for the answer..
I did a test with two fighters ... And when one of them dies, the prize label is not triggered.
the console error

[Error]: script_rid2sd: fatal error ! player not attached!
[Debug]: Function: strcharinfo (1 parameter):
[Debug]: Data: number value=0

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, Cretino said:

I made a little mistake, now is tested and working:

  Reveal hidden contents

//===== Arena de Combate ========================================== kame_house,196,151,3 script [RR] Tenente 4_EP16_STOLZ,{ mes $npc$; mes "Olá "+strcharinfo(0)+"!"; mes "Deseja entrar na Arena de Combate da Destruição?"; next; switch(select("Entrar:Informações:Não, obrigado")){ case 1: mes $npc$; if($aberto == 1) goto entrar; if($aberto == 0) mes "As porta para a Arena de Combate estão fechadas. Evento abre a cada 3 horas..."; close; end; case 2: mes $npc$; mes "Na Arena de Combate nós testaremos sua força."; mes "Você ira para uma arena onde terá uma guerra, o ultimo(a) player sobrevivente será o vencedor."; mes "Lembrando que, não é fácil. Por isso, prepare-se bem."; mes "Não será permitido o uso de poções e iteus consumiveis que abram vantagens."; mes "Caso você sejá o ultimo sobrevivente da Arena de Combate, você será recompensado!"; close; case 3: close; end; } OnArenaEvnt: if($aberto == 0){ donpcevent strnpcinfo(0)+"::OnArenaEvnt2"; } else { dispbottom "Evento Cancelado!"; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; } end; //======================================================= init config's OnInit: $npc$ = "[ ^FF0000Red Rebbon^000000 ] ^9400D3 Tenente^000000 "; //nome npc bindatcmd "goarena",strnpcinfo(0)+"::OnArenaEvnt",99; waitingroom "Arena da Destruição",0; $@MaxMin = 1; // Minutos max pro jogador entrar na arena $@award = 1002; //id award end; //======================================================= end init entrar: announce "O jogador ["+strcharinfo(0)+"] entrou na Arena da Destruição!",bc_all; percentheal 100,100; warp "fight_05",0,0; end; OnArenaEvnt2: // Abre-Inicia A ARENA announce "[Arena de Combate] Arena da Destruição está ABERTA!",0; set $aberto,1; //evento aberto para os player entrar set $arenaon,1; pvpoff "fight_05"; for(.@i = $@MaxMin; .@i > 0; .@i--) { announce "Arena da Desrtuição começará em " + .@i + " minutos!", 0; sleep 60000; } announce "[Arena de Combate] Arena da Destruição COMEÇOU!",0; //fecha o evento para não entrar mais ninguem set $aberto,0; //liga o pvp pvpon "fight_05"; set $@qnton,getmapusers("fight_05"); //pega a quantidade de usuarios que tem no mapa if($@qnton < 2){ announce "[Arena de Combate] Arena da Destruição foi encerrada por falta de lutadores!",bc_all; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; } end; OnPCDieEvent: getmapxy(.@mapa$,.@xi,.@yi,0); if($arenaon){ if(strcharinfo(3) == "fight_05" ) { announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all; $@qnton--; sleep2 2000; warp "kame_house",174,177; } if(.@mapa$ == "fight_05"){ if($@qnton < 1){ announce "Arena da Destruição: Ninguém ganhou a Arena de Combate!",bc_all; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } if($@qnton == 2){ announce "[Arena da Destruição]: O grande momento chegou! Restam apenas 2 guerreiros na ARENA! Quem irá vencer?",bc_all; end; } if($@qnton == 1) { if (isloggedin(killerrid)) { if (attachrid(killerrid)) { doevent strnpcinfo(0)+"::OnArenaPremio"; end; } else { donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } } else { donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } } } } end; OnArenaEvntOff: //fecha o evento set $arenaon,0; set $aberto,0; //desliga o pvp pvpoff "fight_05"; announce "[Arena da Destruição] Arena finalizada!", 0; mapwarp "fight_05","kame_house",174,177; end; OnArenaPremio: announce "[Arena da Destruição]: ACABOU! O ganhador da Arena da Destruição foi " + strcharinfo(0) + "!",bc_all; sleep2 2000; mapannounce "fight_05", "Parabéns! Você é o grande vencedor!", 0; getitem $@award, 1; //entrega o premio sleep2 1000; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; //closed event end; } //////////////////////////////////////// fight_05 mapflag nowarp fight_05 mapflag nowarpto fight_05 mapflag noteleport fight_05 mapflag nosave SavePoint fight_05 mapflag nomemo fight_05 mapflag nobranch fight_05 mapflag nopenalty fight_05 mapflag nostorage fight_05 mapflag pvp_noparty fight_05 mapflag pvp_noguild ////////////////////////////////////////



//===== Arena de Combate ==========================================

kame_house,196,151,3	script	[RR] Tenente	4_EP16_STOLZ,{

	mes $npc$;
	mes "Olá "+strcharinfo(0)+"!";
	mes "Deseja entrar na Arena de Combate da Destruição?";
	next;
	
switch(select("Entrar:Informações:Não, obrigado")){

	case 1:
		mes $npc$;
		if($aberto == 1) goto entrar;
		if($aberto == 0) mes "As porta para a Arena de Combate estão fechadas. Evento abre a cada 3 horas...";
		close;
		end;
	case 2:
		mes $npc$;
		mes "Na Arena de Combate nós testaremos sua força.";
		mes "Você ira para uma arena onde terá uma guerra, o ultimo(a) player sobrevivente será o vencedor.";
		mes "Lembrando que, não é fácil. Por isso, prepare-se bem.";
		mes "Não será permitido o uso de poções e iteus consumiveis que abram vantagens.";
		mes "Caso você sejá o ultimo sobrevivente da Arena de Combate, você será recompensado!";
		close;
	case 3: 
		close;
end;

}


OnArenaEvnt: if($aberto == 0){ donpcevent strnpcinfo(0)+"::OnArenaEvnt2"; } else { dispbottom "Evento Cancelado!"; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; } end;


//======================================================= init config's
OnInit:
	
	$npc$ = "[ ^FF0000Red Rebbon^000000 ] ^9400D3 Tenente^000000 ";	//nome npc

	bindatcmd "goarena",strnpcinfo(0)+"::OnArenaEvnt",99;

	waitingroom "Arena da Destruição",0;
	
	$@MaxMin = 1;						// Minutos max pro jogador entrar na arena
	
	$@award = 1002;					//id award

end;
//======================================================= end init


entrar:
	announce "O jogador ["+strcharinfo(0)+"] entrou na Arena da Destruição!",bc_all;
	percentheal 100,100;
	warp "fight_05",0,0;
end;


OnArenaEvnt2:		// Abre-Inicia  A ARENA

	announce "[Arena de Combate] Arena da Destruição está ABERTA!",0;
	set $aberto,1;	//evento aberto para os player entrar
	set $arenaon,1;
	pvpoff "fight_05";

	for(.@i = $@MaxMin; .@i  > 0; .@i--)
	{
		announce "Arena da Desrtuição começará em " + .@i + " minutos!", 0;
		sleep 60000;
	}

	announce "[Arena de Combate] Arena da Destruição COMEÇOU!",0;
	
	//fecha o evento para não entrar mais ninguem
	set $aberto,0;
	
	//liga o pvp
	pvpon "fight_05";
	
	
	set $@qnton,getmapusers("fight_05"); //pega a quantidade de usuarios que tem no mapa

	if($@qnton < 2){
	
		announce "[Arena de Combate] Arena da Destruição foi encerrada por falta de lutadores!",bc_all;
		donpcevent strnpcinfo(0)+"::OnArenaEvntOff";

	}
	
end;


OnPCDieEvent:

	getmapxy(.@mapa$,.@xi,.@yi,0);
	
	if($arenaon){
	
		if(strcharinfo(3) == "fight_05" ) {
			announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all;
			$@qnton--;
			sleep2 2000;
			warp "kame_house",174,177;
		}
		
		if(.@mapa$ == "fight_05"){
			
			if($@qnton < 1){
				announce "Arena da Destruição: Ninguém ganhou a Arena de Combate!",bc_all;
				donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
				end;
			}
				
			if($@qnton == 2){
				announce "[Arena da Destruição]: O grande momento chegou! Restam apenas 2 guerreiros na ARENA! Quem irá vencer?",bc_all;
				end;
			}

			if($@qnton == 1)
			{
				if (isloggedin(killerrid))
				{
					if (attachrid(killerrid))
					{
						doevent strnpcinfo(0)+"::OnArenaPremio";
						end;
					}
					else
					{
						donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
						end;
					}
				}
				else
				{
					donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
					end;
				}
			}
		}
	}
	
end;

OnArenaEvntOff:

	//fecha o evento
	set $arenaon,0;
	set $aberto,0;
	
	//desliga o pvp
	pvpoff "fight_05";

	announce "[Arena da Destruição] Arena finalizada!", 0;
	mapwarp "fight_05","kame_house",174,177;

end;

OnArenaPremio:
	
	announce "[Arena da Destruição]: ACABOU! O ganhador da Arena da Destruição foi " + strcharinfo(0) + "!",bc_all;
	sleep2 2000;
	mapannounce "fight_05", "Parabéns! Você é o grande vencedor!", 0;
	
	getitem $@award, 1;	//entrega o premio
	
	sleep2 1000;
	donpcevent strnpcinfo(0)+"::OnArenaEvntOff";	//closed event

end;



}






////////////////////////////////////////

fight_05	mapflag	nowarp
fight_05	mapflag	nowarpto
fight_05	mapflag	noteleport
fight_05	mapflag	nosave	SavePoint
fight_05	mapflag	nomemo
fight_05	mapflag	nobranch
fight_05	mapflag	nopenalty
fight_05	mapflag	nostorage
fight_05	mapflag	pvp_noparty
fight_05	mapflag	pvp_noguild

////////////////////////////////////////

 

 

yeah, now it's great. LOL
Thanks for your help.
do you think the logic used to decremented the variable when a player dies, is good?
Because I just thought about a future error ... if a player quits, the variable will not be decremented, and this can cause a failure.

I thought about using "getmapusers" but, maybe he can make a mistake in counting, if he also counts the dead player on the map.  o/

Share this post


Link to post
Share on other sites
  • 0
4 hours ago, Tio Akima said:

yeah, now it's great. LOL
Thanks for your help.
do you think the logic used to decremented the variable when a player dies, is good?
Because I just thought about a future error ... if a player quits, the variable will not be decremented, and this can cause a failure.

I thought about using "getmapusers" but, maybe he can make a mistake in counting, if he also counts the dead player on the map.  o/

'getmapusers' only will count a 'dead player' if he still in the map... but you already added this:

Spoiler

		if(strcharinfo(3) == "fight_05" ) {
			announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all;
			$@qnton--;
			sleep2 2000;
			warp "kame_house",174,177;
		}

 

When a player die, it send back to 'kame_house',

 

Now about the the quit players you can do this:

Add:

Spoiler

OnPCLogoutEvent:
	if (strcharinfo(PC_MAP) == "fight_05" && @enter_arena == true)
	{
		announce "[Arena da Destruição]: "+strcharinfo(0)+" fugiu da batalha!",bc_all;

		@enter_arena = false;
		$@qnton--;

		sleep2 2000;
		warp "kame_house",174,177;
		goto OnArenaEvntCheck;
	}
end;

 

 

And change these:

 

OnPCDieEvent part:

Spoiler

OnPCDieEvent:

	getmapxy(.@mapa$,.@xi,.@yi,0);
	
	if($arenaon){
	
		if(strcharinfo(3) == "fight_05" ) {
			announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all;
			$@qnton--;
			sleep2 2000;
			warp "kame_house",174,177;
		}

		if(.@mapa$ == "fight_05"){
OnArenaEvntCheck:
			if($@qnton < 1){
				announce "Arena da Destruição: Ninguém ganhou a Arena de Combate!",bc_all;
				donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
				end;
			}
				
			if($@qnton == 2){
				announce "[Arena da Destruição]: O grande momento chegou! Restam apenas 2 guerreiros na ARENA! Quem irá vencer?",bc_all;
				end;
			}

			if($@qnton == 1)
			{
				if (isloggedin(killerrid))
				{
					if (attachrid(killerrid))
					{
						doevent strnpcinfo(0)+"::OnArenaPremio";
						end;
					}
					else
					{
						donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
						end;
					}
				}
				else
				{
					deletearray(.@units);
					.@count = getunits(BL_PC, .@units, false, "fight_05");

					if (.@count == 1)
					{
						if (attachrid(.@units[0]))
						{
							doevent strnpcinfo(0)+"::OnArenaPremio";
							end;
						}
						else
						{
							donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
							end;
						}
					}
					else
					{
						donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
						end;
					}
				}
			}
		}
	}
	
end;

 

 

Enter arena part:

Spoiler

entrar:
	announce "O jogador ["+strcharinfo(0)+"] entrou na Arena da Destruição!",bc_all;
	percentheal 100,100;
	@enter_arena = true;
	warp "fight_05",0,0;
end;

 

 

I think is it, not tested.

Edited by Cretino

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, Cretino said:

'getmapusers' only will count a 'dead player' if he still in the map... but you already added this:

  Hide contents

if(strcharinfo(3) == "fight_05" ) { announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all; $@qnton--; sleep2 2000; warp "kame_house",174,177; }



		if(strcharinfo(3) == "fight_05" ) {
			announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all;
			$@qnton--;
			sleep2 2000;
			warp "kame_house",174,177;
		}

 

When a player die, it send back to 'kame_house',

 

Now about the the quit players you can do this:

Add:

  Hide contents

OnPCLogoutEvent: if (strcharinfo(PC_MAP) == "fight_05" && @enter_arena == true) { announce "[Arena da Destruição]: "+strcharinfo(0)+" fugiu da batalha!",bc_all; @enter_arena = false; $@qnton--; sleep2 2000; warp "kame_house",174,177; goto OnArenaEvntCheck; } end;



OnPCLogoutEvent:
	if (strcharinfo(PC_MAP) == "fight_05" && @enter_arena == true)
	{
		announce "[Arena da Destruição]: "+strcharinfo(0)+" fugiu da batalha!",bc_all;

		@enter_arena = false;
		$@qnton--;

		sleep2 2000;
		warp "kame_house",174,177;
		goto OnArenaEvntCheck;
	}
end;

 

 

And change these:

 

OnPCDieEvent part:

  Reveal hidden contents

OnPCDieEvent: getmapxy(.@mapa$,.@xi,.@yi,0); if($arenaon){ if(strcharinfo(3) == "fight_05" ) { announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all; $@qnton--; sleep2 2000; warp "kame_house",174,177; } if(.@mapa$ == "fight_05"){ OnArenaEvntCheck: if($@qnton < 1){ announce "Arena da Destruição: Ninguém ganhou a Arena de Combate!",bc_all; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } if($@qnton == 2){ announce "[Arena da Destruição]: O grande momento chegou! Restam apenas 2 guerreiros na ARENA! Quem irá vencer?",bc_all; end; } if($@qnton == 1) { if (isloggedin(killerrid)) { if (attachrid(killerrid)) { doevent strnpcinfo(0)+"::OnArenaPremio"; end; } else { donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } } else { deletearray(.@units); .@count = getunits(BL_PC, .@units, false, "fight_05"); if (.@count == 1) { if (attachrid(.@units[0])) { doevent strnpcinfo(0)+"::OnArenaPremio"; end; } else { donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } } else { donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } } } } } end;



OnPCDieEvent:

	getmapxy(.@mapa$,.@xi,.@yi,0);
	
	if($arenaon){
	
		if(strcharinfo(3) == "fight_05" ) {
			announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all;
			$@qnton--;
			sleep2 2000;
			warp "kame_house",174,177;
		}

		if(.@mapa$ == "fight_05"){
OnArenaEvntCheck:
			if($@qnton < 1){
				announce "Arena da Destruição: Ninguém ganhou a Arena de Combate!",bc_all;
				donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
				end;
			}
				
			if($@qnton == 2){
				announce "[Arena da Destruição]: O grande momento chegou! Restam apenas 2 guerreiros na ARENA! Quem irá vencer?",bc_all;
				end;
			}

			if($@qnton == 1)
			{
				if (isloggedin(killerrid))
				{
					if (attachrid(killerrid))
					{
						doevent strnpcinfo(0)+"::OnArenaPremio";
						end;
					}
					else
					{
						donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
						end;
					}
				}
				else
				{
					deletearray(.@units);
					.@count = getunits(BL_PC, .@units, false, "fight_05");

					if (.@count == 1)
					{
						if (attachrid(.@units[0]))
						{
							doevent strnpcinfo(0)+"::OnArenaPremio";
							end;
						}
						else
						{
							donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
							end;
						}
					}
					else
					{
						donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
						end;
					}
				}
			}
		}
	}
	
end;

 

 

Enter arena part:

  Reveal hidden contents

entrar: announce "O jogador ["+strcharinfo(0)+"] entrou na Arena da Destruição!",bc_all; percentheal 100,100; @enter_arena = true; warp "fight_05",0,0; end;



entrar:
	announce "O jogador ["+strcharinfo(0)+"] entrou na Arena da Destruição!",bc_all;
	percentheal 100,100;
	@enter_arena = true;
	warp "fight_05",0,0;
end;

 

 

I think is it, not tested.

oh nice... I tested it with OnPCLogoutEvent:
but... he warned that the player gave up, but did not trigger the label OnArenaEvntCheck; LOL
 

he stopped for here:

FeI0wNZ.png

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, Cretino said:

I made some changes, now is working fine.

 

OnPCDieEvent part:

  Reveal hidden contents

OnPCDieEvent: getmapxy(.@mapa$,.@xi,.@yi,0); if($arenaon){ if(strcharinfo(3) == "fight_05" ) { announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all; $@qnton--; sleep2 2000; warp "kame_house",174,177; } if(.@mapa$ == "fight_05"){ ARENA_CHECK: if($@qnton < 1){ announce "Arena da Destruição: Ninguém ganhou a Arena de Combate!",bc_all; donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } if($@qnton == 2){ announce "[Arena da Destruição]: O grande momento chegou! Restam apenas 2 guerreiros na ARENA! Quem irá vencer?",bc_all; end; } if($@qnton == 1) { if (isloggedin(killerrid)) { if (attachrid(killerrid)) { doevent strnpcinfo(0)+"::OnArenaPremio"; end; } else { donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } } else { deletearray(.@units); .@count = getunits(BL_PC, .@units, false, "fight_05"); if (.@count == 1) { if (attachrid(.@units[0])) { doevent strnpcinfo(0)+"::OnArenaPremio"; end; } else { donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } } else { donpcevent strnpcinfo(0)+"::OnArenaEvntOff"; end; } } } } } end;



OnPCDieEvent:

	getmapxy(.@mapa$,.@xi,.@yi,0);
	
	if($arenaon){
	
		if(strcharinfo(3) == "fight_05" ) {
			announce "[Arena da Destruição]: "+strcharinfo(0)+" foi derrotado!",bc_all;
			$@qnton--;
			sleep2 2000;
			warp "kame_house",174,177;
		}

		if(.@mapa$ == "fight_05"){
ARENA_CHECK:
			if($@qnton < 1){
				announce "Arena da Destruição: Ninguém ganhou a Arena de Combate!",bc_all;
				donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
				end;
			}
				
			if($@qnton == 2){
				announce "[Arena da Destruição]: O grande momento chegou! Restam apenas 2 guerreiros na ARENA! Quem irá vencer?",bc_all;
				end;
			}

			if($@qnton == 1)
			{
				if (isloggedin(killerrid))
				{
					if (attachrid(killerrid))
					{
						doevent strnpcinfo(0)+"::OnArenaPremio";
						end;
					}
					else
					{
						donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
						end;
					}
				}
				else
				{
					deletearray(.@units);
					.@count = getunits(BL_PC, .@units, false, "fight_05");

					if (.@count == 1)
					{
						if (attachrid(.@units[0]))
						{
							doevent strnpcinfo(0)+"::OnArenaPremio";
							end;
						}
						else
						{
							donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
							end;
						}
					}
					else
					{
						donpcevent strnpcinfo(0)+"::OnArenaEvntOff";
						end;
					}
				}
			}
		}
	}
	
end;

 

 

OnPCLogoutEvent part:

  Reveal hidden contents

OnPCLogoutEvent: if (strcharinfo(PC_MAP) == "fight_05" && @enter_arena == true) { @enter_arena = false; if ($arenaon && !$aberto) { announce "[Arena da Destruição]: "+strcharinfo(0)+" fugiu da batalha!",bc_all; $@qnton--; warp "kame_house",174,177; goto ARENA_CHECK; } } end;



OnPCLogoutEvent:
	if (strcharinfo(PC_MAP) == "fight_05" && @enter_arena == true)
	{
		@enter_arena = false;

		if ($arenaon && !$aberto)
		{
			announce "[Arena da Destruição]: "+strcharinfo(0)+" fugiu da batalha!",bc_all;

			$@qnton--;

			warp "kame_house",174,177;
			goto ARENA_CHECK;
		}
	}
end;

 

 

thanks Cretino. it's perfect! thanks for your help.

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

×
×
  • Create New...

Important Information

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