Using Dialog Options outside of the Npc code

09/29/2013 14:43 hacksaw#1
Was just wondering if its possible to use the npc dialog options code outside of the Npc file, and how you would go about it? For instance if i had a quest running where at a certain point a dialog box would show giving you multiple options to choose from but not by clicking an npc, I was trying something like this:

Code:
client.ActiveNpc = 123456;
switch (client.ActiveNpc)
                       {
                        case 123456:
                             {
                            switch (npcRequest.OptionID)
                                    {
                                        case 0:
                                            {
                                                dialog.Text("Dialog goes here.");
                                                dialog.Option("Option1.", 1); 
                                                dialog.Option("Option2.", 2);
                                                dialog.Option("Option3.", 3);
                                                dialog.Option("Exit.", 255);
                                                dialog.Send();
                                                break;
                                            }
                                        case 1:
                                            {
                                                dialog.Text("More speech.");
                                                dialog.Option("Option4.", 4); 
                                                dialog.Option("Option5.", 5);
                                                dialog.Option("Option6.", 6);
                                                dialog.Option("Exit.", 255);
                                                dialog.Send();
                                                break;
                                            }
                                    } break;
                             }
                       }
I was trying something like the above code to make it think ur using an activenpc but it dosent seem to work.
09/29/2013 14:56 atef201080#2
client.ActiveNpc stands for NpcID
change
client.ActiveNpc = 123456;
switch (client.ActiveNpc)
to
int acitvenpc = 123456;
switch (acitvenpc)
09/29/2013 15:14 Smallxmac#3
Yes, it is very possible. But try to understand how it handles opening dialogs, first the client clicks on a npc and it send the ID of that npc to the server along with the option of 0. The server then picks up the request and then uses a switch to find out which npc is being called. Then you switch the option that is being called and then fill the npc with dialog, option, and other jank. After that you send the npc dialog pack back to the client.