Jump to content
  • 0

multi language sytem npc


Question

Posted

Good night guys.

1 - I am trying to make a multi language system on my server. But the npc I did hangs the character and does not work. In the emulator does not return any error:

This appears in Putty:

[Warning]: npc_scriptcont: failed npc_checknear test.

I'm not sure if I'm using OnPCLoginEvent: the wrong way.

Can anyone give me a light???

new_zone02,98,30,1	script	Language Changer	412,{
OnPCLoginEvent:
mes "^0000FF[Tradutor]^000000";
mes " * Por favor escolha o Idioma:";
mes " * Please choose a language:";
next;
menu "Português",L_Por,"English",L_Eng;
L_Por:
  set #language,0;
  next;
  mes "^0000FF[Tradutor]^000000";
  mes "Obrigado.";
  mes "Divirta-se no Servidor HonorBR.";
  close;
L_Eng:
  set #language,1;
  next;
  mes "^0000FF[Translator]^000000";
  mes "Thank you.";
  mes "Have fun on HonorBR Server.";
  close;
}

2 - I researched here in the forum and found this topic:

https://rathena.org/board/topic/93969-language-system/#comment-251066

you could check if the use in the other npcs is still like this:

 

if (#language == 1) {
Germany Text
} else {
Englisch Text
}

Thank you. And thank you for the opportunity.

TRADUÇÃO PT_BR:

Boa noite galera.

1 - Estou tentando fazer um sistema de multi idioma no meu servidor. Mas o npc que fiz trava o personagem e não funciona. No emulador não retorna nenhum erro:
Isso aparece no Putty:
[Warning]: npc_scriptcont: failed npc_checknear test.
Não sei se estou usando o OnPCLoginEvent: de maneira errada.
alguém pode me dar uma luz???
2 - Eu pesquisei aqui no forum e encontrei esse tópico:
vocês podiam verificar se o uso nos outros npcs é mesmo assim:

Obrigado. E desde já agradeço a oportunidade.

*OBS= Eu sempre tento colocar a tradução para o PT_BR para ajudar outros brasileiros com a mesma dúvida.

* OBS = I always try to put the translation to PT_BR to help other Brazilians with the same doubt.

13 answers to this question

Recommended Posts

  • 0
Posted (edited)

Oh, well.

new_zone02,98,30,1	script	Language Changer	412,{
OnPCLoginEvent:
	mes "^0000FF[Tradutor]^000000";
	mes " * Por favor escolha o Idioma:";
	mes " * Please choose a language:";
	next;
	
	switch(select("Português:English")){
		set #language, @menu - 1;
		next;
	
		case 1:
			mes "^0000FF[Tradutor]^000000";
			mes "Obrigado.";
			mes "Divirta-se no Servidor HonorBR.";
			close;
		case 2:
			mes "^0000FF[Translator]^000000";
			mes "Thank you.";
			mes "Have fun on HonorBR Server.";
			close;
	}
}

This one seems to work nicely, I just optimized it a bit.
Avoiding the 'menu' command that is obsolete by now.
 

Edited by Haziel
  • 0
Posted

Tks for your help.

I did not understand how he arrows the variable

set #language, @menu - 1;

For the use that I am going to give is to put in the other npcs the check of the variable if X = portugues if Y = Ingles as the example:

if (#language == 1) {
Germany Text
} else {
Englisch Text
}



 

PT_BR:

Não entendi como ele seta a variavel 

set #language, @menu - 1;

Pois o uso que eu vou dar é colocar nos outros npcs a verificação da variavel se X=portugues se Y = Ingles conforme o exemplo:

if (#language == 1) {
Germany Text
} else {
Englisch Text
}

 

  • 0
Posted (edited)

When a player selects an option on a menu, a temporary variable is set until the npc finishes to run.
If the first option is chosen, it sets @menu to 1, if the second one, it sets @menu to 2.

Since Portuguese were 0 and English were 1 on your original setting, I just got the value of the @menu variable and took 1 from it, so:

If he selects the first option, the #language variable will be set to @menu - 1, @menu is currently 1 and we need it to be zero.
Same for english, second option will return @menu 2, and we need it to be 1, so, @menu - 1 works for both cases.

Edited by Haziel
  • 0
Posted

When I use the character this in the npc map it works right. But when the npc is in another map and I soon in the game the npc hangs the character and does not appear options to close and / or choose the language. It will be some error with the OnPCLoginEvent: ???

pt_br:
 

Quando eu uso o personagem esta no mapa do npc ele funciona direito. Mas quando o npc esta em outro mapa e  eu logo no jogo o npc trava o personagem e não aparece opções de fechar e/ou escolher o idioma. Sera algum erro com o OnPCLoginEvent: ???


 

erro1.png

erro2.png

  • 0
Posted

 

Yes. I'm using the late December version. And I've reduced the number of npcs making OnPCLoginEvent calls. I do not know what could be the problem was to be something very simple.

  • 0
Posted

I wouldn't do this one on OnPCLogin at all.
I would do an invisible NPC activated by OnTouch on the place people logs in the first time.

  • 0
Posted

Then it would look like this:

 

new_zone02,98,30,1	script	Language Changer	412,{
	OnTouch:
	mes "^0000FF[Tradutor]^000000";
	mes " * Por favor escolha o Idioma:";
	mes " * Please choose a language:";
	next;
	
	switch(select("Português:English")){
		set #language, @menu - 1;
		next;
	
		case 1:
			mes "^0000FF[Tradutor]^000000";
			mes "Obrigado.";
			mes "Divirta-se no Servidor HonorBR.";
			close;
		case 2:
			mes "^0000FF[Translator]^000000";
			mes "Thank you.";
			mes "Have fun on HonorBR Server.";
			close;
	}
}

 

  • 0
Posted

Yeah, but you need to set the square range of the NPC at the header of it:

new_zone02,98,30,1	script	Language Changer	412,3,3{

As an example, this would pop up in a 6 x 6 range around the NPC.

  • 0
Posted
5 hours ago, Secrets said:

I was considering dropping implicit @menu assigning behavior from rAthena. It is a very old and obsolete behavior, don’t use it.

Please don't do this. This is very useful and very good command. 

  • 0
Posted
8 hours ago, Secrets said:

I was considering dropping implicit @menu assigning behavior from rAthena. It is a very old and obsolete behavior, don’t use it.

Dropping the auto assignment just to force us assing to a variable here and there? Hmm, seems like one more line: set, select and then switch(var).

  • Love 1

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...