Register for your free account! | Forgot your password?

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

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

Advertisement



[HELP] My attempt to make a rb npc

Discussion on [HELP] My attempt to make a rb npc within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Oct 2007
Posts: 116
Received Thanks: 16
[HELP] My attempt to make a rb npc

Here is my attempt to create an npc that reborns you

Code:
                case 211091:// Rb Adder
                    {
                        if (LinkBack == 0)
                        {
                            Text("Would you like to be reborn? You need to be level 120 or higher to reborn.", CSocket);
                            Link("1st rb", 1, CSocket);
                            Link("2nd rb", 2, CSocket);
                            Link("No thanks", 225, CSocket);
                            End(CSocket);

                        }
                        else if (LinkBack == 1)
                        {
                            if (CSocket.Client.Reborn == 0)
                            if (CSocket.Client.Level >= 120)
                            {
                                Reborn(+1, CSocket);
                                Level(15, CSocket);
                            }
                            else
                            {
                                Text("You are not high enough level", CSocket);
                                Link("****!", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        else if (LinkBack == 2)
                        {
                            if (CSocket.Client.Level >= 120)
                            if (CSocket.Client.Reborn == 1)
                        Reborn(+1, CSocket);
                        Level (15, CSocket);
                        }
                        else
                        {
                            Text("You are not high enough level", CSocket);
                            Link("****!", 255, CSocket);
                            End(CSocket);
                        }
                        break;
                    }
Apparently, when i click on the npc and choose the "1st rb" link, it does not make me 1st rb. anyone know what im doing wrong?
quadruple1 is offline  
Thanks
1 User
Old 06/11/2009, 20:31   #2

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 924
I don't know if this would work but instead of Reborn(+1, CSocket); use CSocket.Client.Reborn = 1; for 1st rb and CSocket.Client.Reborn = 2; for 2nd rb.
Kiyono is offline  
Old 06/11/2009, 20:41   #3
 
elite*gold: 0
Join Date: Oct 2008
Posts: 430
Received Thanks: 176
That's the general way I've seen it done in other sources, so I'm assuming that would work Kiyono.
Incariuz is offline  
Old 06/11/2009, 20:50   #4
 
elite*gold: 0
Join Date: May 2009
Posts: 27
Received Thanks: 3
case 211091:// Rb Adder
{
if (LinkBack == 0)
{
Text("Would you like to be reborn? You need to be level 120 or higher to reborn.", CSocket);
Link("1st rb", 1, CSocket);
Link("2nd rb", 2, CSocket);
Link("No thanks", 225, CSocket);
End(CSocket);

}
else if (LinkBack == 1)
{
if (CSocket.Client.Reborn == 0)
if (CSocket.Client.Level >= 120)

{

CSocket.Client.Reborn = 1;
CSocket.Client.Level = 15; ConquerPacket.ToServer(ConquerPacket.Chat(0, "SYSTEM", "ALLUSERS", "CONGRATULATIONS! " + CSocket.Client.Name + " has just been reborn! Good job!", Struct.ChatType.Center), 0);
}
else
{
Text("You are not high enough level", CSocket);
Link("Damn!", 255, CSocket);
End(CSocket);
}
}
else if (LinkBack == 2)
{
if (CSocket.Client.Level >= 120)
if (CSocket.Client.Reborn == 1)
Reborn(+1, CSocket);
Level (15, CSocket);
}
else
{
Text("You are not high enough level", CSocket);
Link("Damn!", 255, CSocket);
End(CSocket);
}
break;
}



i dunno how to make the items lower the level. Im still trying to understand the code. Any Idea would be appreciated
kiltz is offline  
Thanks
2 Users
Old 06/11/2009, 20:50   #5
 
elite*gold: 0
Join Date: Oct 2007
Posts: 116
Received Thanks: 16
Yeah it works now. Thanks
quadruple1 is offline  
Old 06/12/2009, 00:29   #6
 
elite*gold: 0
Join Date: Dec 2007
Posts: 14
Received Thanks: 10
Quote:
Originally Posted by kiltz View Post
i dunno how to make the items lower the level. Im still trying to understand the code. Any Idea would be appreciated
in the item number its laid out so that just change the hundreds and tens digit of the item number to 00 or 01 so as an example:

111009 IronHelmet (level 15)
111019 BronzeHelmet (level 22)
..
111109 ConquestHelmet (level 120)

the code i used was:
Code:
#region change gear lvl
                                    int i;
                                    for (i = 1; i < 9; i++)
                                    {
                                        if (i != 7)
                                        {
                                            CSocket.Client.Equipment[i].ItemID =
                                                Calculation.DownLevel(Convert.ToString(CSocket.Client.Equipment[i].ItemID));
                                            Database.Database.UpdateItem(CSocket.Client.Equipment[i]);
                                            CSocket.Send(ConquerPacket.ItemInfo(
                                                CSocket.Client.Equipment[i].UID,
                                                CSocket.Client.Equipment[i].ItemID,
                                                CSocket.Client.Equipment[i].Plus,
                                                CSocket.Client.Equipment[i].Progress,
                                                CSocket.Client.Equipment[i].Bless,
                                                CSocket.Client.Equipment[i].Enchant,
                                                CSocket.Client.Equipment[i].Soc1,
                                                CSocket.Client.Equipment[i].Soc2,
                                                CSocket.Client.Equipment[i].Dura,
                                                CSocket.Client.Equipment[i].MaxDura,
                                                i,
                                                CSocket.Client.Equipment[i].Color));
                                        }
                                    }
                                    Handler.ItemUnequip(5, CSocket.Client.Equipment[5].UID, CSocket);
                                    

                                    #endregion
in calculations add a new class
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using CoEmu_v2_GameServer.Connections;
using CoEmu_v2_GameServer.Entities;
using CoEmu_v2_GameServer.Structs;
using CoEmu_v2_GameServer.Packets;
using CoEmu_v2_GameServer.Calculations;
using CoEmu_v2_GameServer.Database;

namespace CoEmu_v2_GameServer.Calculations
{
    public partial class Calculation
    {
        public static int DownLevel(string ItemID)
        {
            string newID = ItemID;
            newID = newID.Remove(3, 2);
            newID = newID.Insert(3, getNum(Convert.ToInt32(ItemID)));
            return (Convert.ToInt32(newID));
        }
        private static string getNum(int ItemID)
        {
            string num;
            if (ItemID >= 150003 && ItemID <= 159999) //ring 1-126
            {
                if (ItemID == 150310) num = "31";
                else if (ItemID == 150320) num = "32";
                else num = "01";
            }
            else if (ItemID >= 160013 && ItemID <= 169999) //boot 10-126
            {
                num = "01";
            }
            else num = "00";

            return num;

        }
    }
}
iamanoob is offline  
Old 06/12/2009, 13:00   #7
 
elite*gold: 0
Join Date: Oct 2007
Posts: 116
Received Thanks: 16
Quote:
Originally Posted by iamanoob View Post
in the item number its laid out so that just change the hundreds and tens digit of the item number to 00 or 01 so as an example:

111009 IronHelmet (level 15)
111019 BronzeHelmet (level 22)
..
111109 ConquestHelmet (level 120)

the code i used was:
Code:
#region change gear lvl
                                    int i;
                                    for (i = 1; i < 9; i++)
                                    {
                                        if (i != 7)
                                        {
                                            CSocket.Client.Equipment[i].ItemID =
                                                Calculation.DownLevel(Convert.ToString(CSocket.Client.Equipment[i].ItemID));
                                            Database.Database.UpdateItem(CSocket.Client.Equipment[i]);
                                            CSocket.Send(ConquerPacket.ItemInfo(
                                                CSocket.Client.Equipment[i].UID,
                                                CSocket.Client.Equipment[i].ItemID,
                                                CSocket.Client.Equipment[i].Plus,
                                                CSocket.Client.Equipment[i].Progress,
                                                CSocket.Client.Equipment[i].Bless,
                                                CSocket.Client.Equipment[i].Enchant,
                                                CSocket.Client.Equipment[i].Soc1,
                                                CSocket.Client.Equipment[i].Soc2,
                                                CSocket.Client.Equipment[i].Dura,
                                                CSocket.Client.Equipment[i].MaxDura,
                                                i,
                                                CSocket.Client.Equipment[i].Color));
                                        }
                                    }
                                    Handler.ItemUnequip(5, CSocket.Client.Equipment[5].UID, CSocket);
                                    

                                    #endregion
in calculations add a new class
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using CoEmu_v2_GameServer.Connections;
using CoEmu_v2_GameServer.Entities;
using CoEmu_v2_GameServer.Structs;
using CoEmu_v2_GameServer.Packets;
using CoEmu_v2_GameServer.Calculations;
using CoEmu_v2_GameServer.Database;

namespace CoEmu_v2_GameServer.Calculations
{
    public partial class Calculation
    {
        public static int DownLevel(string ItemID)
        {
            string newID = ItemID;
            newID = newID.Remove(3, 2);
            newID = newID.Insert(3, getNum(Convert.ToInt32(ItemID)));
            return (Convert.ToInt32(newID));
        }
        private static string getNum(int ItemID)
        {
            string num;
            if (ItemID >= 150003 && ItemID <= 159999) //ring 1-126
            {
                if (ItemID == 150310) num = "31";
                else if (ItemID == 150320) num = "32";
                else num = "01";
            }
            else if (ItemID >= 160013 && ItemID <= 169999) //boot 10-126
            {
                num = "01";
            }
            else num = "00";

            return num;

        }
    }
}
when i add that it gives me this error:
Code:
Warning	1	Unreachable code detected	C:\Users\joe is king\Desktop\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs	5108	21	CoEmu v2 GameServer
quadruple1 is offline  
Old 06/12/2009, 13:18   #8
 
elite*gold: 0
Join Date: May 2009
Posts: 27
Received Thanks: 3
to iamanoob

on the calculation class, do i need to code all the items? in your example i only see ring and boots, so we need to code each items manually?
kiltz is offline  
Old 06/12/2009, 13:22   #9
 
elite*gold: 0
Join Date: May 2009
Posts: 27
Received Thanks: 3
HTML Code:
namespace CoEmu_v2_GameServer.Calculations
{
    public partial class Calculation
    {
        public static int DownLevel(string ItemID)
        {
            string newID = ItemID;
            newID = newID.Remove(3, 2);
            newID = newID.Insert(3, getNum(Convert.ToInt32(ItemID)));
            return (Convert.ToInt32(newID));
        }
        private static string getNum(int ItemID)
        {
            string num;
            if (ItemID >= 150003 && ItemID <= 159999) //ring 1-126
            {
                if (ItemID == 150310) num = "31";
                else if (ItemID == 150320) num = "32";
                else num = "01";
            }
            else if (ItemID >= 160013 && ItemID <= 169999) //boot 10-126
            {
                num = "01";
            }
            else num = "00";

            return num;

        }
    }
}

in your calculation folder.. replace all the code with the code above the calculation.cs
kiltz is offline  
Old 06/12/2009, 19:52   #10
 
elite*gold: 0
Join Date: Oct 2007
Posts: 116
Received Thanks: 16
When i do that i get an error saying

Error 1 The call is ambiguous between the following methods or properties: 'CoEmu_v2_GameServer.Calculations.Calculation.Down Level(string)' and 'CoEmu_v2_GameServer.Calculations.Calculation.Down Level(string)' C:\Users\joe is king\Desktop\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs 5114 97 CoEmu v2 GameServer
quadruple1 is offline  
Old 06/13/2009, 02:59   #11
 
elite*gold: 0
Join Date: Dec 2007
Posts: 14
Received Thanks: 10
@kllitz
no those are just because those items' lowest level item id starts with 01
31 and 32 i think are the loveforever rings thats why its there

@quadruple1
are you using it right? that code is placed in npctalk.cs in a linkback if statement so basically
Code:
 if (LinkBack == /*some number*/){
//insert the above code here
}
iamanoob is offline  
Old 06/13/2009, 15:20   #12
 
elite*gold: 0
Join Date: May 2009
Posts: 27
Received Thanks: 3
HTML Code:
[B]THIS IS JUST SAMPLE CODE AND STILL NEED A LOT OF WORK AND CODING TO BE DONE [/B]

HTML Code:
case 211091: /* Rb Adder  [B]Corrections would be appreciated since i am still learning how to code C Sharp  [/B] */
{
if (LinkBack == 0)
{
Text("Would you like to be reborn? You need to be level 120 or higher to reborn.", CSocket);
Link("1st rb", 1, CSocket);
Link("2nd rb", 2, CSocket);
Link("No thanks", 225, CSocket);
End(CSocket);

}
else if (LinkBack == 1)
{
if (CSocket.Client.Reborn == 0) &&  (CSocket.Client.Level >= 110)
 /*  if (CSocket.Client.Class =     )   dunno what to put here this is supposed to be for water taoist which can reborn at lvl 110 , any idea would be appreciated*/
   if (InventoryContains(721258, 1, CSocket))  // 721258 <---Cleanwater ID

{

CSocket.Client.Reborn = 1;
CSocket.Client.Level = 15; 
ConquerPacket.ToServer(ConquerPacket.Chat(0, "SYSTEM", "ALLUSERS", "CONGRATULATIONS! " + CSocket.Client.Name + " has just been reborn! Good job!", Struct.ChatType.Center), 0);
#region change gear lvl
                                    int i;
                                    for (i = 1; i < 9; i++)
                                    {
                                        if (i != 7)
                                        {
                                            CSocket.Client.Equipment[i].ItemID =
                                                Calculation.DownLevel(Convert.ToString(CSocket.Client.Equipment[i].ItemID));
                                            Database.Database.UpdateItem(CSocket.Client.Equipment[i]);
                                            CSocket.Send(ConquerPacket.ItemInfo(
                                                CSocket.Client.Equipment[i].UID,
                                                CSocket.Client.Equipment[i].ItemID,
                                                CSocket.Client.Equipment[i].Plus,
                                                CSocket.Client.Equipment[i].Progress,
                                                CSocket.Client.Equipment[i].Bless,
                                                CSocket.Client.Equipment[i].Enchant,
                                                CSocket.Client.Equipment[i].Soc1,
                                                CSocket.Client.Equipment[i].Soc2,
                                                CSocket.Client.Equipment[i].Dura,
                                                CSocket.Client.Equipment[i].MaxDura,
                                                i,
                                                CSocket.Client.Equipment[i].Color));
                                        }
                                    }
                                    Handler.ItemUnequip(5, CSocket.Client.Equipment[5].UID, CSocket);
                                    

                                    #endregion
}
else
{
Text("You are not high enough level", CSocket);
Link("Damn!", 255, CSocket);
End(CSocket);
}
}
else if (LinkBack == 2)
{
if (CSocket.Client.Level >= 120)
if (CSocket.Client.Reborn == 1)
Reborn(+1, CSocket);
Level (15, CSocket);
}
else
{
Text("You are not high enough level", CSocket);
Link("Damn!", 255, CSocket);
End(CSocket);
}
break;
}

In the Calculation/Calculation.cs
replace the code with this one.

Credit goes to iamanob


HTML Code:

using System;
using System.Collections;
using System.Collections.Generic;
using CoEmu_v2_GameServer.Connections;
using CoEmu_v2_GameServer.Entities;
using CoEmu_v2_GameServer.Structs;
using CoEmu_v2_GameServer.Packets;
using CoEmu_v2_GameServer.Calculations;
using CoEmu_v2_GameServer.Database;

namespace CoEmu_v2_GameServer.Calculations
{
    public partial class Calculation
    {
        public static int DownLevel(string ItemID)
        {
            string newID = ItemID;
            newID = newID.Remove(3, 2);
            newID = newID.Insert(3, getNum(Convert.ToInt32(ItemID)));
            return (Convert.ToInt32(newID));
        }
        private static string getNum(int ItemID)
        {
            string num;
            if (ItemID >= 150003 && ItemID <= 159999) //ring 1-126
            {
                if (ItemID == 150310) num = "31";
                else if (ItemID == 150320) num = "32";
                else num = "01";
            }
            else if (ItemID >= 160013 && ItemID <= 169999) //boot 10-126
            {
                num = "01";
            }
            else num = "00";

            return num;

        }
    }
}


I am willing to learn, so correct me if i am wrong.
kiltz is offline  
Old 06/17/2009, 18:38   #13
 
elite*gold: 0
Join Date: Oct 2007
Posts: 116
Received Thanks: 16
I put them in the correct places.

how do you get rid of this error?

Error 2 The call is ambiguous between the following methods or properties: 'CoEmu_v2_GameServer.Calculations.Calculation.Down Level(string)' and 'CoEmu_v2_GameServer.Calculations.Calculation.Down Level(string)' C:\Users\joe is king\Desktop\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs 5282 45 CoEmu v2 GameServer
quadruple1 is offline  
Old 06/19/2009, 04:45   #14
 
WHITELIONX's Avatar
 
elite*gold: 0
Join Date: Apr 2006
Posts: 532
Received Thanks: 66
I get 6 errors with npctalk >.<
Error 1 Only assignment, call, increment, decrement, and new object expressions can be used as a statement C:\Documents and Settings\alan\My Documents\CoEmu v2\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs 3145 37 CoEmu v2 GameServer
Error 2 Pointers and fixed size buffers may only be used in an unsafe context C:\Documents and Settings\alan\My Documents\CoEmu v2\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs 3145 37 CoEmu v2 GameServer
Error 3 Cannot take the address of the given expression C:\Documents and Settings\alan\My Documents\CoEmu v2\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs 3145 37 CoEmu v2 GameServer
Error 4 The name 'InventoryContains' does not exist in the current context C:\Documents and Settings\alan\My Documents\CoEmu v2\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs 3147 8 CoEmu v2 GameServer
Error 5 The name 'Reborn' does not exist in the current context C:\Documents and Settings\alan\My Documents\CoEmu v2\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs 3194 1 CoEmu v2 GameServer
Error 6 The name 'Level' does not exist in the current context C:\Documents and Settings\alan\My Documents\CoEmu v2\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs 3195 1 CoEmu v2 GameServer

Now just the one error >.<
Error 1 Invalid expression term '&&' C:\Documents and Settings\alan knight\My Documents\CoEmu v2\CoEmu v2\CoEmu v2 GameServer\Handlers\NpcTalk.cs 3145 37 CoEmu v2 GameServer
WHITELIONX is offline  
Old 06/19/2009, 07:24   #15
 
elite*gold: 0
Join Date: May 2009
Posts: 27
Received Thanks: 3
@WhiteLion

HTML Code:
if (CSocket.Client.Reborn == 0) &&  (CSocket.Client.Level >= 110)
 /*  if (CSocket.Client.Class =     )   dunno what to put here this is supposed to be for water taoist which can reborn at lvl 110 , any idea would be appreciated*/
   if (InventoryContains(721258, 1, CSocket))  // 721258 <---Cleanwater ID
replace with


HTML Code:
if (CSocket.Client.Reborn == 0) 
  if  (CSocket.Client.Level >= 110)
 /*  if (CSocket.Client.Class =     )   dunno what to put here this is supposed to be for water taoist which can reborn at lvl 110 , any idea would be appreciated*/
   if (InventoryContains(721258, 1, CSocket))  // 721258 <---Cleanwater ID

kiltz is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
my 1st attempt at a mod
07/03/2009 - CO2 Weapon, Armor, Effects & Interface edits - 5 Replies
http://img188.imageshack.us/img188/1749/curvebalde 125.th.jpg VERSION 2 http://img261.imageshack.us/img261/1749/curvebald e125.th.jpg VERSION 3 http://img191.imageshack.us/img191/1144/curvebald e125ver3.th.jpg FINAL VERSION http://img196.imageshack.us/img196/6381/curveblad e125final.th.jpg
attempt of scam?
10/05/2008 - Silkroad Online - 2 Replies
I was at town today when suddenly someone started talking to me... was this an attempt of scam? do people fall for that :confused: http://img222.imageshack.us/img222/4941/nanizm4.j pg I remember the same guy said the same thing to me not too long ago when I was on my other character... that time he logged out immediately before I had the chance to reply. I guess the next step would have been "duplicating" a common item and after gaining my trust, make me give him my sos glaive :p
my attempt to get SV
01/07/2007 - Conquer Online 2 - 13 Replies
my frist file edit, hope you like it. sorry if its in the wrong section
phishing attempt on e*pvp?
07/23/2006 - Technical Support - 5 Replies
hiho, ich bekomm seit heute andauernd eine nachricht von kaspersky internet security 6.0 (und immer mit diesem schrecklichen sound >.<)....immer wenn ich auf die startseite vom epvpforum zugreifen will. sprich... -> http://www.elitepvpers.com/forum/ hier mal ein pic. ansonsten ist alles recht normal aufn forum. http://free.pages.at/ussj/phishing.JPG spackt das teil jetzt einfach ab..bzw überempfindlich...oder sollte ich mir gedanken drum machen?



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


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.