Jump to content
  • 0
Sign in to follow this  
Fanthasy

NPC - hideonnpc/hideoffnpc and another question

Question

The title of the post is very self-describing! I'm here because I need your help on this issue, I developed an NPC for an instance of Chefenia, I applied hideonnpc and hideoffnpc and in theory it works well! But he is just hidding the main NPC, his duplicates are on display, I wonder if you could help me.

Follow the NPC code;

Spoiler

 

//=================================|===============|||||||/////\\\\\\|||||||||||/////////\       |/////|==============|
//Cheffenia                        |===============||||||//////\\\\\\\||||||||||//////////\      |/////|==============|
//=================================|===============|||||///////\\\\\\\\|||||||||///////////\     |/////|==============|
//Script adaptado para:           .|=====||||||||||||||///////  \\\\\\\\||||||||////////////\    |/////|==============|
//=================================|===========|||||||///////    \\\\\\\\|||||||/////| \/////\   |/////|==============|
//=================================|===========||||||///////      \\\\\\\\||||||/////|  \/////\  |/////|==============|
//Adaptado por: Fanthasy           |===========|||||///////////\\\\\\\\\\\\|||||/////|   \/////\ |/////|==============|
//=================================|=====||||||||||////////////\\\\\\\\\\\\\||||/////|    \////////////|==============|
//Versão: 1.6                      |=====|||||||||///////           \\\\\\\\\|||/////|     \///////////|==============|
//=================================|=====||||||||///////             \\\\\\\\\||/////|      \//////////|==============|
//                                 |=====|||||||///////               \\\\\\\\\|/////|       \/////////|==============|
//=====================================================================================================|==============|
-	script	Sample	-1,{

OnNPCKillEvent:
		setarray .@IDMvP[0],2600,2601,2602,2603,2604,2605,2606,2606,2607,2608,2609,2610,2611,2612,2613,2614,2615,2616,2617,2618,2619,2620,2621,2622,2623,2624,2625,2626,2627,2628,2629,2630,2631,2632,2633,2635,2636,2637,2638,2639,2640,2641,2642,2643,2645;
		setarray .@PTMvP[0],   1,	1,	 1,	  1,   1,	1,	 1,	  1,   1,	1,	 1,	  1,   1,	1,	 5,   1,   1,   5,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   1,   5,  15,  15,  15,  15,  15,  15,  15,  15,  15,  35,  30,  40,  45,  50;

		setarray .@reward[0],
				14970, 1, 1,	//Tiquet VIP 5 dias
				20060,	1,	5,	//Caixa de Stuffs
				12210,	1,	2,	// Goma de Mascar
				13989,	1,	50,	//Caixa de Bomba Ácida
				2345, 1, 1,	//Couraça da Furia Flamejante Slotada
				2347, 1, 1,	//Couraça da Submissão Oceânica Slotada
				2349, 1, 1,	//Couraça da Liberdade Celestial Slotada
				2351, 1, 1,	//Couraça da Perceverança Continental
				2543, 1, 2,	//Manteal de Sílfides
				2439, 1, 2,	//Sapatos Refrescantes
				20062,	1,	001,	//Ticket Comércio Cheffenia
				2737,	1,	1,	//Tornozeleira Marinha
				14999,	1,	1,	//150 Bandeiras Nacionais
				//4702,	1,	01,	//RUNA FOR+3
				//4712,	1,	01,	//RUNA INT+3
				//4722,	1,	01,	//RUNA DEX+3
				//4732,	1,	01,	//RUNA AGI+3
				//4742,	1,	01,	//RUNA VIT+3
				//4752,	1,	01,	//RUNA LUK+3
				2787,	1,	2,	//Broche Gota D'agua
				2789,	1,	2,	//Anél de Bradium
				2790,	1,	2,	//Broche de Bradium
				2788,	1,	2,	//Brinco de Bradium
				7619,	1,	001,	//Elunium Enriquecido
				7620,	1,	001,	//Oridecom Enriquecido
				30136,	1,	1,	//Bastão de Coelho
				30135,	1,	15,	//Balão de Ash
				30601,	1,	10, // Aura de LHZ Preta Vermelha
				30200,	1,	50,	//Aura de Abóboras
				30229,	1,	50,	//Aura de Balões Flutuantes
				30182,	1,	50,	//Aura de Borboletas
				30186,	1,	25,	//Fone de Ouvidos Branco
				30600,	1,	1,	//DeadMouse Cinza
				30602,	1,	1,	//DeadMouse Azul
				30604,	1,	1,	//DeadMouse Verde
				30606,	1,	1,	//DeadMouse Laranja
				30608,	1,	1,	//DeadMouse Vermelho
				30238,	1,	1;	//DeadMouse Rosa
				

			for( set .@i, 0; .@i < getarraysize(.@IDMvP); set .@i, .@i + 1 )
			if((killedrid == .@IDMvP[.@i]) && ( strcharinfo(3) == "bossnia_01" ))
		{
			set #pointbosnia,#pointbosnia + [email protected][[email protected]];
			dispbottom "Parabéns, você acaba de derrotar o monstro "+getmonsterinfo(killedrid,0)+", sua pontuação por recompensa é de "+.@PTMvP[.@i]+" pontos!";
			dispbottom "Você tem "+#pointbosnia+" de pontos";

			for( set .@a, 0; .@a < getarraysize(.@reward); set .@a, .@a + 3 )
			{
				set .@rand,rand(0,10000);
				if((getitemname(.@reward[.@a]) != "null") && (.@rand <= .@reward[.@a+2]))
				{
					getitem .@reward[.@a],.@reward[.@a+1];
					announce "O player "+strcharinfo(0)+" obteve "+.@reward[.@a+1]+"x "+getitemname(.@reward[.@a])+" por ter matado o monstro "+getmonsterinfo(killedrid,0)+".",0;
				}

			}
		}
end;

}

bossnia_01,203,204,0	warp	bossnia04	1,1,prontera,156,176

bossnia_01,0,0,0,0	monster	[Boss]Hatii	2600,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Gorynych	2601,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Lady Branca	2602,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Doppelganger	2603,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Dark Lord	2604,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Dracula	2605,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Drake	2606,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Maya	2607,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Abelha Rainha	2608,2,300000
//bossnia_01,0,0,0,0	monster	[Boss]Bafomé	2609,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Egnigem Cenia	2610,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Amon Ra	2611,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Atroce	2612,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Vesper	2613,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Eddga	2614,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Osiris	2615,2,300000
//bossnia_01,0,0,0,0	monster	[Boss]Senhor dos Orcs	2616,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Orc Heroi	2617,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Samurai Encarnado	2618,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Flor do Luar	2619,2,300000
bossnia_01,0,0,0,0	monster	[Boss]LOD	2620,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Lady Tanee	2621,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Tao Gunka	2622,2,300000
bossnia_01,0,0,0,0	monster	[Boss]General Tartaruga	2623,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Faraó	2624,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Stormy Knight	2625,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Freonni	2626,2,300000
bossnia_01,0,0,0,0	monster	[Boss]GTB	2627,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Serpente Suprema	2628,2,300000
bossnia_01,0,0,0,0	monster	[Boss]RSX-0806	2629,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Pesar Noturno	2630,2,300000
bossnia_01,0,0,0,0	monster	[Boss]Detale	2631,1,300000
bossnia_01,0,0,0,0	monster	[Boss]Ktullanux	2632,1,300000
bossnia_01,0,0,0,0	monster	[Boss]Kiel D-01	2633,1,300000
bossnia_01,0,0,0,0	monster	[Boss]Thanatos	2635,1,300000
bossnia_01,0,0,0,0	monster	[Boss]Bispo	2636,1,300000
bossnia_01,0,0,0,0	monster	[Boss]Nidhogg	2637,1,300000
bossnia_01,0,0,0,0	monster	[Boss]Leão de Vinhas	2638,1,300000
bossnia_01,0,0,0,0	monster	[Boss]Mamute	2639,1,300000
bossnia_01,0,0,0,0	monster	[S-Boss]Belzebu	2640,1,600000
bossnia_01,0,0,0,0	monster	[S-Boss]Valk Randgris	2641,1,600000
bossnia_01,0,0,0,0	monster	[S-Boss]Ifrit	2642,1,600000
bossnia_01,0,0,0,0	monster	[S-Boss]Satã Morroc	2643,1,600000
bossnia_01,0,0,0,0	monster	[S-Boss]Evil Shadow	2645,1,600000


prontera,155,284,4	script	Portal de Cheffenia::bsw	723,{
mes "[Voz]";
		mes ""+strcharinfo(0)+"...";
		mes "Se você se aproximou deste portal siguinifica que você é corajoso o suficiente para encarar os desafios...";
			next;
		mes "[Voz]";
		mes "Esses portais não surgiram atoa, nosso mundo enfrenta constantemente uma tentativa de ser invadido por monstros...";
			next;
		mes "[Voz]";
		mes "Monstros esses que estão aprissionados em um lugar impossível de se sobreviver, exceto se tiver habilidades que os destrua, caso você seja um desses com dons você poderá entrar e enfrenta-los!";
			next;
		mes "[Voz]";
		mes "Se deseja enfrenta-los precisa saber que um preço tem que ser pago par apoder adentrar nesta instância, vai enfrenta-los?";
		mes "O preço a ser pago seria com sua vida, mas... Te darei essa chance!";
next;
if (Zeny > 1) {
	mes "[Voz]";
	mes "Você vai enfrentar este desafio ?";
	mes "Certo. Em seguida, escolha o lugar do mapa que deseja ser teleportado!";
	mes "^FF0000ATIVA O AUTOLOOT^000000!";
	mes "^FF0000ATIVA O AUTOLOOT^000000!";
	mes "^FF0000ATIVA O AUTOLOOT^000000!";
	next;
			menu "Posição A",P1,
			"Posição B",P2,
			"Posição C",P3,
			"Posição D",P4;
		P1:
			warp "bossnia_01",31,208;
			next;
		
		P2:
			warp "bossnia_01",30,30;
			next;
		
		P3:
			warp "bossnia_01",209,30;
			next;
		P4:
			warp "bossnia_01",209,210;
			next;
		}
	
mes "[Voz]";
mes "Parece que você não tem requisitos o sificiente para entrar, sinto muito!";
mes "Volte quando tiver!";
close;
OnInit:
if (gettime(4) > 4 || gettime(4) == 0) {
	if(gettime(4) == 4 && gettime(3) > 18) end;
	else if (!gettime(4) && gettime(3) < 22) end;
	else if (gettime(4) == 6) end;		
}
hideonnpc "bsw";
end;
OnFri1800:
announce "O portal para Cheffenia abrirá em 1 minuto!",0;
hideoffnpc "bsw";
end;
OnSun2200:
announce "Os portais de Cheffenia se fecharam! Até a proxima semana!",0;
hideonnpc "bsw";
end;
	}
//==========================Duplicates de Cheffenia============================================|
morocc,165,102,5	duplicate(bsw)	Portal de Cheffenia#02	723
payon,145,230,5	duplicate(bsw)	Portal de Cheffenia#03	723
comodo,209,153,5	duplicate(bsw)	Portal de Cheffenia#04	723
gonryun,152,127,5	duplicate(bsw)	Portal de Cheffenia#05	723
louyang,217,105,5	duplicate(bsw)	Portal de Cheffenia#06	723
lighthalzen,146,100,5	duplicate(bsw)	Portal de Cheffenia#07	723
//==========================Bloqueio de Habilidades============================================|
bossnia_01	mapflag	nowarpto
bossnia_02	mapflag	nowarpto
bossnia_03	mapflag	nowarpto
bossnia_04	mapflag	nowarpto
bossnia_01	mapflag	nowarp
bossnia_02	mapflag	nowarp
bossnia_03	mapflag	nowarp
bossnia_04	mapflag	nowarp
bossnia_01	mapflag	nomemo
bossnia_02	mapflag	nomemo
bossnia_03	mapflag	nomemo
bossnia_04	mapflag	nomemo
bossnia_01	mapflag	nobranch
bossnia_02	mapflag	nobranch
bossnia_03	mapflag	nobranch
bossnia_04	mapflag	nobranch
bossnia_01	mapflag	noreturn
bossnia_02	mapflag	noreturn
bossnia_03	mapflag	noreturn
bossnia_04	mapflag	noreturn
bossnia_01	mapflag	nosave	SavePoint
bossnia_02	mapflag	nosave	SavePoint
bossnia_03	mapflag	nosave	SavePoint
bossnia_04	mapflag	nosave	SavePoint

My second question is, in this npc there is a charge to access the instance, but I was not able to make this charge only once every 24 hours for example, I was wondering how do I charge it only once during the period that I set, it's possible, I know, I just don't know how to develop this function, could you please help me?

Observations: I'm not an expert scripter so I'm sorry if there are functions that are without specific logic.

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0
20 hours ago, Fanthasy said:

My second question is, in this npc there is a charge to access the instance, but I was not able to make this charge only once every 24 hours for example, I was wondering how do I charge it only once during the period that I set, it's possible, I know, I just don't know how to develop this function, could you please help me?

Since i'm lazy to read the whole content and just saw this.. I will answer only this one.

you can do it by adding a variable to the player which contains timestamp 😃

Share this post


Link to post
Share on other sites
  • 0
4 hours ago, Haruka Mayumi said:

Since i'm lazy to read the whole content and just saw this.. I will answer only this one.

you can do it by adding a variable to the player which contains timestamp

Hehe I apologize for all this content in the post, I just needed to really show what my question was.

I am as much as unexpected as this part, could you give me a direction on how to make this timestamp? Or give me an example of where to see a similar function?

Share this post


Link to post
Share on other sites
  • 0
Quote

The title of the post is very self-describing! I'm here because I need your help on this issue, I developed an NPC for an instance of Chefenia, I applied hideonnpc and hideoffnpc and in theory it works well! But he is just hidding the main NPC, his duplicates are on display, I wonder if you could help me.

hideoonnpc / hideoffnpc will only work on the npc object that was passed in the input and this excludes duplicate NPC's

Quote

My second question is, in this npc there is a charge to access the instance, but I was not able to make this charge only once every 24 hours for example, I was wondering how do I charge it only once during the period that I set, it's possible, I know, I just don't know how to develop this function, could you please help me?

Easiest way is to declare a variable like below when entering instance

your_instance_name_timer = gettimetick(2) + 86400;

and then perform a check on your script before anyone can enter your instance

if (your_instance_name_timer > gettimetick(2)) {
	mes "you can only enter this instance after " + Time2Str(your_instance_name_timer) + ".";
}

 

Share this post


Link to post
Share on other sites
  • 0
it doesn't work on duplicates because you're hard-coding the npc name.
each duplicate has a unique name, you need to use that in your code.
simply change
Quote

hideonnpc "bsw";

 to
Quote

hideonnpc strnpcinfo(3)

and it should work.
 
as for your second question, look into Patskie's answer
Edited by Mastagoon

Share this post


Link to post
Share on other sites
  • 0
On 11/27/2020 at 11:23 AM, Patskie said:
your_instance_name_timer = gettimetick(2) + 86400;

and then perform a check on your script before anyone can enter your instance

if (your_instance_name_timer > gettimetick(2)) {
	mes "you can only enter this instance after " + Time2Str(your_instance_name_timer) + ".";
}

I can understand the logic within these lines, but I cannot apply it within what I want to do.

ex: I would like the player to pay a fee to enter the instance, and after that payment he is free to enter and leave as many times as he wants until the end of the instance period, when that period ends, his pass is revoked.

Can you understand? I don't know if I explained it well, my English isn't that great.

Share this post


Link to post
Share on other sites
  • 0

Olá. eu sou supeeer leigo, mas pelo pouco que eu sei, a maneira mais simples e viável é um simples "if"

Qualquer coisa desculpa se estiver falando besteira >_>

Exemplo...

{ script que teleporta }
if (freewarp == 0), {script cobrando}
Else (freewarp == 1) {script teleportando}

(Script confirmando pagamento)
Set freewarp, 1;

 

aí no caso se tiver uma horária específica, vc pode botar um "&& (gettime)"

 

Se for um passe temporário ( tipo que dura X horas ) acho que o mais viável seria cobrar ter uma "moeda" com rentitem ou algo do tipo

Edited by Premmy

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.

Sign in to follow this  

×
×
  • Create New...

Important Information

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