Register for your free account! | Forgot your password?

You last visited: Today at 15:10

  • Please register to post and access all features, it's quick, easy and FREE!

 

NPCDialog.cs (LOTF v5017)

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 490
NPCDialog.cs (LOTF v5017)

This is old...


Replace case 2031 and case 2032 (in client.cs) with these

Code:
case 2031:
                        {
                            MyChar.Ready = false;
                            int NPCID = (Data[7] << 24) + (Data[6] << 16) + (Data[5] << 8) + Data[4];
                            SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You tried to talk to npc(ID: " + NPCID + ")", 2005));
                            int Control = (int)Data[10];
                            CurrentNPC = NPCID;
                            NPCDialog.NPCSay(MyChar, this, NPCID, Control);
                            MyChar.Ready = true;
                            break;
                        }
                    case 2032:
                        {
                            MyChar.Ready = false;
                            int Control = (int)Data[10];
                            NPCDialog.NPCSay(MyChar, this, CurrentNPC, Control);
                            MyChar.Ready = true;
                            break;
                        }

put this somewhere in client.cs
Code:
        public void Say(string text)
        {
            SendPacket(General.MyPackets.NPCSay(text));
           
        }
        public void Link(string text, byte option)
        {
            SendPacket(General.MyPackets.NPCLink(text, option));
           
        }
        public void Exit(string text)
        {
            SendPacket(General.MyPackets.NPCLink(text, 255));
            SendPacket(General.MyPackets.NPCSetFace(30));
            SendPacket(General.MyPackets.NPCFinish());
        }
        public void NoRoom()
        {
            SendPacket(General.MyPackets.NPCSetFace(30));
            SendPacket(General.MyPackets.NPCFinish());
        }

make a new file called NPCDialog.cs and replace it all with this
i posted two examples of how to do npcs.. you pick.
Code:
public class NPCDialog
    {
       /* Credits to Arcotemple */

        public static void NPCSay(Character _char, Client _client, int _NPCID, int _CONTROL)
        {

            /* Examples */

            if (_NPCID == 10003)
            {
                if (_CONTROL == 0)
                {
                    _client.Say("Hello, I am a Non-Playable-Character (NPC) created through the new NPC system!");
                    _client.Link("Awesome! How are you?", 1);
                    _client.Exit("That's dumb.");
                }
                if (_CONTROL == 1)
                {
                    _client.Say("I'm great! How about you?");
                    _client.Exit("Superb!!");
                }

            }

            switch (_NPCID)
            {
                case 100003:

                    if (_CONTROL == 0)
                    {
                    }
                    if (_CONTROL == 1)
                    {
                    }

                    break;
            }

        }
    }
your done... for char use _char , for client _client... you dont need to do _client.mychat .. just _char

credits to arco because i said so.



PeTe Ninja is offline  
Thanks
2 Users
Old   #2
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,293
Received Thanks: 919
Wasn't it always like this?


Kiyono is offline  
Old   #3
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 490
no
PeTe Ninja is offline  
Old   #4
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,740
Received Thanks: 5,268
Quote:
Originally Posted by Kiyono View Post
Wasn't it always like this?
Nope it was done in 2 separate sections in client.cs.


Arcо is offline  
Old   #5
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,293
Received Thanks: 919
Quote:
Originally Posted by .Arco View Post
Nope it was done in 2 separate sections in client.cs.
Oh I see, didn't knew that.
Kiyono is offline  
Old   #6
 
elite*gold: 0
Join Date: Apr 2010
Posts: 273
Received Thanks: 50
Good job PeTe, how ever im not gonna use it lol ;P
zTREME is offline  
Old   #7
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,159
Pete, do you even know the reasons why programmers set _ in front of some variables?
_Emme_ is offline  
Old   #8
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,740
Received Thanks: 5,268
Quote:
Originally Posted by EmmeTheCoder View Post
Pete, do you even know the reasons why programmers set _ in front of some variables?
I don't, enlighten me.
Arcо is offline  
Old   #9
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 490
Quote:
Originally Posted by EmmeTheCoder View Post
Pete, do you even know the reasons why programmers set _ in front of some variables?
Emme, I don't care.
PeTe Ninja is offline  
Thanks
1 User
Old   #10
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,124
Received Thanks: 2,498
Quote:
Originally Posted by EmmeTheCoder View Post
Pete, do you even know the reasons why programmers set _ in front of some variables?
It all comes down to personal choice, its not like its a requirement
Korvacs is offline  
Old   #11
 
elite*gold: 0
Join Date: Nov 2009
Posts: 129
Received Thanks: 45
Quote:
Originally Posted by EmmeTheCoder View Post
Pete, do you even know the reasons why programmers set _ in front of some variables?
Private variables or construction parameters defined conflicting with existing class types.

It's a programmers convention, not exactly a guideline of any sort.
~Falcon is offline  
Old   #12
 
elite*gold: 0
Join Date: Feb 2010
Posts: 129
Received Thanks: 30
I been working on a LOTF source :O
So thanks pete (:
Øblivion is offline  
Old   #13
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 490
Quote:
Originally Posted by Øblivion View Post
I been working on a LOTF source :O
So thanks pete (:
np.. im gonna be creating a new npc system that works 2x as better.. so if u need help with anything lotf related or anything C# related u can ask meee
PeTe Ninja is offline  
Thanks
1 User
Old   #14
 
elite*gold: 0
Join Date: Feb 2010
Posts: 129
Received Thanks: 30
Quote:
Originally Posted by PeTe Ninja View Post
np.. im gonna be creating a new npc system that works 2x as better.. so if u need help with anything lotf related or anything C# related u can ask meee
That would be great if i run into any problems ill message you :P
Øblivion is offline  
Old   #15
 
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 505
LOL @ this code.
Why did you call things _Control, I know why I do that things, but I only use it for private variables and not like this, it made me laugh how you tried to make your code look better.
Besides, you cannot make the NPCDialog system better, only easier.


Basser is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
npcdialog (5018)
does this look right for npc dialog? (arco's) case 333333://test id { if...
5 Replies - CO2 PServer - Discussions / Questions
5156 NPCDialog (Item and ClientSockets Problems)
Friends, I'm having trouble compiling sources NewestCOServer, specifically giving this error in the following source: NPCDialog.cs ClientSocket...
3 Replies - CO2 PServer - Discussions / Questions
Npcdialog
Helo all i am working on 5180 source i aded mobs spawn some more futures,now i wan add npc dialog not from cq_acion but normal like in coemu etc,but...
0 Replies - CO2 PServer - Discussions / Questions
[HELP] Compile error with LOTF(i know LOTF sucks but just help)
It says: Loaded 254 portals. Loaded 1027 NPCs. Loaded 37 mobs. Loaded 11147 items. Loaded 172 mob spawns. System.ArgumentOutOfRangeException:...
3 Replies - CO2 PServer - Discussions / Questions



All times are GMT +2. The time now is 15:10.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.