Register for your free account! | Forgot your password?

You last visited: Today at 12:08

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

Advertisement



My own npc

Discussion on My own npc within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2010
Posts: 174
Received Thanks: 13
My own npc

Okay when i finaly finish my server its not going to be up 24/7 since ive left college and ive got no money and theres no jobs around atm, i decided to make a npc where players can get 50k cps ( i may up it) each day (yeh i know my server may be a hit and miss cause it wont be up 24/7 but oh well xD) but ive got it so the npc gives you the cps but how do i make so you can only get it once a day? Here is my code:
#region Free CPs
case 987787:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("Hello, you can get 50k cps free each day!"));
GC.AddSend(Packets.NPCLink("Yes please", 2));
GC.AddSend(Packets.NPCLink("No Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 2)
{
GC.AddSend(Packets.NPCSay("Here you go, remember to say thank you to Jon"));
GC.MyChar.CPs += 50000;
GC.AddSend(Packets.NPCLink("Thank You Jon", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
break;
}
#endregion
2010mrsurfer is offline  
Old 05/20/2010, 18:41   #2
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
in character.cs define this:
public bool CPDay;

Then make your npc like this.
case 987787:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("Hello, you can get 50k cps free each day!"));
GC.AddSend(Packets.NPCLink("Yes please", 2));
GC.AddSend(Packets.NPCLink("No Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 2)
{
if (!GC.MyChar.CPDay)
{
GC.AddSend(Packets.NPCSay("Here you go, remember to say thank you to Jon"));
GC.MyChar.CPs += 50000;
GC.MyChar.CPDay = true;
GC.AddSend(Packets.NPCLink("Thank You Jon", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay("You have already claimed your cps for the day."));
GC.AddSend(Packets.NPCLink("Oh sorry.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
break;
}
#endregion
Arcо is offline  
Old 05/20/2010, 18:50   #3
 
elite*gold: 0
Join Date: May 2010
Posts: 174
Received Thanks: 13
Quote:
Originally Posted by .Arco View Post
in character.cs define this:
public bool CPDay;

Then make your npc like this.
case 987787:
{
if (Control == 0)
{
GC.AddSend(Packets.NPCSay("Hello, you can get 50k cps free each day!"));
GC.AddSend(Packets.NPCLink("Yes please", 2));
GC.AddSend(Packets.NPCLink("No Thanks.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
if (Control == 2)
{
if (!GC.MyChar.CPDay)
{
GC.AddSend(Packets.NPCSay("Here you go, remember to say thank you to Jon"));
GC.MyChar.CPs += 50000;
GC.MyChar.CPDay = true;
GC.AddSend(Packets.NPCLink("Thank You Jon", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
else
{
GC.AddSend(Packets.NPCSay("You have already claimed your cps for the day."));
GC.AddSend(Packets.NPCLink("Oh sorry.", 255));
GC.AddSend(Packets.NPCSetFace(N.Avatar));
GC.AddSend(Packets.NPCFinish());
}
}
break;
}
#endregion
Thank you what do you mean by define: public bool CPDay;
and do you know the number thing for the market? I only know TC is 1002
2010mrsurfer is offline  
Old 05/20/2010, 19:14   #4
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Go to characater.cs and search for public bool alive and put it under that.
And the ID for market is 1036.
Arcо is offline  
Old 05/20/2010, 19:38   #5
 
elite*gold: 0
Join Date: Sep 2008
Posts: 178
Received Thanks: 62
Then, just relog and you can obtain the CPs again >.<. You need save the variable.

It's not recommended to follow the .Arco's recommendations.
.Kob is offline  
Old 05/20/2010, 19:48   #6
 
elite*gold: 0
Join Date: May 2010
Posts: 174
Received Thanks: 13
Quote:
Originally Posted by .Arco View Post
Go to characater.cs and search for public bool alive and put it under that.
And the ID for market is 1036.
Thank you shall do it now

Quote:
Originally Posted by cakobu View Post
Then, just relog and you can obtain the CPs again >.<. You need save the variable.

It's not recommended to follow the .Arco's recommendations.
xD But Arco recommendations taught me how to program
Oh arco i get this problem with this line:
Loc.X = ushort.Parse(Info[5]); <<<< Index was outside the bounds of the array.
Any ideas?
2010mrsurfer is offline  
Reply




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


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.