|
You last visited: Today at 22:24
Advertisement
adding npcs
Discussion on adding npcs within the CO2 Private Server forum part of the Conquer Online 2 category.
07/23/2014, 03:25
|
#1
|
elite*gold: 0
Join Date: Jul 2014
Posts: 67
Received Thanks: 3
|
adding npcs
Hello all sorry for the post but i have been reading through the comments on redux and i found code for cp admin but i cant get him to load for some reason
i went into Redux -> npcs -> created a new file [2071]CPAdmin.cs
copied the code
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Redux.Packets.Game;
namespace Redux.Npcs
{
/// <summary>
/// Handles NPC usage for [4450] Market Controller
/// </summary>
public class NPC_2071 : INpc
{
public NPC_2071(Game_Server.Player _client)
: base(_client)
{
ID = 2071;
Face = 54;
}
public override void Run(Game_Server.Player _client, ushort _linkback)
{
Responses = new List<NpcDialogPacket>();
AddAvatar();
switch (_linkback)
{
case 0:
AddText("Hello, need to exchange those DragonBalls(220 CPs) or DBScrolls(2200) to CPs to save some space?");
AddText("Witch would you like to exchange?");
AddOption("An DragonBall only .", 1);
AddOption("An DBScroll.", 2);
AddOption("No. I shall stay here.", 255);
break;
case 1:
if (_client.HasItem(1088000))
{
_client.DeleteItem(1088000);
_client.CP += 220;
AddText("There you go.Check out in your inventory!");
AddOption("Thanks!", 255);
}
else
{
AddText("You don't have any DragonBalls.");
AddOption("Ok! .", 255);
}
break;
case 2:
if (_client.HasItem(720028))
{
_client.DeleteItem(720028);
_client.CP += 2200;
AddText("There you go.Check out in your inventory!");
AddOption("Thanks!", 255);
}
else
{
AddText("You don't have any DBScrolls.");
AddOption("Ok! .", 255);
}
break;
}
AddFinish();
Send();
}
}
}
but it comes up could not load npc script for npc ID: 2071
is there something i am missing?
|
|
|
07/23/2014, 09:55
|
#2
|
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
|
Code:
/// <summary>
/// Handles NPC usage for [4450] Market Controller
/// </summary>
Gotta change the name and the ID there.
|
|
|
07/23/2014, 12:29
|
#3
|
elite*gold: 0
Join Date: Feb 2006
Posts: 726
Received Thanks: 271
|
Quote:
Originally Posted by InsomniacPro
Code:
/// <summary>
/// Handles NPC usage for [4450] Market Controller
/// </summary>
Gotta change the name and the ID there.
|
Yeah but that won't make the NPC work any differently.
Honestly you need to breakpoint gameserver.cs where it handles the NpcInitial packet and follow that through.
The code itself looks ok, have you re-compiled with the new npc added?
|
|
|
07/23/2014, 12:32
|
#4
|
elite*gold: 0
Join Date: Jul 2014
Posts: 67
Received Thanks: 3
|
Quote:
Originally Posted by InsomniacPro
Code:
/// <summary>
/// Handles NPC usage for [4450] Market Controller
/// </summary>
Gotta change the name and the ID there.
|
thanks for the reply i went ahead and changed it still nothing there must be something else i have missed
Quote:
Originally Posted by Aceking
Yeah but that won't make the NPC work any differently.
Honestly you need to breakpoint gameserver.cs where it handles the NpcInitial packet and follow that through.
The code itself looks ok, have you re-compiled with the new npc added?
|
The only thing its letting me do is debug it via f5 wont let me release it comes up with 52 errors for some reason
also tried build -> build solution
|
|
|
07/23/2014, 15:55
|
#5
|
elite*gold: 0
Join Date: Feb 2006
Posts: 726
Received Thanks: 271
|
Quote:
Originally Posted by NonStopCoding
thanks for the reply i went ahead and changed it still nothing there must be something else i have missed
The only thing its letting me do is debug it via f5 wont let me release it comes up with 52 errors for some reason
also tried build -> build solution
|
you dont need to release it, building it with f5 will work just fine.
As I said, you need to learn how to breakpoint.
|
|
|
07/23/2014, 17:33
|
#6
|
elite*gold: 0
Join Date: Jul 2014
Posts: 67
Received Thanks: 3
|
doing some research on breakpoints for c#
|
|
|
07/23/2014, 17:43
|
#7
|
elite*gold: 0
Join Date: Feb 2006
Posts: 726
Received Thanks: 271
|
Out of curiosity, did you just create the file inside the Redux->Npcs folder?
Or did you create the file in Visual Studio?
Just putting the file into the folder will not add it to your project.
To do that, you need to go into VS. Find the NPCs folder in the Solution Explorer on the right. Right click on the NPCs fold and then go to Add Existing Item. Then find your NPC and add it.
If you can't see it in VS, then that is what you are doing wrong.
This is using Visual Studio Professional 2012. If you use something different than it might be slightly different but those instructions should get you there.
|
|
|
07/23/2014, 17:59
|
#8
|
elite*gold: 0
Join Date: Jul 2014
Posts: 67
Received Thanks: 3
|
Quote:
Originally Posted by Aceking
Out of curiosity, did you just create the file inside the Redux->Npcs folder?
Or did you create the file in Visual Studio?
Just putting the file into the folder will not add it to your project.
To do that, you need to go into VS. Find the NPCs folder in the Solution Explorer on the right. Right click on the NPCs fold and then go to Add Existing Item. Then find your NPC and add it.
If you can't see it in VS, then that is what you are doing wrong.
This is using Visual Studio Professional 2012. If you use something different than it might be slightly different but those instructions should get you there.
|
yes i just did add the file into the npcs folder in the market folder i will try what you stated above and see if it helps i tried the code in the tokenawarder in tc and its working fine so yea i think its what you said also i am using visual studio 2013
Ok your way worked took me a while to work it out but eventually got there haha cp admin is working in market now  Thanks alot
|
|
|
07/23/2014, 20:41
|
#9
|
elite*gold: 0
Join Date: Jun 2007
Posts: 96
Received Thanks: 12
|
Quote:
Originally Posted by NonStopCoding
thanks for the reply i went ahead and changed it still nothing there must be something else i have missed
The only thing its letting me do is debug it via f5 wont let me release it comes up with 52 errors for some reason
also tried build -> build solution
|
you need to allow unsafe codes in project settings
|
|
|
07/23/2014, 21:08
|
#10
|
elite*gold: 0
Join Date: Jul 2014
Posts: 67
Received Thanks: 3
|
Quote:
Originally Posted by atef201080
you need to allow unsafe codes in project settings
|
noted thanks i did not need to release it anyways was doing it wrong
|
|
|
07/23/2014, 22:29
|
#11
|
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
|
Quote:
Originally Posted by Aceking
Yeah but that won't make the NPC work any differently.
Honestly you need to breakpoint gameserver.cs where it handles the NpcInitial packet and follow that through.
The code itself looks ok, have you re-compiled with the new npc added?
|
/sarcasm
|
|
|
07/23/2014, 23:13
|
#12
|
elite*gold: 0
Join Date: Jul 2014
Posts: 67
Received Thanks: 3
|
So i created a quest to play around with the npcs a little nothing fancy but when you complete the quest and hand over the item it rewards you 2500 silvers and some experience . I have noticed that the experience does not seem to add to your account until you have re logged is this there a way to do it there and then?
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Redux.Packets.Game;
namespace Redux.Npcs
{
/// <summary>
/// Handles NPC usage for [1989] Princess
/// </summary>
public class NPC_1989 : INpc
{
public NPC_1989(Game_Server.Player _client)
:base (_client)
{
ID = 1989;
Face = 20;
}
public override void Run(Game_Server.Player _client, ushort _linkback)
{
Responses = new List<NpcDialogPacket>();
AddAvatar();
switch (_linkback)
{
case 0:
AddText("Hello there i am in need of some help?");
AddText(" Kill the DarkSpirit's and retrive my RoyalSword The monster who");
AddText(" Stole it has a chance of dropping some pretty good items which can be usefull");
AddText(" There will also be a cash reward in it from me for doing this task.");
AddOption("hmm, i need more info.", 1);
AddOption("No, thanks.", 255);
AddOption("I have the item.", 3);
break;
case 1:
AddText("Ok well my solider that i sent out on a special errand");
AddText(" and has not returned so i sent out a scout ");
AddText("the scout located a bunch of monsters called DarkSpirt");
AddOption("ok, i am interested where can i find these monsters.", 2);
AddOption("No, Thanks Fuck that.", 255);
break;
case 2:
AddText("The Monster can be located at the Twin City");
AddText(", Around 430 097");
AddText(" becarefull the monster is not a push over.");
AddText(" Kill it and bring me my Heaven Sword");
AddText(" The monster has a chance of dropping good rewards.");
AddOption("ok, I am going to slay this monster now", 255);
break;
case 3:
if (_client.HasItem(722514))
{
_client.DeleteItem(722514);
_client.Money += 2500;
_client.Experience += 20;
AddText("Thank you so much for my Royal Sword Back");
AddText(" Here is your reward of 2500 silvers and some experience.");
AddOption("Thanks", 255);
}
else
{
AddText("You don't have a RoyalSword.");
AddOption("Ok! ill go get one.", 255);
}
break;
}
AddFinish();
Send();
}
}
}
|
|
|
07/23/2014, 23:51
|
#13
|
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
|
Quote:
Originally Posted by NonStopCoding
So i created a quest to play around with the npcs a little nothing fancy but when you complete the quest and hand over the item it rewards you 2500 silvers and some experience . I have noticed that the experience does not seem to add to your account until you have re logged is this there a way to do it there and then?
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Redux.Packets.Game;
namespace Redux.Npcs
{
/// <summary>
/// Handles NPC usage for [1989] Princess
/// </summary>
public class NPC_1989 : INpc
{
public NPC_1989(Game_Server.Player _client)
:base (_client)
{
ID = 1989;
Face = 20;
}
public override void Run(Game_Server.Player _client, ushort _linkback)
{
Responses = new List<NpcDialogPacket>();
AddAvatar();
switch (_linkback)
{
case 0:
AddText("Hello there i am in need of some help?");
AddText(" Kill the DarkSpirit's and retrive my RoyalSword The monster who");
AddText(" Stole it has a chance of dropping some pretty good items which can be usefull");
AddText(" There will also be a cash reward in it from me for doing this task.");
AddOption("hmm, i need more info.", 1);
AddOption("No, thanks.", 255);
AddOption("I have the item.", 3);
break;
case 1:
AddText("Ok well my solider that i sent out on a special errand");
AddText(" and has not returned so i sent out a scout ");
AddText("the scout located a bunch of monsters called DarkSpirt");
AddOption("ok, i am interested where can i find these monsters.", 2);
AddOption("No, Thanks Fuck that.", 255);
break;
case 2:
AddText("The Monster can be located at the Twin City");
AddText(", Around 430 097");
AddText(" becarefull the monster is not a push over.");
AddText(" Kill it and bring me my Heaven Sword");
AddText(" The monster has a chance of dropping good rewards.");
AddOption("ok, I am going to slay this monster now", 255);
break;
case 3:
if (_client.HasItem(722514))
{
_client.DeleteItem(722514);
_client.Money += 2500;
_client.Experience += 20;
AddText("Thank you so much for my Royal Sword Back");
AddText(" Here is your reward of 2500 silvers and some experience.");
AddOption("Thanks", 255);
}
else
{
AddText("You don't have a RoyalSword.");
AddOption("Ok! ill go get one.", 255);
}
break;
}
AddFinish();
Send();
}
}
}
|
That won't do anything. I believe there is a method in the Player class called AwardExperience or something of that nature. You'd have to use that.
|
|
|
07/24/2014, 15:35
|
#14
|
elite*gold: 0
Join Date: Jul 2014
Posts: 67
Received Thanks: 3
|
Quote:
Originally Posted by InsomniacPro
That won't do anything. I believe there is a method in the Player class called AwardExperience or something of that nature. You'd have to use that.
|
ok thanks will look into that
|
|
|
 |
Similar Threads
|
NPCs. Adding items.
12/03/2014 - Rohan - 7 Replies
Welcome guys.
I've ROHAN server with my friend on Hamachi, and we trying resolve one problem - namely it's adding items to NPCs.
I know partly how to do this, but I've problem with that - because I don't see this items in game ( I should see this when I replace orginal with edited files I suppose ). I see there's some "Group" in "itemtrade.bin". Could someone tell me how to specify group? Where find file which is responsible for groups in "itemtrade.bin"?
Thanks guys,
Greetings.
|
[Help] Custom Faces, Adding NPCs
04/02/2013 - Fiesta Online - 6 Replies
Hello everyone!
Currently I working on a sever, trying to learn some aesthetic stuff such as modding faces/clothes and such.
Ive been searching this forum but I havent found anything relative, and also almost every thread is in german e.e
How do I add my custom faces into the game? same with costumes.
How do I add an npc into the game? and how do I add my items in there?
Thank you very much, Regardz~
|
[Guide]Adding Npcs
09/02/2009 - CO2 PServer Guides & Releases - 20 Replies
Ok heres a simple guide on how to add npcs into the database.its very simple(theres a video at the end)
Step 1: Go to the npcs table in the database.Click Browse,And sort by uid and find the last number and add1 and also write this down.
Step 2: Go back to the beggining of your npc table.Click insert.Ok now type in the number your wrote down in the UID table.(Note there will be a pic when we click save at the end.)
Step 3: The type is what people have trouble with.The type is what...
|
[NEED HELP] adding npcs on PowerSourceCo
08/24/2009 - CO2 Private Server - 2 Replies
hello everyone! =)
well.. i created a conquer server, but when i tried to add a npc, or edit one, i found myself in a strnge situation, i tried to follow the guide "how to work has a pro on LOFT server" by emme.
but, i can add the npc, but i cant make it talk, or give items, its like a statue O.o
hope someone can helpme,
thank you,
saryogan
|
All times are GMT +2. The time now is 22:24.
|
|