Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 04:35

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

Advertisement



[RELEASE]How to code an decent npc with NPCs.txt entry

Discussion on [RELEASE]How to code an decent npc with NPCs.txt entry within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
[RELEASE]How to code an decent npc with NPCs.txt entry

Ok well I though I would release the basic NPCDialog and how to make an npc with the entry in NPC.txt so here
we go

Ok so every npc will start of with a
Code:
#Region npcname
and were it says
Code:
npcname
you
can change to what ever you want it to be so, next you will have this
Code:
case 123456:
you can change
the
Code:
123456
with a random number 1-6 digits but we will come back to that so we have this
Code:
#Region npcname //The name of NPC
case  123456: // case number
{
if (Control == 0);
{
and next we add an
Code:
{
the { is opening the case so we have this
Code:
#Region npcname // The name of NPC
case  123456: // case number
{
if (Control == 0);
{ // Opening the case
Oh and I forgot at the begging of EVERY NPC it has
Code:
if (Control == 0);
ok so next we add the dialog witch looks like this
Code:
GC.MyChar.AddSend(Packets.NPCSay("Hello this is my first npc"));
ok so were is says
Code:
Hello this is my first npc
you can change that with whatever you want ok so now it looks like
this
Code:
#Region npcname // The name of NPC
case  123456: // case number
{
if (Control == 0);
{ // Opening the case
GC.MyChar.AddSend(Packets.NPCSay("Hello this is my first npc")); // What the NPC says
ok so now we want a link also known as when you can click Yes or No or whatever so this is how its done
Code:
GC.MyChar.AddSend(Packets.NPCLink("Yes", 2));
      GC.MyChar.AddSend(Packets.NPCLink("No", 255));
ok so just change the Yes and the No to whatever you want now your gonna want to know what the
Code:
", 2)); and the ", 255));
well the ", 255)); is on the No and 255 is to end the npc so
when you click the no it will end the npc ok so on to the
Code:
", 2));
well thats goes to the
second part of the npc so far we have this
Code:
#Region npcname // The name of NPC
case  123456: // case number
{
if (Control == 0);
{ // Opening the case
GC.MyChar.AddSend(Packets.NPCSay("Hello this is my first npc")); // What the NPC says
GC.MyChar.AddSend(Packets.NPCLink("Yes", 2)); // Second part of npc
GC.MyChar.AddSend(Packets.NPCLink("No", 255)); // To end the npc
Ok and to finish a peace of dialog we ALWAYS add this
Code:
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
ok so this is the npc so far
Code:
#region npcname
case 987787:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("This is my first npc"));
GC.AddSend(Packets.NPCLink("Yes.", 2));
GC.AddSend(Packets.NPCLink("No.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
right I want to hurry this up so... after that on the second part of the npc will look the same nearly
it will look like this, this will give the player 200CPs
Code:
if (Control == 2)
{
GC.MyChar.CPs += 200;
GC.MyChar.AddSend(Packets.NPCSay("This is my second-part npc"));
GC.AddSend(Packets.NPCLink("Thank you.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
and to end an npc after we done it all after the } we add this
Code:
break;
}
#endregion
so this is our finished npc
Code:
#region npcname
case 987787:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("This is my first npc"));
GC.AddSend(Packets.NPCLink("Yes.", 2));
GC.AddSend(Packets.NPCLink("No.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 2)
{
GC.MyChar.CPs += 200;
GC.MyChar.AddSend(Packets.NPCSay("This is my second-part npc"));
GC.AddSend(Packets.NPCLink("Thank you.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
break;
}
#endregion
and that an npc

Ok so next im going to teach you is how to make a comment on a line of code a comment looks like this
Code:
// This is a comment
so lets use our npc for an example
Code:
#region mynpc
if (Control == 0)
{
GC.MyChar.CPs += 200;
GC.MyChar.AddSend(Packets.NPCSay("This is my second-part npc")); //This is a comment and the program wont read this comment :)
GC.AddSend(Packets.NPCLink("Thank you.", 255)); //This is a comment to
GC.AddSend(Packets.NPCSetFace(N.Avatar)); //So is this a comment
GC.AddSend(Packets.NPCFinish()); // AND THIS IS ANOTHER COMMENY jeez lol
} // This is 1 more damn commend haha
and thats an comment
anyway for an npc after a
Code:
{
do give the character some cps you can do
Code:
GC.MyChar.CPs += 200;
and to take away cps do this
Code:
GC.MyChar.CPs -= 200;
and for silvers do this
Code:
GC.MyChar.Silvers += 200;
And to remove the silvers do this
Code:
GC.MyChar.Silvers -= 200;
and for both you can do something like this
Code:
GC.MyChar.CPs -= 200;
GC.MyChar.Silvers += 29929292;
that will remove 200 cps and add 29929292 Silvers ok,
so for the teleport a character again after the
Code:
{
you can do something like
Code:
GC.MyChar.Teleport(1004, 068, 123);
Ok so the (1004 is the map ID and the 068, is the X-cord and the 123 is the Y-Cord and that code will teleport you to
the promotion center and near a corner

ok the
[code]
case 123456:
[/CODE}
right you can change that to a UNIQUE number so first go into
Code:
OldCODB/ and open up NPC.txt
and do a CTRL + F and search a unique number and if it says
Code:
Cannot be find
you can use it so at the end of the file add this
[code]
123456 8099 2 28 1002 456 378
[CODE]
ok so change the 123456 to your number that you chose ok and the
Code:
1002 456 378
is the map id, X-Cord, Y-Cord so the mapid ycord xcord and thats all there is to it click File-Save and there you are
you have added an npc

this took me A LONG TIME to write out like 1 hour writing this out mainly because I wanted to test out my new
Notepad++ and it is very nice So far I have type 190 lines lol

Please hit +Thanks THIS IS ALL MY WORK NOT LEECHED ONE LITTLE BIT!
Paralyzer[GM] is offline  
Thanks
23 Users
Old 03/16/2010, 20:55   #2
 
elite*gold: 0
Join Date: Feb 2010
Posts: 378
Received Thanks: 86
Quote:
Originally Posted by Paralyzer[GM] View Post
Ok well I though I would release the basic NPCDialog and how to make an npc with the entry in NPC.txt so here
we go


Code:
GC.MyChar.CPs + 200;
and to take away cps do this
Code:
GC.MyChar.CPs - 200;
and for silvers do this
Code:
GC.MyChar.Silvers + 200;
And to remove the silvers do this
Code:
GC.MyChar.Silvers - 200;
and for both you can do something like this
Code:
GC.MyChar.CPs - 200;
GC.MyChar.Silvers + 29929292;
that will remove 200 cps and add 29929292 Silvers ok,
so for the teleport a character again after the
[CODE]

Please hit +Thanks THIS IS ALL MY WORK NOT LEECHED ONE LITTLE BIT!
You mean += and -=
-NewDawn- is offline  
Thanks
4 Users
Old 03/16/2010, 20:57   #3
 
dodolinobobo's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 162
Received Thanks: 26
it's a good guide,but not for an advanced npc,if you can make an advanced npc ,the guide will be aprecieated and you will have some +Thanks for sure
dodolinobobo is offline  
Old 03/16/2010, 21:15   #4
 
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
#UPDATED

#REPORTED requested name change
Paralyzer[GM] is offline  
Thanks
1 User
Old 03/16/2010, 22:31   #5
 
hunterman01's Avatar
 
elite*gold: 20
Join Date: Dec 2006
Posts: 945
Received Thanks: 175
Quote:
Originally Posted by -FREEZE- View Post
lol seriously?
You call this a "advanced" npc?
Well I don't know what world your from but this is definitely not a advanced npc.
Thx for that bit of info never knew.
hunterman01 is offline  
Old 03/16/2010, 22:38   #6
 
walmartboi's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
What do you mean by 'advanced'? Like.. advanced as is 'so easy even a cave man could do it'(obviously you).
walmartboi is offline  
Thanks
1 User
Old 03/17/2010, 02:38   #7
 
killersub's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
welll I see him contributing so I'll +k him since he's helping the community...I jus dont do "Flame/spamming" lol...anyways keep up da good work!
killersub is offline  
Old 03/17/2010, 03:36   #8
 
.Beatz's Avatar
 
elite*gold: 0
Join Date: May 2006
Posts: 1,190
Received Thanks: 516
Good work man keep it up
.Beatz is offline  
Old 03/17/2010, 17:34   #9
 
elite*gold: 0
Join Date: Feb 2010
Posts: 492
Received Thanks: 222
Well as you can see I thought of a gay name and as I said I #Reported it for a name change so shutup Freeze haha ur banned HAHA!
Paralyzer[GM] is offline  
Old 03/18/2010, 07:38   #10
 
elite*gold: 0
Join Date: Feb 2010
Posts: 6
Received Thanks: 0
One question about the npc were going to add
123456 8099 2 28 1002 456 378
what is the 8099 2 28?
you explained the 1002 456 378
but you did not explain the 8099 2 28
maximumbrutal is offline  
Old 04/13/2010, 06:11   #11
 
elite*gold: 0
Join Date: May 2008
Posts: 50
Received Thanks: 3
Quote:
Originally Posted by maximumbrutal View Post
One question about the npc were going to add
123456 8099 2 28 1002 456 378
what is the 8099 2 28?
you explained the 1002 456 378
but you did not explain the 8099 2 28
second number is mesh
third number is flag
fourth number is direction
gme4l1f3 is offline  
Old 05/12/2010, 21:33   #12
 
elite*gold: 0
Join Date: May 2010
Posts: 174
Received Thanks: 13
hmmm ive done everything u said and the npc comes up as a Carpenter saying Hi, i do not speak anything useful yet, my ID 987787
2010mrsurfer is offline  
Old 05/12/2010, 23:41   #13
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Have you compiled the source yet? (f5)
Arcо is offline  
Old 05/13/2010, 14:06   #14
 
elite*gold: 0
Join Date: May 2010
Posts: 174
Received Thanks: 13
Yes ive compiled it but i get 21 errors... and it still says the same
2010mrsurfer is offline  
Old 07/01/2010, 05:20   #15
 
▪◦כֿסּףּצּגּפֿђ◦▪'s Avatar
 
elite*gold: 0
Join Date: Jun 2010
Posts: 6
Received Thanks: 0
Nice Guide + Thanks To YOu
▪◦כֿסּףּצּגּפֿђ◦▪ is offline  
Reply


Similar Threads Similar Threads
[Help] Explaining npc code in oldcodb (npc.txt) + how to delete npcs
02/05/2012 - CO2 Private Server - 5 Replies
Can anyone help explain to me the code in npc.txt in OLDCODB These are how some of the codes appear: 4 40 1 0 1002 412 366 423 2706 1 0 1002 412 361 44 87 3 0 1036 182 180 185 1086 16 0 1036 230 173 184 1086 16 0 1036 230 177
Decent binary sql release from Zimbolt.
07/21/2010 - CO2 PServer Guides & Releases - 6 Replies
1. Do not ask me how to get this to work. 2. Do not run a fucking binary please. 3. I will not link you to any binary executable. With that all said this is a half decent (for a binary) release. I got this ages ago (a year or so, not even sure if it is released already if so. Sorry lol.) so I can't really remember what it has in it besides hourly tournies. You will have to find the compatible client to run this on. I hope this makes a whole bunch of half-assed private servers. With...
[Release]2 Npcs
07/08/2009 - CO2 PServer Guides & Releases - 9 Replies
These are my first 2 ever npcs. I coded them with the help of several other codes. This code will Trade in the amulet for the gear. case 10062: //Magic Artisan { if (LinkBack == 0) { Text("Hi. Gear here.", CSocket); Link("Trojan", 1, CSocket); Link("Warrior", 2, CSocket);
[Release]2 NPCS
05/26/2009 - CO2 PServer Guides & Releases - 18 Replies
Hi its me again Flame will be Reported I Coded these 100% Myself The NPCS are, CP admin and A Npc that trades gold for cps and cps for gold. Both tested on a LOTF source 100% work First CP Admin



All times are GMT +1. The time now is 04:35.


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.