Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 23:22

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

Advertisement



[Request Help] Shop & NPC Talk (5165)

Discussion on [Request Help] Shop & NPC Talk (5165) within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2010
Posts: 378
Received Thanks: 86
[Request Help] Shop & NPC Talk (5165)

Hey Everyone.
Some of you might know that I'm working on the "Starter Quest" for Noobs.
I'm having a big problem though...

My problem is, I want to make this NPC:

Code:
4 40 1 0 1002 412 366
and make it so that it can talk to you, and then if you click a link to Control 2, it will bring up the shop.
Help? =\
-NewDawn- is offline  
Old 03/29/2010, 09:43   #2
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
And you still believe you are better than me?

The only way you can talk to a shop npc is through client packets, for e.g. if you start a quest , it will start walking to a npc, once you are around that npc, it will send a 10010 packet, with the npc's ID. Then you just answer to that packet with npc dialog packets.
And for opening the shop use a proxy to get the packet.
-impulse- is offline  
Old 03/29/2010, 22:30   #3
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Sending packets.
Easy nuff right?
Arcо is offline  
Old 03/29/2010, 23:34   #4
 
elite*gold: 0
Join Date: Feb 2010
Posts: 378
Received Thanks: 86
I have no idea. I've never seen an example of it. I've been fooling around with it and trying to figure it out but I got nothing.

and impulse, reported.
I never said I'm better than you. I don't even know who you are.
Stop spamming my posts with flames.

however, impulse- u're saying that it can be done by using the 10010 packet and interaction with the client?
-NewDawn- is offline  
Old 03/29/2010, 23:46   #5
 
ImmuneOne's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 754
Received Thanks: 544
Code:
-> Direction(Entity.X, Entity.Y, NPC.X, NPC.Y);
-> Walk into direction =
{
   if (Distance(Entity.X, NPC.X, Entity.Y, NPC.Y) <= 2)
         NPC.Interact();
}
As I don't know the definitions in your source, you can figure it out on your own.
ImmuneOne is online now  
Thanks
1 User
Old 03/29/2010, 23:50   #6
 
elite*gold: 0
Join Date: Feb 2010
Posts: 378
Received Thanks: 86
Quote:
Originally Posted by ImmuneOne View Post
Code:
-> Direction(Entity.X, Entity.Y, NPC.X, NPC.Y);
-> Walk into direction =
{
   if (Distance(Entity.X, NPC.X, Entity.Y, NPC.Y) <= 2)
         NPC.Interact();
}
As I don't know the definitions in your source, you can figure it out on your own.
That's not what I was trying to do but that's really helpful so thanks!
=]

What I'm trying to do is have it so that you can open the Armor shop after talking to him... here, i'll get some pictures- hold on.

Like this:

and then "I need to buy some equipment" = control 2 which goes to this window:


If you guys help me with this then I'll release the Starter Quest.
I admit that I'm not the best coder and i'm not ashamed of it since it's impossible to know everything about coding in 1 month. Please give me some help you guys, I'd really like to learn how to do this.

I also found this in Shop.dat:
Code:
[Shop14]
ID=4
Name=Armorer
Type=1
MoneyType=0
ItemAmount=39
Item0=123003
Item1=123013
Item2=123023
Item3=123033
Item4=112003
Item5=112013
Item6=112023
Item7=112033
Item8=132005
Item9=132015
Item10=118003
Item11=118013
Item12=118023
Item13=118033
Item14=111003
Item15=111013
Item16=111023
Item17=111033
Item18=113005
Item19=113013
Item20=114003
Item21=114013
Item22=114023
Item23=114033
Item24=135003
Item25=135013
Item26=135023
Item27=130005
Item28=130015
Item29=130025
Item30=131005
Item31=131015
Item32=131025
Item33=133005
Item34=133015
Item35=133025
Item36=134005
Item37=134015
Item38=134025
which means...
Code:
4 40 1 0 1002 412 366
4 is the id, 40 is the npc-mesh id, 1 means shop, 0 means non-pkable, and then location.
So if I change it to dialog (2) then... i have to figure out how to link it to the shop...

How does it link in the first place?
-NewDawn- is offline  
Old 03/30/2010, 00:05   #7
 
ImmuneOne's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 754
Received Thanks: 544
Change the NPC Type and call the shop packet when clicking control 2?
ImmuneOne is online now  
Old 03/30/2010, 00:11   #8


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
That would require re-spawning the npc everytime someone interacts with it.

It seems more like its a newer addition to the latest clients, i experimented with this exact thing a while back around 5100 and found that the only npcs i could make it work with without sending respawn packets and what not, are npcs which make a an NPCinteraction request (like requesting a dialog), and then the server responds with a 1010 dialog display.

Prime example would be the warehouse men, you can easily have a massive conversation and then display the warehouse, because its the same NPC type, if you wanted to do it with shops you would require 2 NPC definitions, one a shop, the other a text dialog npc, then spawn the second one when you click the second dialog, however the client displays the shop itself, and the server is never involved in that, so you would still need to click the npc again afterwards anyway.

So all in all, yes in much later clients, no in anything pre 5200 probably.
Korvacs is offline  
Thanks
1 User
Old 03/30/2010, 01:09   #9
 
elite*gold: 0
Join Date: Feb 2010
Posts: 378
Received Thanks: 86
Quote:
Originally Posted by Korvacs View Post
That would require re-spawning the npc everytime someone interacts with it.

It seems more like its a newer addition to the latest clients, i experimented with this exact thing a while back around 5100 and found that the only npcs i could make it work with without sending respawn packets and what not, are npcs which make a an NPCinteraction request (like requesting a dialog), and then the server responds with a 1010 dialog display.

Prime example would be the warehouse men, you can easily have a massive conversation and then display the warehouse, because its the same NPC type, if you wanted to do it with shops you would require 2 NPC definitions, one a shop, the other a text dialog npc, then spawn the second one when you click the second dialog, however the client displays the shop itself, and the server is never involved in that, so you would still need to click the npc again afterwards anyway.

So all in all, yes in much later clients, no in anything pre 5200 probably.
What about this? What does this code do exactly?
Does it just buy an item... or could this possibly be used to make a shop appear?
Code:
public void BuyItem(uint NPCID, uint ItemID, byte Amount)
        {
            if (Game.World.H_NPCs.Contains(NPCID) || NPCID == 2888 && Database.Shops.Contains(NPCID))
            {
                Game.NPC N = (Game.NPC)Game.World.H_NPCs[NPCID];
                Shop S = (Shop)Database.Shops[NPCID];

                if ((N != null && N.Loc.Map == Loc.Map && MyMath.PointDistance(N.Loc.X, N.Loc.Y, Loc.X, Loc.Y) < 18 || NPCID == 2888) && S.Items.Contains(ItemID))
                {
                    DatabaseItem DBI = (DatabaseItem)Database.DatabaseItems[ItemID];
                    if (DBI.ID == 0)
                    {
                        Program.WriteLine("Error Database item = null, item id = " + ItemID);
                        return;
                    }
                    for (byte i = 0; i < Amount; i++)
                    {
                        if (Inventory.Count < 40)
                        {
                            if (S.MoneyType == 0 && Silvers >= DBI.Worth)
                            {
                                Game.Item I = new NewestCOServer.Game.Item();
                                I.ID = ItemID;
                                I.UID = (uint)Game.World.Rnd.Next(10000000);
                                try
                                {
                                    I.MaxDur = DBI.Durability;
                                    I.CurDur = I.MaxDur;
                                }
                                catch (Exception Exc) { Program.WriteLine(Exc); }
                                Game.ItemIDManipulation e = new NewestCOServer.Game.ItemIDManipulation(I.ID);
                                if (e.Part(0, 2) == 11 || e.Part(0, 2) == 13 || e.Part(0, 3) == 123 || e.Part(0, 3) == 141 || e.Part(0, 3) == 142)
                                    I.Color = NewestCOServer.Game.Item.ArmorColor.Orange;
                                AddItem(I);
                                Silvers -= DBI.Worth;
                            }
                            else if (S.MoneyType == 1 && CPs >= DBI.CPsWorth)
                            {
                                Game.Item I = new NewestCOServer.Game.Item();
                                I.ID = ItemID;
                                I.UID = (uint)Game.World.Rnd.Next(10000000);
                                try
                                {
                                    I.MaxDur = DBI.Durability;
                                    I.CurDur = I.MaxDur;
                                }
                                catch (Exception Exc) { Program.WriteLine(Exc); }

                                if (Game.ItemIDManipulation.Part(I.ID, 0, 2) == 73)
                                    I.Plus = Game.ItemIDManipulation.Digit(I.ID, 6);
                                AddItem(I);
                                CPs -= DBI.CPsWorth;
                            }
                        }
                    }
                }
            }
        }
-NewDawn- is offline  
Old 03/30/2010, 06:10   #10
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Quote:
Originally Posted by -NewDawn- View Post
What about this? What does this code do exactly?
Does it just buy an item... or could this possibly be used to make a shop appear?
Code:
public void BuyItem(uint NPCID, uint ItemID, byte Amount)
        {
            if (Game.World.H_NPCs.Contains(NPCID) || NPCID == 2888 && Database.Shops.Contains(NPCID))
            {
                Game.NPC N = (Game.NPC)Game.World.H_NPCs[NPCID];
                Shop S = (Shop)Database.Shops[NPCID];

                if ((N != null && N.Loc.Map == Loc.Map && MyMath.PointDistance(N.Loc.X, N.Loc.Y, Loc.X, Loc.Y) < 18 || NPCID == 2888) && S.Items.Contains(ItemID))
                {
                    DatabaseItem DBI = (DatabaseItem)Database.DatabaseItems[ItemID];
                    if (DBI.ID == 0)
                    {
                        Program.WriteLine("Error Database item = null, item id = " + ItemID);
                        return;
                    }
                    for (byte i = 0; i < Amount; i++)
                    {
                        if (Inventory.Count < 40)
                        {
                            if (S.MoneyType == 0 && Silvers >= DBI.Worth)
                            {
                                Game.Item I = new NewestCOServer.Game.Item();
                                I.ID = ItemID;
                                I.UID = (uint)Game.World.Rnd.Next(10000000);
                                try
                                {
                                    I.MaxDur = DBI.Durability;
                                    I.CurDur = I.MaxDur;
                                }
                                catch (Exception Exc) { Program.WriteLine(Exc); }
                                Game.ItemIDManipulation e = new NewestCOServer.Game.ItemIDManipulation(I.ID);
                                if (e.Part(0, 2) == 11 || e.Part(0, 2) == 13 || e.Part(0, 3) == 123 || e.Part(0, 3) == 141 || e.Part(0, 3) == 142)
                                    I.Color = NewestCOServer.Game.Item.ArmorColor.Orange;
                                AddItem(I);
                                Silvers -= DBI.Worth;
                            }
                            else if (S.MoneyType == 1 && CPs >= DBI.CPsWorth)
                            {
                                Game.Item I = new NewestCOServer.Game.Item();
                                I.ID = ItemID;
                                I.UID = (uint)Game.World.Rnd.Next(10000000);
                                try
                                {
                                    I.MaxDur = DBI.Durability;
                                    I.CurDur = I.MaxDur;
                                }
                                catch (Exception Exc) { Program.WriteLine(Exc); }

                                if (Game.ItemIDManipulation.Part(I.ID, 0, 2) == 73)
                                    I.Plus = Game.ItemIDManipulation.Digit(I.ID, 6);
                                AddItem(I);
                                CPs -= DBI.CPsWorth;
                            }
                        }
                    }
                }
            }
        }
That's removing currency, adding items, and so on and so forth, not opening an npc.
Arcо is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Request] Request all 5165 sources/npc dialog
02/28/2010 - CO2 Private Server - 0 Replies
so i want to do a good source like every1 right ? so i stay some time and i got a idea to take lot of 5165 and take what's not bugged and essentialy :mofo: i will release it :D
[REQUEST]5165 Client Request Help/ Question
12/18/2009 - CO2 Private Server - 5 Replies
hey yall its me TheLeGend Im Back in CO for a while but i gots a question ok so i have a 5165 Client im editing for a server but the only problem is that stupid-ass popup page that comes up the Conquer Online - Official Site - co.91.com one well i was just wondering how can i edit that site orrr how can i make it not popup anymore??? Thanks so Much, TheLeGend209
[No Request/Question section!]What should I talk about in this section?
04/14/2009 - CO2 Weapon, Armor, Effects & Interface edits - 0 Replies
Hello everyone! Welcome to the CO2 Weapon, Armor, Effects & Interface edits section. In this section it is okay to talk about: Any form of Client edit with/with out downloads(visual) Tools related to graphical modification



All times are GMT +1. The time now is 23:22.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.