[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
- 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 ..
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.
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
- 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 ..
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
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.
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
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()
If Option1.GotFocus = Enabled Then <--This line >.<
Timer1.Enabled = False
Command1.Caption = "Start"
Else
Timer1.Enabled = True
Command1.Caption = "Stop"
End If
End Sub