Register for your free account! | Forgot your password?

You last visited: Today at 22:00

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

Advertisement



A wierd error

Discussion on A wierd error 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
A wierd error

Okay i made a npc yesterday and Arco gave me tthe line of code to make it so you can only get it once a day but the source wont debugg now,
Loc.X = ushort.Parse(Info[5]); this line of code comes up in yellow when it debuggs and i dont know how to fix it, it also says: Index was outside the bounds of the array. Anybody know what this is?
2010mrsurfer is offline  
Old 05/21/2010, 11:38   #2
 
xScott's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 322
Received Thanks: 63
Quote:
Originally Posted by 2010mrsurfer View Post
Okay i made a npc yesterday and Arco gave me tthe line of code to make it so you can only get it once a day but the source wont debugg now,
Loc.X = ushort.Parse(Info[5]); this line of code comes up in yellow when it debuggs and i dont know how to fix it, it also says: Index was outside the bounds of the array. Anybody know what this is?
"Index was outside the bounds of the array"

Means the number of array your trying to assign something to is larger then the one defined

Like an array with 5 Elements, and you try and assign something to Element 6, which doesn't exist, thats why its giving you an error
xScott is offline  
Old 05/21/2010, 12:08   #3
 
elite*gold: 0
Join Date: May 2010
Posts: 174
Received Thanks: 13
Quote:
Originally Posted by xScott View Post
"Index was outside the bounds of the array"

Means the number of array your trying to assign something to is larger then the one defined

Like an array with 5 Elements, and you try and assign something to Element 6, which doesn't exist, thats why its giving you an error
Do you know how to fix this?
2010mrsurfer is offline  
Old 05/21/2010, 12:29   #4
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,379
Quote:
Originally Posted by 2010mrsurfer View Post
Do you know how to fix this?
Easy, either modify the input (file or thing being read), modify the reader (change how many things aee trying to be read or more likely, check your input values.


I'm assuming this is related to an npc spawn code loaded from a text file? Go through them and ensure none of the entries are messed up/incomplete.
pro4never is offline  
Thanks
1 User
Old 05/21/2010, 12:33   #5
 
elite*gold: 0
Join Date: May 2010
Posts: 174
Received Thanks: 13
Quote:
Originally Posted by pro4never View Post
Easy, either modify the input (file or thing being read), modify the reader (change how many things aee trying to be read or more likely, check your input values.


I'm assuming this is related to an npc spawn code loaded from a text file? Go through them and ensure none of the entries are messed up/incomplete.
Well i added my npc in npcdialog.cs, code:
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


And then Arco told me to put this into chracter.cs : public bool CPDay;

Under: public bool alive
2010mrsurfer is offline  
Old 05/21/2010, 12:59   #6
 
xScott's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 322
Received Thanks: 63
Quote:
Originally Posted by 2010mrsurfer View Post
Well i added my npc in npcdialog.cs, code:
Code:
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
And then Arco told me to put this into chracter.cs : public bool CPDay;

Under: public bool alive
that looks like it should work o-o, whats wrong with it? + use the code format when posting code, makes it neater
xScott is offline  
Old 05/21/2010, 13:03   #7
 
elite*gold: 0
Join Date: May 2010
Posts: 174
Received Thanks: 13
Quote:
Originally Posted by xScott View Post
that looks like it should work o-o, whats wrong with it? + use the code format when posting code, makes it neater
I dont know whats wrong with it, this line of code is the problem :
Loc.X = ushort.Parse(Info[5]);
2010mrsurfer is offline  
Old 05/21/2010, 13:25   #8
 
xScott's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 322
Received Thanks: 63
Quote:
Originally Posted by 2010mrsurfer View Post
I dont know whats wrong with it, this line of code is the problem :
Loc.X = ushort.Parse(Info[5]);
Like Pro4Never said, Looks like you put dodgy Coordinates when you inserted this npc in the NPC.Txt, change the coordinates of the NPC and see if that works
xScott is offline  
Old 05/21/2010, 13:48   #9
 
elite*gold: 0
Join Date: May 2010
Posts: 174
Received Thanks: 13
Quote:
Originally Posted by 2010mrsurfer View Post
I dont know whats wrong with it, this line of code is the problem :
Loc.X = ushort.Parse(Info[5]);
Quote:
Originally Posted by xScott View Post
Like Pro4Never said, Looks like you put dodgy Coordinates when you inserted this npc in the NPC.Txt, change the coordinates of the NPC and see if that works
Ahhh i think i know why, I havent put the Coordinates in for that npc yet xD could this be the problem??
2010mrsurfer is offline  
Old 05/21/2010, 17:19   #10
 
xScott's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 322
Received Thanks: 63
Quote:
Originally Posted by 2010mrsurfer View Post
Ahhh i think i know why, I havent put the Coordinates in for that npc yet xD could this be the problem??
Yep, looks like it.
put them in and tell me if it works
xScott is offline  
Thanks
1 User
Old 05/21/2010, 22:28   #11
 
elite*gold: 0
Join Date: May 2010
Posts: 174
Received Thanks: 13
Yep it works silly error of me xD but ill learn :P Thanks
2010mrsurfer is offline  
Old 05/21/2010, 23:00   #12
 
xScott's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 322
Received Thanks: 63
Quote:
Originally Posted by 2010mrsurfer View Post
Yep it works silly error of me xD but ill learn :P Thanks
Nice to know :]
xScott is offline  
Old 05/21/2010, 23:28   #13
 
elite*gold: 0
Join Date: May 2010
Posts: 174
Received Thanks: 13
since u helped i pressed thanks
2010mrsurfer is offline  
Thanks
1 User
Old 05/22/2010, 17:33   #14
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,379
Quote:
Originally Posted by 2010mrsurfer View Post
Ahhh i think i know why, I havent put the Coordinates in for that npc yet xD could this be the problem??
Glad you got everything working.

Just for some further explanation. That error just means you are trying to load something that isn't there...

Think of it this way.

You load things out of the file and separate them using spaces. using [] you can recall which entry you want to use. If there is nothing in that entry though it means there is nothing to load so it has no idea what to do after that.


Also: I wanna point out a problem with your npc. Relogging will reset the bool back to true meaning players can claim it again. You will want to add a time claimed entry... something along the line of

public static DateTime DailyClaimed;


Then you will want to A: have it save to database when claiming and B: load from database when logging in.

Then in the npc do something like...

if (DateTime.Now > GC.MyChar.DailyClaimed.AddHours(24))
{
claim code
GC.MyChar.DailyClaimed = DateTime.Now;
Update Character database.
}
else
{
can't claim code
}


Anyways, it's not urgent but I figured I'd mention it seeing as it may be useful to you later.

Good luck.
P4N
pro4never is offline  
Thanks
1 User
Old 05/27/2010, 15:37   #15
 
elite*gold: 0
Join Date: May 2010
Posts: 174
Received Thanks: 13
Thanks P4N
2010mrsurfer is offline  
Reply


Similar Threads Similar Threads
Err Wierd.
07/10/2009 - Conquer Online 2 - 10 Replies
wot up homios XD anyhow heres the deal , i was botting my ninjas toxic fog on the RB map , where you used to get RB'ned at at the top of the map up on the tree , then after a couple of hours botting there , suddenly appeared a NPC at me called Tinastin or summat , clicked on him he says "What Are You Doing Here" and you can only reply him with "Just Passing By" is that supposed to appear there like as a part of some kinda quest or something ? Or its some TQ new trick to bust botters ?xD...
A wierd one.
03/28/2009 - Dekaron Private Server - 2 Replies
I register and everything is fine except 2 things. My account info isnt in the "billing" database it isnt in the "cash" datab ase either. I was wondering if this has anything to do with OBDC links but im not sure it is. So if anyone has any ideas on this, could you give me a shout? thanks!
Wierd error message
11/26/2008 - Silkroad Online - 3 Replies
I run vista and the error says different, have a look for yourself the message says that my OS is running Windows 2000 Service Pack 1 any help would be awsome!!
wierd error after openning tbot
11/09/2007 - Silkroad Online - 12 Replies
hey all i am having a wierd error after i opn tserver and open tbot 1107 the gamegaurd load and then i get error caled "selected collacting sequance cant be loaded by the operating system"when i press ok it loads and bring another wierd error here a ss http://img252.imageshack.us/img252/410/errorvp1.p ng please help me to open that bot :)
wierd SILKROAD ERROR D: (i DID use search button
10/06/2007 - Silkroad Online - 10 Replies
http://i25.photobucket.com/albums/c52/f4ggits/unti tled.jpg can anyone explain? i tried reinstalling bot and silkroad and tried with loopback adaptor on and off and tried with and without host folder.. and with router and without and no firewall on.. !!@#!@#!!!!



All times are GMT +1. The time now is 22:01.


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.