Register for your free account! | Forgot your password?

You last visited: Today at 03:11

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

Advertisement



[Release]Coding NPC's (Very basic)

Discussion on [Release]Coding NPC's (Very basic) within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
[Release]Coding NPC's (Very basic)

This is for LOTF
---------------------------------------------------------------------
Here is a guide about how to code NPC's (Very basic)
There is 2parts, when creating NPC's.
The 2parts is NPCtalk and NPCdo

Both examples is build on same

NPCtalk = What the NPC says and wich choices you can choose.
ex.


Code:
if (CurrentNPC == 585858)
{
SendPacket(General.MyPackets.NPCSay("Make a choice"));
SendPacket(General.MyPackets.NPCLink("Yes", 1));
SendPacket(General.MyPackets.NPCLink("No", 2));
SendPacket(General.MyPackets.NPCLink("Just passing here", 255));
SendPacket(General.MyPackets.NPCSetFace(30));
SendPacket(General.MyPackets.NPCFinish());
}
When you make something to choose, then is called NPClink
, 1)); is for control 1
, 2)); is for control 2
, 255)); is for end conversation or control

NPCdo = What the NPC do, when choosing a choice or when click on them. This is called the control.
ex.


Code:
if (CurrentNPC == 585858)
{
if (Control == 1)
{
SendPacket(General.MyPackets.NPCSay("You have choosed yes"));
SendPacket(General.MyPackets.NPCLink("I see", 255));
SendPacket(General.MyPackets.NPCSetFace(30));
SendPacket(General.MyPackets.NPCFinish());
}
if (Control == 2)
{
SendPacket(General.MyPackets.NPCSay("You have choosed no"));
SendPacket(General.MyPackets.NPCLink("I see", 255));
SendPacket(General.MyPackets.NPCSetFace(30));
SendPacket(General.MyPackets.NPCFinish());
}
I know is not a big guide, but i hope some can learn how to code NPC's
is only for basic things
And for you that think this is not helping cause is easy, then there is some that just dont understand anything about coding and could use even the smallest help they can get.
And another thing im not a great coder, im trying to learn it

----------------------------------------------------------------------------------------
Here is some small codes you can add to conversation:(NPCdo)
For adding items to char:
Code:
                                        MyChar.AddItem("ID#-Bonus+-Bless-Enchant-Gem1-Gem2", Amount, (uint)General.Rand.Next(36457836));
}
For buying item for cps:
Code:
                                if (MyChar.ItemsInInventory < 40)
                                {
                                    if (MyChar.CPs >= Amount)
                                    {
                                        MyChar.CPs -= Amount;
                                        MyChar.AddItem("ID#-Bonus+-Bless-Enchant-Gem1-Gem2", Amount, (uint)General.Rand.Next(36457836));
                                        SendPacket(General.MyPackets.Vital(MyChar.UID, 30, MyChar.CPs));
}
For adding skill:
Code:
                                        MyChar.LearnSkill(Skill ID#, Skill level);
}
For teleporting player:
Code:
                                    MyChar.Teleport(Map ID#, XPosition, YPosition);
}
For Removing Silvers or Cps:
Silvers:
Code:
                                    if (MyChar.Silvers >= Amount)
                                    {
                                    MyChar.Silvers -= Amount;
                                    SendPacket(General.MyPackets.Vital(MyChar.UID, 4, MyChar.Silvers));
}
CPs:
Code:
                                    if (MyChar.CPs >= Amount)
                                    {
                                        MyChar.CPs -= Amount;
                                        SendPacket(General.MyPackets.Vital(MyChar.UID, 30, MyChar.CPs));
}
For remove item:
Code:
                                if (MyChar.InventoryContains(Item ID#, Amount))
                                {
                                    MyChar.RemoveItem(MyChar.ItemNext(Item ID#));
}
Fish* is offline  
Thanks
6 Users
Old 10/01/2009, 02:21   #2
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
Quote:
Originally Posted by |^ØnëwïngëÐ^| View Post
Nice guide :P
Thanks

Really i used it to learn my friend how to add NPC's, but then i thought
i could make a little guide and post it here ;D
Fish* is offline  
Old 10/01/2009, 02:23   #3
 
elite*gold: 0
Join Date: Sep 2009
Posts: 249
Received Thanks: 17
Good Job
Empty Project is offline  
Thanks
1 User
Old 10/01/2009, 02:31   #4
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
Quote:
Originally Posted by Empty Project View Post
Good Job
hehe thank you EP
I thought about, on your forum?
Whats on there?


But goodnight everyone
ill go bed
Fish* is offline  
Old 10/01/2009, 02:36   #5
 
elite*gold: 0
Join Date: Aug 2009
Posts: 418
Received Thanks: 37
great job dude!
this will help DDBills
i mean
all the noobs
Arco:) is offline  
Thanks
1 User
Old 10/01/2009, 02:38   #6
 
-Shunsui-'s Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
its a verry nice guide for learners , GOOD JOB!
-Shunsui- is offline  
Thanks
1 User
Old 10/01/2009, 19:43   #7
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
Thank you all.
I hope it helped
Fish* is offline  
Old 10/01/2009, 20:02   #8
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Awesome job guy!
Bet this will help alot of people learning to code!
Arcо is offline  
Thanks
1 User
Old 10/01/2009, 20:07   #9
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
Quote:
Originally Posted by Tiku View Post
Awesome job guy!
Bet this will help alot of people learning to code!
Thank you thank you

Edit:
Is just bad,when the thread ends long in section, so no one will find it XD
Fish* is offline  
Old 10/01/2009, 23:27   #10
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
By the way grillmad.
Instead of using [ Quote][ /Quote] use [ Code][ /Code]
Arcо is offline  
Thanks
1 User
Old 10/01/2009, 23:28   #11
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
kk ill edit now thanks
Fish* is offline  
Old 10/12/2009, 03:13   #12
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,765
Received Thanks: 382
#BUMPED
Fish* is offline  
Old 10/12/2009, 09:26   #13
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,338
Received Thanks: 490
thanks that will hopefully stop some noobthreads
~Yuki~ is offline  
Old 10/12/2009, 09:36   #14
 
elite*gold: 0
Join Date: Aug 2008
Posts: 889
Received Thanks: 199
Wow i like LOTF Coding .
I wanna learn,who want to teach me?
By the way grillmad at link 1/link2 i understand are the options when you click do action but can you tell me what are the numbers (30),(255) and so on...??
This numbers are making the action do when click the link?
zbest is offline  
Old 10/12/2009, 09:55   #15
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,338
Received Thanks: 490
if u dont bind the nubers to a control it will exit the dialoge

I wouldnt mind of helping u understanding the lotf code, u got my msn
~Yuki~ is offline  
Reply




All times are GMT +1. The time now is 03:12.


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.