Register for your free account! | Forgot your password?

You last visited: Today at 00:48

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

Advertisement



[Help] NPCs

Discussion on [Help] NPCs within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2009
Posts: 361
Received Thanks: 98
[Help] NPCs

My problem is that the NPC is not doing what I want it to do. I don't notice any errors in the code. Control 6 is supposed to give me 3 "Points" for 10 Meteors. But instead it gives me 3 points but does not take away my Meteors. This is the case for most of the Controls. Can someone please look over this whole code and tell me if anything is wrong. I'm sure you can understand what the code is supposed to do just by reading it. But I've got something very wrong somewhere I just don't know what.
Code:
if (CurrentNPC == 4200)
                            {
                                if (Control == 1)
                                {
                                    SendPacket(General.MyPackets.NPCSay("You wish to buy points? This is what I can give for your items."));
                                    SendPacket(General.MyPackets.NPCLink("1 Point for 1,000,000 silvers.", 3));
                                    SendPacket(General.MyPackets.NPCLink("14 Points for 140 CPs.", 4));
                                    SendPacket(General.MyPackets.NPCLink("20 Points for 5000 VPs", 5));
                                    SendPacket(General.MyPackets.NPCLink("3 Points for 10 Meteors", 6));
                                    SendPacket(General.MyPackets.NPCLink("26 Points for a DragonBall", 7));
                                    SendPacket(General.MyPackets.NPCLink("4 Points for 5 ExpBalls", 13));
                                    SendPacket(General.MyPackets.NPCLink("100 Points for 1000 CPs", 14));
                                    SendPacket(General.MyPackets.NPCLink("Nothing,thanks.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                if (Control == 2)
                                {
                                    SendPacket(General.MyPackets.NPCSay("You wish to sell points? This is what I can give for your points."));
                                    SendPacket(General.MyPackets.NPCLink("10000 VPs for 40 points", 8));
                                    SendPacket(General.MyPackets.NPCLink("10 ExpBalls for 8 points.", 9));
                                    SendPacket(General.MyPackets.NPCLink("DragonBall for 26 points", 10));
                                    SendPacket(General.MyPackets.NPCLink("PrayingStone(M) for 28 Points", 11));
                                    SendPacket(General.MyPackets.NPCLink("10,000,000 silvers for 10 Points", 12));
                                    SendPacket(General.MyPackets.NPCLink("Nothing,thanks.", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());

                                }
                                if (Control == 3)
                                {
                                    if (MyChar.Silvers >= 1000000)
                                    {
                                        MyChar.Points += 1;
                                        MyChar.Silvers -= 1000000;
                                        SendPacket(General.MyPackets.Vital(MyChar.UID, 4, MyChar.Silvers));
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
                                if (Control == 4)
                                {
                                    if (MyChar.CPs >= 140)
                                    {
                                        MyChar.Points += 14;
                                        MyChar.CPs -= 140;
                                        SendPacket(General.MyPackets.Vital(MyChar.UID, 30, MyChar.CPs));
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
                                if (Control == 5)
                                {
                                    if (MyChar.VP >= 5000)
                                    {
                                        MyChar.Points += 20;
                                        MyChar.VP -= 5000;
                                        MyChar.MyClient.SendPacket(General.MyPackets.Vital(MyChar.UID, 26, MyChar.GetStat()));
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
                                if (Control == 6)
                                {
                                    if (MyChar.InventoryContains(1088001, 10))
                                    {
                                        MyChar.Points += 3;
                                        MyChar.RemoveItem(1088001);
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
                                if (Control == 7)
                                {
                                    if (MyChar.InventoryContains(1088000, 1))
                                    {
                                        MyChar.Points += 26;
                                        MyChar.RemoveItem(1088000);
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
                                if (Control == 8)
                                {
                                    if (MyChar.Points >= 140)
                                    {
                                        MyChar.VP += 10000;
                                        MyChar.Points -= 40;
                                        MyChar.MyClient.SendPacket(General.MyPackets.Vital(MyChar.UID, 26, MyChar.GetStat()));
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
                                if (Control == 9)
                                {
                                    if (MyChar.Points >= 8)
                                    {
                                        MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.Points -= 8;
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
                                if (Control == 10)
                                {
                                    if (MyChar.Points >= 26)
                                    {
                                        MyChar.AddItem("1088000-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.Points -= 26;
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
                                if (Control == 11)
                                {
                                    if (MyChar.Points >= 28)
                                    {
                                        MyChar.AddItem("1200001-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
                                        MyChar.Points -= 28;
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
                                if (Control == 12)
                                {
                                    if (MyChar.Points >= 10)
                                    {
                                        MyChar.Silvers += 10000000;
                                        MyChar.Points -= 500;
                                        SendPacket(General.MyPackets.Vital(MyChar.UID, 4, MyChar.Silvers));
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
                                if (Control == 13)
                                {
                                    if (MyChar.InventoryContains(723700, 5))
                                        MyChar.Points += 4;
                                    MyChar.RemoveItem(723700);
                                    SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                }
                                if (Control == 14)
                                {
                                    if (MyChar.CPs >= 1000)
                                        MyChar.Points += 100;
                                    MyChar.CPs -= 1000;
                                    SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                }
                                MyChar.SavePoints();
                            }
Jay1029 is offline  
Old 08/29/2009, 05:22   #2
 
elite*gold: 0
Join Date: Aug 2009
Posts: 418
Received Thanks: 37
Code:
                                if (Control == 6)
                                {
                                    if (MyChar.InventoryContains(1088001, 10))
                                     Remove **** right here, not gonna give you the full code, this hint should be enough
                                    {
                                        MyChar.Points += 3;
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
and for some of your other ****
you need to put the save cps packet at the bottom
i see you forgot them
Arco:) is offline  
Old 08/29/2009, 05:55   #3
 
elite*gold: 0
Join Date: Jun 2009
Posts: 361
Received Thanks: 98
True, I noticed I forgot the packets as well. But I used reference from other codes so I don't understand why it's not working. For control 3 it's the same method and it works. I'm confuzzled lol I needz more help =x

//edit: This is the ORIGINAL code for it made by Emil (EmmeTheCoder) I'm assuming it works because Emme made it and I'm quite certain it worked when I had it in my old sh*tteh server. It's exactly the same to what teh *** mannn?
///edit: Newsflash, Emil's doesn't work either.

Code:
                                if (Control == 6)
                                {
                                    if (MyChar.InventoryContains(1088001, 1))
                                    {
                                        MyChar.Points += 15;
                                        MyChar.RemoveItem(1088001);

                                    }
                                }
Jay1029 is offline  
Old 08/29/2009, 07:20   #4
 
elite*gold: 0
Join Date: Aug 2009
Posts: 418
Received Thanks: 37
Quote:
Originally Posted by Jay1029 View Post
True, I noticed I forgot the packets as well. But I used reference from other codes so I don't understand why it's not working. For control 3 it's the same method and it works. I'm confuzzled lol I needz more help =x

//edit: This is the ORIGINAL code for it made by Emil (EmmeTheCoder) I'm assuming it works because Emme made it and I'm quite certain it worked when I had it in my old sh*tteh server. It's exactly the same to what teh fux mannn?
///edit: Newsflash, Emil's doesn't work either.

Code:
                                if (Control == 6)
                                {
                                    if (MyChar.InventoryContains(1088001, 1))
                                    {
                                        MyChar.Points += 15;
                                        MyChar.RemoveItem(1088001);

                                    }
                                }
lol thats for it if it only contains one heres lemme fix your code

Code:
                                if (Control == 6)
                                {
                                    if (MyChar.InventoryContains(1088001, 10))
                                    {

                                    MyChar.RemoveItem(MyChar.ItemNext(1088001));
                                    MyChar.RemoveItem(MyChar.ItemNext(1088001));
                                    MyChar.RemoveItem(MyChar.ItemNext(1088001));
                                    MyChar.RemoveItem(MyChar.ItemNext(1088001));
                                    MyChar.RemoveItem(MyChar.ItemNext(1088001));
                                    MyChar.RemoveItem(MyChar.ItemNext(1088001));
                                    MyChar.RemoveItem(MyChar.ItemNext(1088001));
                                    MyChar.RemoveItem(MyChar.ItemNext(1088001));
                                    MyChar.RemoveItem(MyChar.ItemNext(1088001));
                                    MyChar.RemoveItem(MyChar.ItemNext(1088001));
                                    
                                    MyChar.Points += 15;

                                    }
                                }
that should work
Arco:) is offline  
Thanks
2 Users
Old 08/29/2009, 08:32   #5
 
hunterman01's Avatar
 
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
Quote:
Originally Posted by Acro:) View Post
MyChar.Points += 15;
Umm by looking at the code he wants 3 points :P
hunterman01 is offline  
Old 08/29/2009, 08:52   #6
 
elite*gold: 0
Join Date: Aug 2009
Posts: 418
Received Thanks: 37
Quote:
Originally Posted by hunterman01 View Post
Umm by looking at the code he wants 3 points :P
i looked at his most recent post and it said 15
Arco:) is offline  
Old 08/30/2009, 04:22   #7
 
elite*gold: 0
Join Date: Jun 2009
Posts: 361
Received Thanks: 98
O shnap it does work, thanks bro! One more thing, was my code just in the wrong order or does there need to be a space after if (MyChar.InventoryContains(1088001, 10))
and MyChar.RemoveItem(MyChar.ItemNext(1088001));?

//edit: I'm getting the same problem with the 7th control roflll. It's done exactly the same way too. I ever trued without the spaces. Here's the code..

Code:
                                if (Control == 7)
                                {
                                    if (MyChar.InventoryContains(1088000, 1))
                                    {

                                        MyChar.RemoveItem(1088000);

                                        MyChar.Points += 26;
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
There's nothin' wrong O.o
Jay1029 is offline  
Old 08/30/2009, 06:21   #8
 
_xTreme_'s Avatar
 
elite*gold: 0
Join Date: Aug 2009
Posts: 47
Received Thanks: 3
Code:
                                if (Control == 7)
                                {
                                    if (MyChar.InventoryContains(1088000, 1))
                                    {

                                        MyChar.RemoveItem(MyChar.ItemNext(1088000));

                                        MyChar.Points += 26;
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
Try this
_xTreme_ is offline  
Old 08/30/2009, 07:19   #9
 
elite*gold: 0
Join Date: Aug 2009
Posts: 418
Received Thanks: 37
Quote:
Originally Posted by Jay1029 View Post
O shnap it does work, thanks bro! One more thing, was my code just in the wrong order or does there need to be a space after if (MyChar.InventoryContains(1088001, 10))
and MyChar.RemoveItem(MyChar.ItemNext(1088001));?

//edit: I'm getting the same problem with the 7th control roflll. It's done exactly the same way too. I ever trued without the spaces. Here's the code..

Code:
                                if (Control == 7)
                                {
                                    if (MyChar.InventoryContains(1088000, 1))
                                    {

                                        MyChar.RemoveItem(1088000);

                                        MyChar.Points += 26;
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
                                    }
                                }
There's nothin' wrong O.o
+k if mine helped
Arco:) is offline  
Reply


Similar Threads Similar Threads
Npcs
08/03/2010 - Metin2 Private Server - 0 Replies
kann mir jemand einen link schicken oder erklären wie man npcs erstellt und auf den marktplatz stellt?ich hab die sufu benutzt da hab ich aber nichts gefunden . mfg kingspeedy
NPCS
06/23/2010 - CO2 Private Server - 2 Replies
can some one tell me the codes for the NPC that reallot your stats
Npcs
01/01/2010 - Metin2 Private Server - 5 Replies
Hi Ich suche einen , der auf meinem Server die npcs einstellen kann. Der jenige bekommt auch einen GM account und ein thx
add new NPCs
08/06/2009 - CO2 Private Server - 0 Replies
could any1 tell me how i can add new npcs into the npc table in mysql?
NPCs Help
01/21/2009 - CO2 Private Server - 0 Replies
I need some good codes of npcs and help me ..... when i try to click on the npc in conquer it don't say anything :D thanks



All times are GMT +2. The time now is 00:48.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.