[HELP]Calling an NPC dialog from inside a current NPC [5375]

10/10/2011 17:38 devilsmum#1
I have been trying to call another NPCs dialog from within the current NPC. i.e

NPC1

Code:
case 001:
{
	switch (npcRequest.OptionID)
	{
		case 0:
		{
			dialog.Text("Hello, I can teleport you to the market for free. Would you like me to?");
			dialog.Option("Yes Please", 1);
			dialog.Option("No Thanks", 255);	
			dialog.Send();
			break;
		}
		case 1:
		{
			// Calls the NPC 002
		}
	}
	break;
}
NPC2

Code:
case 002:
{
	switch (npcRequest.OptionID)
	{
		case 0:
		{
			client.Entity.teleport(1036, 500, 500);
			break;
		}
	}
	break;
}
So for examples sake, I want the first NPC (001) to call the second NPC (002) when case 1 is initiated.

Now the namespace of the file is NpcDialogs and the class is Dialogs. The method which gets the dialogs is called GetDialog which has two variables, NpcRequest npcRequest and GameState client.

I have tried switching the active NPC to the new NPC, i.e client.ActiveNPC = 002;

Any help would be much appreciated as I have less time to work on the source since University has started.
10/10/2011 17:48 pwerty#2
You have to build npc dialog packet. and pass the npcdialogID(2 or 002?) with dialogID 0!
10/10/2011 17:51 _DreadNought_#3
Why are you linking to another npc to teleport in the firtst place?

#edit

Impulse's source requires alot of modifications for its NPCSystem as I found out, as it is I was unable to do what your trying to achieve. I just invented my own npc system to make it alot easier.
10/10/2011 18:02 Spirited#4
You could just pretend like you are.
Change the avatar and you're done. You can also just make an npc packet using the other one's id... or make a path finding packet that triggers the next npc if it's out-of-screen.
10/10/2011 18:39 pro4never#5
Alternatively...

Set client last npc used to the new npc id and then just re-call the useNPC method using the new npcid and linkback 0.

Don!
10/10/2011 19:30 devilsmum#6
Quote:
Originally Posted by _DreadNought_ View Post
Why are you linking to another npc to teleport in the firtst place?
It was for examples sake, I don't really want it for something as trivial as that :P


@everyone: I will try what you recommend and come back with results.

Thanks