Jump to content
  • 0

NPC can open another script/txt


Digosok

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   1
  • Joined:  05/28/16
  • Last Seen:  

Hi, rAthena.

how can i make a npc that can display an menu and each menu choosen will bring player to another npc
what i try to say is npc with option and when we select one of menu it will switch to another npc example : warper
another example : player talk to NPC1, npc give sum dialogue and display next selection menu and when player choose an menu called warper then player will automaticaly talk to NPC warper.

which warper,txt is different file and location from NPC1.txt

somebody can help me please?

big regard thanks a lot for who ever master of script of rAthena.

Edited by Digosok
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

prontera,155,181,5	script	NPC_1	4_F_KAFRA1,{
	OnTalk:
		mes "Now you're talking with NPC_1";
		switch(select(
			"Talk with NPC 2",
			"Talk with NPC 3",
			"Cancel"
		)) {
			case 1:
				doevent "NPC_2::OnTalk";
				break;
			case 2:
				doevent "NPC_3::OnTalk";
				break;
			default:
				break;
		}
		close;
}
prontera,155,183,5	script	NPC_2	4_F_KAFRA1,{
	OnTalk:
		mes "Now you're talking with NPC_2";
		next;
		mes "Now you're back to NPC_1";
		doevent "NPC_1::OnTalk";
}
prontera,155,185,5	script	NPC_3	4_F_KAFRA1,{
	OnTalk:
		mes "Now you're talking with NPC_3";
		close;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

use the doevent script command.

add a label to your NPC, then use doevent(...) script command to trigger it.

*doevent "<NPC object name>::<event label>";

This command will start a new execution thread in a specified NPC object at the
specified label. The execution of the script running this command will not stop,
and the event called by the 'doevent' command will not run until the invoking
script has terminated. No parameters may be passed with a doevent call.

The script of the NPC object invoked in this manner will run as if it's been
invoked by the RID that was active in the script that issued a 'doevent'. As
such, the command will not work if an RID is not attached.

	place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
		mes "This is what you will see when you click me";
		close;
	OnLabel:
		mes "This is what you will see if the doevent is activated";
		close;
	}

	....

	doevent "NPC::OnLabel";

 

  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   1
  • Joined:  05/28/16
  • Last Seen:  

12 minutes ago, Emistry said:

use the doevent script command.

add a label to your NPC, then use doevent(...) script command to trigger it.


*doevent "<NPC object name>::<event label>";

This command will start a new execution thread in a specified NPC object at the
specified label. The execution of the script running this command will not stop,
and the event called by the 'doevent' command will not run until the invoking
script has terminated. No parameters may be passed with a doevent call.

The script of the NPC object invoked in this manner will run as if it's been
invoked by the RID that was active in the script that issued a 'doevent'. As
such, the command will not work if an RID is not attached.

	place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
		mes "This is what you will see when you click me";
		close;
	OnLabel:
		mes "This is what you will see if the doevent is activated";
		close;
	}

	....

	doevent "NPC::OnLabel";

 

omg emistry reply me like a dream come true.. 
anyways im an newbie sire what can i do is just edit an work script
can u please make for me a simple one so i can edit it easly and understanding slowly 
but actually that ur reply is quite guides but i still get lil bit confused im so sorry for bothering u
thanks before mr.emistry im ur fan btw

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   1
  • Joined:  05/28/16
  • Last Seen:  

43 minutes ago, Emistry said:

prontera,155,181,5	script	NPC_1	4_F_KAFRA1,{
	OnTalk:
		mes "Now you're talking with NPC_1";
		switch(select(
			"Talk with NPC 2",
			"Talk with NPC 3",
			"Cancel"
		)) {
			case 1:
				doevent "NPC_2::OnTalk";
				break;
			case 2:
				doevent "NPC_3::OnTalk";
				break;
			default:
				break;
		}
		close;
}

prontera,155,183,5	script	NPC_2	4_F_KAFRA1,{
	OnTalk:
		mes "Now you're talking with NPC_2";
		next;
		mes "Now you're back to NPC_1";
		doevent "NPC_1::OnTalk";
}

prontera,155,185,5	script	NPC_3	4_F_KAFRA1,{
	OnTalk:
		mes "Now you're talking with NPC_3";
		close;
}

 

WOW.........
im just an newbies that know nothing about script
after seeing this reply my brain was like 'knowledge installed'
i pretty much understand the logic and story of ur script emistry
THANKS A LOT I LOVE YA.................

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

×
×
  • Create New...