Jump to content

Cretino

Members
  • Content Count

    75
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Cretino


  1. Hey, this is one way to do it.

     

    Spoiler
    
    prontera,125,93,5	script	test_girl	1_F_MARIA,{
    
    	setarray .@cards, 4244,4253,4252,4245,4032,4062,4248,4249,4043,4013,4018,4234,4344,4160,4243,4138,4242,4094,4240,4114,4075,4347,4246,4247,4233,4129,4119,4356,4074,4215,4327,4320,4214,4212,4213,4229,4063,4288,4290,4289,4284,4285,4009,4202,4299,4041,4015,4293,4235,4061,4153,4296,4040,4298,4297,4272,4170,4171,4133,4279,4173,4023,4082,4125,4122,4182,4181,4098,4178,4069,4180,4004,4177,4176,4056,4070,4251,4052,4360,4349,4262,4141,4267,4002,4316,4020,4080,4158,4319,4088,4312,4151,4152,4149,4323,4280,4110,4271,4270,4278,4087,4165,4150,4157,4060,4155,4072,4161,4283,4355,4162,4164,4325,4362,4331,4322,4345,4081,4045,4019,4103,4115,4035,4328,4321,4231,4269,4268,4239,4116,4109,4139,4065,4287,4286,4366,4351,4136,4301,4307,4140,4292,4091,4291,4295,4027,4184,4195,4188,4265,4217,4191,4193,4006,4364,4076,4201,4030,4079,4105,4112,4196,4055,4084,4113,4095,4046,4097,4124,4200,4067,4199,4341,4057,4205,4339,4204,4126,4208,4317,4343,4036,4106,4090,4108,4206,4167,4127,4166,4159,4334,4093,4338,4256,4255,4085,4066,4071,4237,4310,4309,4099,4031,4007,4314,4311,4315,4120,4118,4077,4329,4011,4008,4073,4335,4024,4048,4175,4033,4337,4005,4001,4313,4003,4294,4083,4186,4350,4187,4353,4104,4154,4185,4021,4014,4192,4194,4219,4101,4216,4017,4078,4068,4326,4358,4368,4273,4230,4117,4222,4092,4025,4221,4228,4044,4037,4100,4059,4086,4220,4022,4227,4039,4223,4156,4042,4224,4226,4225,4111,4218,4089,4304,4028,4340,4282,4058,4172,4016,4012,4026,4050,4308,4336,4049,4333,4107,4209,4053,4211,4210,4332,4348,4303,4102,4258,4232,4257,4010,4264,4029,4259,4261,4260,4034,4190,4189,4346,4051,4096,4064,4277,4281,4038,4274,4275;
    	.@page_size = 30;
    	.@array_size = getarraysize(.@cards);
    	.@page_count = (.@array_size / .@page_size) + ((.@array_size % .@page_size) > 0 ? 1 : 0);
    	.@my_page = 1;
    	.@limit[0] = 0;
    	.@limit[1] = .@limit[0] + .@page_size;
    	.@npc_name$ = "[List Card]";
    	.@diff = .@page_size;
    
    	if (.@limit[1] > .@array_size)
    	{
    		.@diff = .@page_size - (.@limit[1] - .@array_size);
    		.@limit[1] = .@array_size;
    	}
    
    	mes .@npc_name$;
    
    	while(true)
    	{
    		mes "Please select from " + .@array_size + " cards.";
    		mes "Page " + .@my_page + "/" + .@page_count + "";
    		.@menu$ = "";
    
    		for(.@i = .@limit[0]; .@i < .@limit[1]; .@i++)
    		{
    			.@menu$ += "^FF0000[ " + (.@i + 1) + ". ]^0000FF " + getitemname(.@cards[.@i]) + ":";
    		}
    
    		.@menu$ += ((.@limit[1] >= .@array_size) ? "" : "Next") + ":" + ((.@limit[0] == 0) ? "" : "Back") + ":Cancel";
    		.@seleted = select(.@menu$);
    
    		next;
    		mes .@npc_name$;
    
    		// 'Next' option
    		if (.@seleted == .@diff + 1)
    		{
    			.@limit[0] = .@limit[1];
    			.@limit[1] += .@page_size;
    			.@my_page++;
    
    			if (.@limit[1] > .@array_size)
    			{
    				.@diff = .@page_size - (.@limit[1] - .@array_size);
    				.@limit[1] = .@array_size;
    			}
    			else
    			{
    				.@diff = .@page_size;
    			}
    		}
    		// 'Back' option
    		else if (.@seleted == .@diff + 2)
    		{
    			.@limit[0] -= .@diff + ((.@diff != .@page_size) ? (.@page_size - .@diff) : 0);
    			.@limit[1] -= .@diff;
    			.@my_page--;
    
    			if (.@limit[0] < 0)
    				.@limit[0] = 0;
    
    			if (.@limit[1] < .@page_size)
    				.@limit[1] = .@page_size;
    
    			.@diff = .@page_size;
    		}
    		// 'Cancel' option
    		else if (.@seleted == .@diff + 3)
    		{
    			mes "Ok, back when you need me.";
    			break;
    		}
    		// Card selected
    		else
    		{
    			.@i = .@limit[0] + .@seleted - 1;
    
    			mes "You selected: " + getitemname(.@cards[.@i]) + "";
    			break;
    		}
    	}
    
    	close;
    }

     

     


  2. 35 minutes ago, celeron0134 said:

    Problem of the script

    .@n = getareausers("quiz_02", 246, 372, 246, 372);

    1) if player A is on .@n and player B is not on .@n ~ Player B can talk to the NPC

     

    what to do:

    1) if Player A is on .@n (talking or not talking to the NPC) Player B will not be able to talk to the NPC

        for example .. on a soda machine.. only 1 person at a time can use the soda machine

     

    if ((.@n == 1) && (strcharinfo(0) is not on .@n)) mes "someone is on front of me"; mes "and i am waiting for him/her to talk to me"; mes "wait till the player leave the cell"; end;

    
    	if ((.@n == 1) && (strcharinfo(0) is not on .@n))
    	mes "someone is on front of me";
    	mes "and i am waiting for him/her to talk to me";
    	mes "wait till the player leave the cell";
    	end;
    
    
      

     

    You can use this command:

    Spoiler
    
    *getunits(<type>, <variable>, <limit>{, "<map>"{, <x1>, <y1>, <x2>, <y2>}})
    
    This function searches a whole map or area for units and adds their GID to
    the provided <variable> array. It filters units by <type> and stops searching
    after <limit> units have been found. Set <limit> to false (0) if you wish to
    disable the limit altogether. If <map> is omitted, this command will search
    on the whole server (slow). Returns the number of units added to the array.
    
    Type is the type of unit to search for:
    
    	BL_PC    - Character object
    	BL_MOB   - Monster object
    	BL_PET   - Pet object
    	BL_HOM   - Homunculus object
    	BL_MER   - Mercenary object
    	BL_ITEM  - Item object (item drops)
    	BL_SKILL - Skill object (skill fx & sfx)
    	BL_NPC   - NPC object
    	BL_CHAT  - Chat object
    	BL_ELEM  - Elemental object
    	BL_CHAR  - Shorthand for (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM)
    	BL_ALL   - Any kind of object
    
    ** Do NOT use UNITTYPE_ constants here, they have different values.
    
    ** If battle_config.dynamic_mobs is enabled and no player has entered the map
       yet, the mobs will not have spawned in the map yet, so getunits() will be
       unable to find them when searching for BL_MOB.
    
    Example:
    
    	.@count = getunits((BL_PC | BL_NPC), .@units, false, "prontera");
    
    The above example would search the map "prontera" for all PC and NPC units and
    add them to the .@units array, while setting .@count to the amount of units
    added to the array (useful in for() loops).

     

     


  3. 9 hours ago, Tio Akima said:

    guys

    Hi guys
    with the change of maximum level and maximum status (str, int, luk, etc ...)
    do I need to set the maximum weight too?

    sometimes it happens that the char gets heavy with only 20% of objects in the warehouse

     

    PlubFeH.png

     

    I figured that maybe the weight would adapt to the size of the force (whatever it is, str stats custom or not) 

     

    @EDIT doubt

    I think the 'problem' is the character inventory size.

    The client send the message 'You're overweight', but really you don't have space in your inventory.


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

     

     


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


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

     

     


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

     

     


  8. 9 hours ago, Kavaline said:

    Hi, I want a script that gives the player 5 seconds to type a word, with 'input'. But when the time runs out, the script runs normally, and after, read the event label of the time out.

    Here is what I tried:

    mes "type anything in 5 seconds"; addtimer(5000, strnpcinfo(NPC_NAME_UNIQUE)+"::On5secs"); input(.@text); deltimer(strnpcinfo(NPC_NAME_UNIQUE)+"::On5secs"); next; mes "you did it"; close; On5secs: mes "time over"; close;

    
    	mes "type anything in 5 seconds";
    	addtimer(5000, strnpcinfo(NPC_NAME_UNIQUE)+"::On5secs");
    	input(.@text);
    	deltimer(strnpcinfo(NPC_NAME_UNIQUE)+"::On5secs");
    	next;
    	mes "you did it";
    	close;
    
    On5secs:
    	mes "time over";
    	close;

    Maybe is impossible for the 'timer' force close the 'input', but at least, I want a way that after the 'input', run the time out label if the time out, without run the lines above of the script. How I can do it?

    Not tested, but I think will work.

    Spoiler
    
    	.@duration = 5; // In Seconds
    	.time = gettimetick(2) + .@duration;
    
    	mes "You have " + callfunc("Time2Str", .time) + " to type anything...";
    	addtimer(.@duration * 1000, strnpcinfo(NPC_NAME_UNIQUE) + "::OnTimerEnd");
    	input(.@text$);
    
    	if (.time < gettimetick(2))
    	{
    		mes "Everything is fine!";
    		mes .@text$;
    		deltimer(strnpcinfo(NPC_NAME_UNIQUE) + "::OnTimerEnd");
    		close;
    	}
    	else
    	{
    OnTimerEnd:
    		mes "The time is over!";
    		close2;
    		end;
    	}

     

     


  9. 4 hours ago, Tio Akima said:

    Guys, can someone help me with an idea
    I made an NPC with some missions and that creates an instance
    In one of the missions the player needs to use a certain skill an amount "x" on a given map (in the instance)

     

    example: Use Stormgust 50 times


    So, I'm thinking about how to make this count
    Does anyone have any ideas?
    I've been thinking about on that NPC who tests the damage on Imperium, I don't know ...

    You'll need use this plugin: OnPCUseSkillEvent

     


  10. 11 minutes ago, hadiesyafiq said:

    Can you teach me how to put double drop rate script on your script that you give me?

    I remember a way to do it by script... but I think you need to search and try to make little bit.

    This is the last time I 'teach (give)' you something.

    If you want help to you make something, I can help you with pleasure.

     

     


  11. 3 minutes ago, hadiesyafiq said:

    Hi sir your script is to get base/job exp right?can add double drop rate too sir

    This can't be done without source modification.

    But you can add a buff for VIPs to improve the drop rate: 'SC_CASH_RECEIVEITEM'.

    Search in your 'item_db' for more information.

     

     


  12. What you want to do is not possible with these script commands.

    Spoiler
    
    *setbattleflag("<battle flag>", <value>)
    *getbattleflag("<battle flag>")
    
    Sets or gets the value of the given battle flag.
    Battle flags are the flags found in the conf/map/battle/*.conf files and is
    also used in Lupus' variable rates script.
    
    Examples:
    
    // Will set the base experience rate to 20x (2000%)
    	setbattleflag("base_exp_rate", 2000);
    
    // Will return the value of the base experience rate (when used after the
    // above example, it would print 2000).
    	mes(getbattleflag("base_exp_rate"));

     

    Using 'setbattleflag' you'll change the server rate for all when reload.

     

    If you only want give 2x EXP to 'VIP' players, you can do this:

     


  13. 9 hours ago, Tio Akima said:

    I'm trying to return the player matak using getunitdata, but it's giving error .. where am I going wrong?

     

    .@mymagicatak = getunitdata(getcharid(CHAR_ID_ACCOUNT), UDT_MATKMAX);

     

    but I have an error [Error]: buildin_getunitdata: Unknown object!

     

    I tried to get gid with CHAR_ID_CHAR but it didn't work either

    The actual 'getunitdata' has no support for player units.

    This is why you receive this message error.

    If you want to get values from player units, you'll need to make a source modification.

    I made one, you can test if you want.

     

    getunitdata_pc_type.diff


  14. Yes, but you'll need to create a script command to do.

    You can use this example I made:

     

    rentitem2_by_cretino.diff

     

    rentitem2 usage:

    Spoiler
    
    rentitem2(<item id>, <amount>, <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>, <seconds>{, <account ID>})
    rentitem2("<item name>", <amount>, <identify>, <refine>, <attribute>, <card1>, <card2>, <card3>, <card4>, <seconds>{, <account ID>})

     

     

    I also made a 'protection' if you create a rent item with cards, so players can't remove cards from rent items.

    I think is it you want, good luck. :)


  15. I made some changes in your script, it's working now.

    You can use item id, name or constants.

    Spoiler
    
    function	script	NoItemProduce	{
    	setarray(.disabledItems,501,512,503);
    
    	for(.@i = 0; .@i < getarraysize(.disabledItems); .@i++)
    	{
    		if (getitemname(.disabledItems[.@i]) == getitemname(getarg(0)) || .disabledItems[.@i] == atoi(getarg(0)))
    		{
    			dispbottom("This item is not available for item producing",C_RED);
    			return true;
    		}
    	}
    
    	return false;
    }

     

     


  16. Hey guys, I've tested more my command and found some bugs.

    I made some fixes and improvements, now is working well.

    If have any bug, report to me for trying fix.

    You guys can take the new '.diff' file in first post.

     

    On 8/21/2019 at 10:43 PM, Eternity said:

    Thank you I'll be looking forward Cretino!

    It give me bit of work, but it's done.

    I did some testing and it's working fine.

    Commands for rAthena version:

    @reload "script/mob/shop/warp/function/mapflag/all"

    Diff file: @reload_by_cretino_v0.1_rathena.diff


  17. Name: @reload atcommand

    Creator: Me (@Cretino)

    Version: 0.2 (Some fixes and improvements [Cretino])

    Contributors:

    Q: 'What features have '@reload atcommand'?'

    R:

    Spoiler
    
    You can reload just one thing you want without remove all NPCs, Mobs, etc...
    eg: You can reload your scripts without remove your mobs alive.
    
    @reload "script/mob/shop/warp/trader/function/zone/mapflag/all"
    
    script:
    Only reload your scripts files.
    
    mob:
    Only reload your mobs files.
    
    shop:
    Only reload your shops files.
    
    warp:
    Only reload your warps files.
    
    trader:
    Only reload your traders files.
    
    function:
    Only reload your functions files.
    
    zone:
    Only reload your zones configuration.
    
    mapflag:
    Only reload your mapflags files.
    
    all:
    Reload all npc files like '@reloadscript'.
    
    You can enable 'Reload Fast Mode' to simplify the atcommand uncommenting '#define RELOAD_FAST_MODE' in 'npc.h' after apply the '.diff' file.
    The atcommand will work like this:
    @reload "script/mob/function/zone/mapflag/all"
    
    script:
    Now 'script' will reload all your scripts (including scripts, shops, traders and warps).
    
    mob:
    Only reload your mobs files.
    
    function:
    Only reload your functions files.
    
    zone:
    Only reload your zones configuration.
    
    mapflag:
    Only reload your mapflags files.
    
    all:
    Reload all npc files like '@reloadscript'.

     

    Q: 'How to use these features?'

    R:

    Spoiler
    
    @reload "script/mob/shop/warp/trader/function/zone/mapflag/all"
    
    @reload script
    // Will reload only your scripts files.
    
    @reload script|mob
    // Will reload your scripts and mobs files.
    
    @reload script|mob|mapflag
    // Will reload your scripts, mobs and mapflags files.
    
    @reload shop
    // Will reload only your shops files.
    
    @reload shop|trader|warp
    // Will reload your shops, traders and warp files.
    
    @reload warp
    // Will reload only your warps files.
    
    @reload function
    // Will reload only your functions files.
    
    @reload zone
    // Will reload only your zones configuration.
    
    @reload all
    // Will reload all npc files like '@reloadscript'.
    
    @reload script|mob|shop|warp|trader|function|zone|mapflag
    // Will reload your scripts, mobs, shops, warps, traders, functions, zones and mapflags like '@reload all' or '@reloadscript'.

     

    Q: 'How Can I enable 'Reload Fast Mode'?'

    R:

    Spoiler
    
    After apply the '.diff' file, go to 'src\map\npc.h' and open.
    Search for:
    // [Cretino]
    // Uncomment to enable the reload command fast mode.
    //#define RELOAD_FAST_MODE
    
    enum e_reload_type
    {
    	RELOAD_NONE =		0x000,
    	RELOAD_MOB =		0x001,
    	RELOAD_SCRIPT =		0x002,
    #ifndef RELOAD_FAST_MODE
    	RELOAD_SHOP =		0x004,
    	RELOAD_WARP =		0x008,
    	RELOAD_TRADER =		0x010,
    	RELOAD_FUNCTION =	0x020,
    	RELOAD_ZONE =		0x040,
    	RELOAD_MAPFLAG =	0x080,
    	RELOAD_ALL =		0x0FF
    #else
    	RELOAD_FUNCTION =	0x004,
    	RELOAD_ZONE =		0x008,
    	RELOAD_MAPFLAG =	0x010,
    	RELOAD_ALL =		0x01F
    #endif	/* RELOAD_FAST_MODE */
    };
    
    Change to:
    // [Cretino]
    // Uncomment to enable the reload command fast mode.
    #define RELOAD_FAST_MODE
    
    enum e_reload_type
    {
    	RELOAD_NONE =		0x000,
    	RELOAD_MOB =		0x001,
    	RELOAD_SCRIPT =		0x002,
    #ifndef RELOAD_FAST_MODE
    	RELOAD_SHOP =		0x004,
    	RELOAD_WARP =		0x008,
    	RELOAD_TRADER =		0x010,
    	RELOAD_FUNCTION =	0x020,
    	RELOAD_ZONE =		0x040,
    	RELOAD_MAPFLAG =	0x080,
    	RELOAD_ALL =		0x0FF
    #else
    	RELOAD_FUNCTION =	0x004,
    	RELOAD_ZONE =		0x008,
    	RELOAD_MAPFLAG =	0x010,
    	RELOAD_ALL =		0x01F
    #endif	/* RELOAD_FAST_MODE */
    };
    
    Now, 'Reload Fast Mode' is actived. :) (Need compile the emulator after the change)

     

    I've tested and is working well, but can have bugs.

    I'm accepting suggestions.

    If you found any bug, report in topic or send me a private message.

    I'll solve the problem as quickly as possible.

     

    I think is it. :)

    Note: Sorry for my English.

    Diff file: @reload_by_cretino_v0.2.diff

    @reload_by_cretino_v0.1.diff


  18. Hey guys, I made some modifications and tested.
    Now is working, you just need apply this '.diff' file: star_gladiator_use_tk_mission.diff

    Ranking still working to Taekwon, Star Gladiator only get bonus hp/sp and skills if get max level of base and job.

    Star Gladiator don't receive the skill 'Solar, Lunar and Stellar Shadow'(SG_DEVIL).

    If have any bug, report to me to try fix.

    Good luck. :)


  19. Hey guys, I was testing my script in the latest Hercules revision and realized it had stopped working...
    So I made some updates in script and source code to work again and also with some bug fixes.

    If have any bug, report to me for trying fix.

    New script and source modification in first post.

    @TOPIC

    Version: 1.2 (Updated script and source modification to work with last Hercules revision [Cretino] (Need source modification))


  20. Eu acho que é isto que você está procurando, não testei mas provavelmente está funcionando, só aplicar o arquivo '.diff' no seu emulador ou abrir ele com um bloco de notas e ver onde foram feitas as modificações e fazer manualmente, se por acaso não estiver funcionando avisa ai, por que eu só vi se o código estava compilando e ele está.

    OnPickUpEvent_by_Cretino.diff


    Exemplo de como usar:

    Spoiler

     

    
    -	script	PickUpEvent	FAKE_NPC,{
    	end;
    
    	OnPCPickUpItemEvent:
    		if (@pickup_itemid == 909) // Jellopy
    			dispbottom "Você pegou " + @pickup_amount + "x " + getitemname(@pickup_itemid) + ", totalizando: " + countitem(@pickup_itemid);
    	end;
    }

     

     

     

    @Edit

    Acabei de testar e está funcionando 100%, boa sorte. :)


  21. Aqui está um exemplo básico amigo.

    Está funcionando bem, agora só você fazer suas modificações.

     

     

    que_ng,27,66,4    script    Fogueira#Casa    4_TRACE,{
     
        if (getcharid(CHAR_ID_CHAR) != getpartyleader(getcharid(CHAR_ID_PARTY), 2))
        {
            unittalk getcharid(CHAR_ID_ACCOUNT), "Essa é a famosa " + strnpcinfo(NPC_NAME_VISIBLE) + "!";
            end;
        }
     
        // Se a fogueira estiver acesa, desabilita a opção '- Acender' e ativa '- Assar Peixe' no menu.
        if (select(((.burning == true) ? "- Assar Peixe" : "- Acender") + ":- Sair") == 1)
        {
            if (.burning == true)
            {
                // Se a fogueira estiver acesa, executa o que está aqui...
            }
            else
            {
                .burning = true;
                .burning_time = gettimetick(2) + .burning_duration;
            }
        }
     
        close;
     
        OnInit:
            .burning = false;
            .burning_time = 0;
            .burning_duration = 5;    // Duração da fogueira em segundos.
     
            while(true)
            {
                if (.burning == true)
                {
                    specialeffect EF_KAEN;
     
                    if (.burning_time <= gettimetick(2))
                    {
                        .burning_time = 0;
                        .burning = false;
                    }
                }
     
                sleep 312; // Duração da animação do fogo.
            }
        end;
    }
    

     

×
×
  • Create New...

Important Information

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