Register for your free account! | Forgot your password?

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

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

Advertisement



[Tutorial][For who can't Code] Code Simple NPC (CoEmu)

Discussion on [Tutorial][For who can't Code] Code Simple NPC (CoEmu) within the CO2 Private Server forum part of the Conquer Online 2 category.

View Poll Results: Did i explain good ?
Yes 30 76.92%
No 9 23.08%
Voters: 39. You may not vote on this poll

Reply
 
Old   #1
 
danielachraf's Avatar
 
elite*gold: 20
Join Date: Mar 2008
Posts: 958
Received Thanks: 494
[Tutorial][For who can't Code] Code Simple NPC (CoEmu)

First i will release the npc and explain you alot of good things

The npc

Ok .. here is the npc jail in TwinCity (Enter the jail and go out the jail)

in Handlers / NpcTalk.cs Search for
Code:
default:
                    {
                        Text("NPC " + ID + "'s dialog is not coded.", CSocket);
and above it add :

Code:
                case 435://CPs/money Trader
                    {
                        if (LinkBack == 0)
                        {
                            Text("Would you like To trade 5,000,000 Money for 5,000 CPs ?", CSocket);
                            Link("Sure Why not ?", 1, CSocket);
                            Link("No Thanks!", 255, CSocket);
                            End(CSocket);
                        }
                        else if (LinkBack == 1)
                        {
                            if (CSocket.Client.Money >= 5000000)
                            {
                                Money(-5000000, CSocket);
                                CPs(+5000, CSocket);
                            }
                            else
                            {
                                Text("I'm sorry you do not have the required Money.", CSocket);
                                Link("Okay.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        break;
                    }
- the npc is in TwinCity called ArenaGuardTang


For who wants to learn

Code:
                        if (LinkBack == 0)
                        {
                            Text("Would you like To trade 5,000,000 Money for 5,000 CPs ?", CSocket);
                            Link("Sure Why not ?", 1, CSocket);
                            Link("No Thanks!", 255, CSocket);
                            End(CSocket);
                        }
This code you must write in each TalkNpc .. (The starter)
- case 435: is the npc ID


and after } we will add
Code:
else if (LinkBack == 1)
what does it mean ?
After Sure why not .. 1, CSocket);
That's mean when you click on sure whynot something will happen

- under else if (LinkBack == 1) you must write {
now let's see when i click sure why not .. What i wanted to do ? i wanted to trade 5mill money for 5k cps ..

- under if { add if (CSocket.Client.Money >= 5000000)
that means that the character has more than 5mill money and under it add {

- and under { we will ad two lines to remove 5mill from my bag and put 5k cps
Code:
Money(-5000000, CSocket);
CPs(+5000, CSocket);
- Money -5000000 means will take from you 5mil and +5000 means will give you 5k cps
- after that you will write }

Now we need to add some lines to finish the npc, under }
Code:
                            else
                            {
                                Text("I'm sorry you do not have the required Money.", CSocket);
                                Link("Okay.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        break;
                    }
- we use else to tell the char that he haven't money ...
and we will add a dialog again ...

Hmm ... if you want to make the char go to TC for example

After else if (LinkBack == 1) we will add the code to work the npc
under { add
Code:
Teleport([COLOR="Red"]1002[/COLOR], [COLOR="Magenta"]439[/COLOR], [COLOR="Pink"]390[/COLOR], 0, CSocket);
Map id , xCord , yCored

- don't forget after coding to debug the project

- i hope i explained good because i am not good explainer ..
- It is easier than LOTF
- All who know this before help other one if they ask questions because i will go now ..
- Press thanks if you like this guide ..
danielachraf is offline  
Thanks
20 Users
Old 05/30/2009, 04:12   #2
 
elite*gold: 0
Join Date: Mar 2009
Posts: 56
Received Thanks: 31
Good guide mate. very informative.
~*Dutchess*~ is offline  
Old 05/30/2009, 04:36   #3
 
araXis's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 418
Received Thanks: 49
Thanks daniel very very helpful guide
araXis is offline  
Old 05/30/2009, 05:14   #4
 
elite*gold: 0
Join Date: Aug 2008
Posts: 11
Received Thanks: 0
hey danielachraf thx for the tut now i some how no how to code >< sry newbies here :] just asking some question .. the npc id izzit found from the database?

and after i added the code but when i go in game the npc chat still say npc not coded.
areudie is offline  
Old 05/30/2009, 05:47   #5
 
elite*gold: 0
Join Date: Dec 2006
Posts: 64
Received Thanks: 7
Quote:
Originally Posted by danielachraf View Post
First i will release the npc and explain you alot of good things

The npc

Ok .. here is the npc jail in TwinCity (Enter the jail and go out the jail)

in Handlers / NpcTalk.cs Search for
Code:
default:
                    {
                        Text("NPC " + ID + "'s dialog is not coded.", CSocket);
and above it add :

Code:
                case 435://CPs/money Trader
                    {
                        if (LinkBack == 0)
                        {
                            Text("Would you like To trade 5,000,000 Money for 5,000 CPs ?", CSocket);
                            Link("Sure Why not ?", 1, CSocket);
                            Link("No Thanks!", 255, CSocket);
                            End(CSocket);
                        }
                        else if (LinkBack == 1)
                        {
                            if (CSocket.Client.Money >= 5000000)
                            {
                                Money(-5000000, CSocket);
                                CPs(+5000, CSocket);
                            }
                            else
                            {
                                Text("I'm sorry you do not have the required Money.", CSocket);
                                Link("Okay.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        break;
                    }
- the npc is in TwinCity called ArenaGuardTang


For who wants to learn

Code:
                        if (LinkBack == 0)
                        {
                            Text("Would you like To trade 5,000,000 Money for 5,000 CPs ?", CSocket);
                            Link("Sure Why not ?", 1, CSocket);
                            Link("No Thanks!", 255, CSocket);
                            End(CSocket);
                        }
This code you must write in each TalkNpc .. (The starter)
- case 435: is the npc ID


and after } we will add
Code:
else if (LinkBack == 1)
what does it mean ?
After Sure why not .. 1, CSocket);
That's mean when you click on sure whynot something will happen

- under else if (LinkBack == 1) you must write {
now let's see when i click sure why not .. What i wanted to do ? i wanted to trade 5mill money for 5k cps ..

- under if { add if (CSocket.Client.Money >= 5000000)
that means that the character has more than 5mill money and under it add {

- and under { we will ad two lines to remove 5mill from my bag and put 5k cps
Code:
Money(-5000000, CSocket);
CPs(+5000, CSocket);
- Money -5000000 means will take from you 5mil and +5000 means will give you 5k cps
- after that you will write }

Now we need to add some lines to finish the npc, under }
Code:
                            else
                            {
                                Text("I'm sorry you do not have the required Money.", CSocket);
                                Link("Okay.", 255, CSocket);
                                End(CSocket);
                            }
                        }
                        break;
                    }
- we use else to tell the char that he haven't money ...
and we will add a dialog again ...

Hmm ... if you want to make the char go to TC for example

After else if (LinkBack == 1) we will add the code to work the npc
under { add
Code:
Teleport([COLOR="Red"]1002[/COLOR], [COLOR="Magenta"]439[/COLOR], [COLOR="Pink"]390[/COLOR], 0, CSocket);
Map id , xCord , yCored

- don't forget after coding to debug the project

- i hope i explained good because i am not good explainer ..
- It is easier than LOTF
- All who know this before help other one if they ask questions because i will go now ..
- Press thanks if you like this guide ..

please make video for that
mohammed2007 is offline  
Old 05/30/2009, 05:49   #6
 
jvt619's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 579
Received Thanks: 70
wow nyc released man thanks!
jvt619 is offline  
Old 05/30/2009, 05:51   #7
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,142
Quote:
Originally Posted by mohammed2007 View Post
please make video for that
...why? It's simply put, just read it again. Also, please; PLEASE; don't quote entire friggin posts x.x
Zeroxelli is offline  
Old 06/19/2009, 20:09   #8
 
mihai90's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 29
Received Thanks: 3
man I want to code "Weapon Master"....can help me?
mihai90 is offline  
Old 06/19/2009, 20:24   #9
 
WHITELIONX's Avatar
 
elite*gold: 0
Join Date: Apr 2006
Posts: 532
Received Thanks: 66
Excellent guide even though there are several this is an easy explanation Next you need to explain how people use MySql to ADD new npcs which do not exist and then we can add extra things to the db.

I want to add a strength factor to items in db so I can adjust the actual attack of a weapon. I can do that client sided already have done but I don`t understand how to modify in MySql Nvm I figured it out and have added min and max attack to navicat
WHITELIONX is offline  
Old 06/23/2009, 23:24   #10
 
elite*gold: 0
Join Date: Mar 2008
Posts: 83
Received Thanks: 10
I need the maps id please...
dextercsar is offline  
Old 06/24/2009, 01:21   #11
 
danielachraf's Avatar
 
elite*gold: 20
Join Date: Mar 2008
Posts: 958
Received Thanks: 494
Mapids:
Code:
Desert = 1000,
MysticCastle = 1001, 
TwinCity = 1002,
Mine = 1003,
Promotion = 1004,
Arena = 1005,
Stables = 1006,
BirthVillage = 1010,
PhoenixCastle = 1011,
RebirthMap = 1012,
HawkCave = 1013,
BanditCave = 1014,
BatCave = 1016,
AdvanceZone = 1017,
ApeMoutain = 1020,
DesertCity = 1000,
BirdIsland = 1015, 
DreamLand = 1012,
KylinCave = 1016,
TrainingGround = 1039,
Market = 1036,
Lottery = 700,
Jail = 6000,
GuildArea = 1038
grocery2 = 1009,
mine01 = 1003,
forum = 1004,
horse = 1006,
star01 = 1100,
star02 = 1101,
star03 = 1102,
star04 = 1103,
star05 = 1104,
star10 = 1105,
star06 = 1106,
star07 = 1107,
star08 = 1108,
star09 = 1109,
smith = 1007,
ArmorColour = 1008,
sky = 1012,
warena = 1017,
parena = 1018,
larena = 1019,
mine = 1021,
brave = 1022,
mineone = 1025,
minetwo = 1026,
minethree = 1027,
minefour = 1028,
mineone2 = 1029,
minetwo2 = 1030,
minethree2 = 1031,
minefour2 = 1032,
newbie2 = 1035,
playground = 1039,
mineone3 = 5000,
factionblack = 1037,
skycut = 1040,
skymaze = 1041,
prison2 = 6001,
lineuppass = 1042,
lineup = 1043,
lineup2 = 1044,
lineup3 = 1045,
lineup4 = 1046,
lineup5 = 1047,
lineup6 = 1048,
lineup7 = 1049,
lineup8 = 1050,
riskisland = 1051,
skymaze1 = 1060,
skymaze2 = 1061,
skymaze3 = 1062,
star = 1064,
boa = 1070,
parena1 = 1080,
parena2 = 1081,
newcanyon = 1075,
MapleForest = 1076,
newdesert = 1077,
newisland = 1078,
mysisland = 1079,
riskisland1 = 1063,
idlandmap = 1082,
parenam = 1090,
parenas = 1091,
house01 = 1098,
house03 = 1099,
sanctuary = 1601,
task01 = 1201,
task02 = 1202,
task04 = 1204,
task05 = 1205,
task07 = 1207,
task08 = 1208,
task10 = 1210,
task11 = 1211,
islandsnail = 1212,
desertsnail = 1213,
canyonfairy = 1214,
woodsfairy = 1215,
newplainfairy = 1216,
minea = 1500,
mineb = 1501,
minec = 1502,
mined = 1503,
stask01 = 1351,
stask02 = 1352,
stask03 = 1353,
stask04 = 1354,
slpk = 1505,
hhpk = 1506,
blpk = 1507,
ympk = 1508,
mfpk = 1509,
faction01 = 1550,
faction012 = 1551,
grocery3 = 1510,
forum1 = 1511,
tiger1 = 1512,
jokul01 = 1615,
tiemfiles = 1616,
tiemfiles1 = 1617,
Dgate = 2021,
Dsquare = 2022,
Dcloister = 2023,
Dsigil = 2024,
cordiform = 1645,
faction2 = 1560,
faction3 = 1561,
forum2 = 1707,
Gulf = 1700,
BotJail = 6001,
Dis City = 2039,
danielachraf is offline  
Thanks
4 Users
Old 07/15/2009, 19:45   #12
 
elite*gold: 0
Join Date: Jun 2009
Posts: 361
Received Thanks: 98
Ok...now try making a guide on how to add an NPC that everyone doesn't already know how to add. I learned that the first day I got into this -.-
Make a guide on how to add the socket npc or something harder. Include detail like you did in this. It was very informative.
Jay1029 is offline  
Old 10/06/2009, 21:30   #13
 
elite*gold: 0
Join Date: Jul 2006
Posts: 52
Received Thanks: 10
Good Job. Lets keep the tutorials going.
ahnu is offline  
Old 10/15/2009, 20:43   #14
 
onlyme64's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 268
Received Thanks: 25
When im making my pk tourny..whats the code to make the system check who the last player standing in the current pk map is and announce them as the winner and maybe even award them an item for winning. Thanks.
Note
Im new to coding and ive started to learn C# from scratch, the best i can do is Console.WriteLine(""); atm =x
onlyme64 is offline  
Reply


Similar Threads Similar Threads
Simple d3d menu (code)
02/11/2011 - Soldier Front Hacks, Bots, Cheats & Exploits - 53 Replies
Hey i found this code in other website :D Im here to release and make your own hacks with this menu NOTE!!!!: someone's not listening Download first Visual C++ 2008 to compile this!! For Cmenu.H #pragma once #include "d3d9.h"
coemu unreachable code??
03/01/2010 - CO2 Private Server - 8 Replies
foreach (KeyValuePair<int, Struct.GuildInfo> Gui in Nano.Guilds) i checked this and it all seems good 0.0 Warning 1 Unreachable code detected C:...\PacketProcessor.cs 494 85 CoEmu v2 GameServer dame XD
[Help CoEmu V2] Lil help on a code
07/08/2009 - CO2 Private Server - 11 Replies
Im still new to this but im creating an npc and i want to learn how to let it show text based on your level like: Level 1 : Hello lvl 1 Level 2: Hello lvl 2 Level 3 : Hello lvl 3
Npc code help - CoEmu v2
06/14/2009 - CO2 Private Server - 6 Replies
This is just a nooby release for the Hairstyler npc and for hairdyes I just got working, I will add more on here as I finish them, be gentle this is my first release :). //Edit: Changed the title since I got it finished/fixed it myself Add in this block of code somewhere in NpcTalk.cs Now to add Hairdyes, go to UseItem.cs and add this block of code. That's all I have to offer at the moment sorry, I been kinda busy lately.
Need Help with simple code
07/19/2006 - General Coding - 1 Replies
Im having a litle problem with this line of code : Private Sub Command1_Click&#40;&#41; If Option1.GotFocus = Enabled Then &#60;--This line >.&#60; Timer1.Enabled = False Command1.Caption = &#34;Start&#34; Else Timer1.Enabled = True Command1.Caption = &#34;Stop&#34; End If End Sub



All times are GMT +2. The time now is 12:36.


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.