Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 05:36

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

Advertisement



[Help]NullReferenceException

Discussion on [Help]NullReferenceException within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Oct 2008
Posts: 430
Received Thanks: 176
[Help]NullReferenceException

Ok... Well first off, I feel like an idiot fot not knowing what to do here. But I'm completely lost, so if somene could point me in the right direction, I'd appreciate it.

Seems this is completely random, sometimes it will occur after 30 minutes, sometimes the server can run for hours without an issue. But occasionally this kicks in, and everything freezes.

The code effected is...


Code:
                if (Charr.MyClient.Online)
                    [COLOR="Red"]if (MyMath.CanSee(Attacked.LocX, Attacked.LocY, Charr.LocX, Charr.LocY))[/COLOR]
                        Charr.MyClient.SendPacket(General.MyPackets.Attack(Mob.UID, Attacked.UID, (short)Attacked.LocX, (short)Attacked.LocY, AtkType, Dmg));
The portion I made red shows up in a yellow box, and I'm not sure why. From what I read about it, it's not reading a specific value correctly, but my question is how come it reads the value for a certain amount of time, then decides not too so suddenly?

I've also skimmed through a variety of similar codes. The only thing I've noticed different on this one in the line being effected is Attacked.LocX, Attacked.LocY

So I'm guessing maybe that could be the cause, not sure though.

The section this is in revolves around moster attacks on characters, if that helps give a better idea to anyone willing to help.

Thanks in advance to anyone who can give me some insight.
Incariuz is offline  
Old 11/23/2008, 14:54   #2
 
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
try
Code:
if(Attacked != null && Charr != null)
                if (Charr.MyClient.Online)
                    if (MyMath.CanSee(Attacked.LocX, Attacked.LocY, Charr.LocX, Charr.LocY))
                        Charr.MyClient.SendPacket(General.MyPackets.Attack(Mob.UID, Attacked.UID, (short)Attacked.LocX, (short)Attacked.LocY, AtkType, Dmg));
this is gonna fix ur error xP
alexbigfoot is offline  
Thanks
1 User
Old 11/23/2008, 14:57   #3
 
elite*gold: 0
Join Date: Oct 2008
Posts: 430
Received Thanks: 176
Oh wow, I saw something like that in the trouble shooting guide and it didn't even clue in to me. Well thanks for that, I wasn't expecting the actual code required. I'll test it out and see how things work.
Incariuz is offline  
Old 11/23/2008, 15:06   #4
 
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
hope i helped
alexbigfoot is offline  
Reply


Similar Threads Similar Threads
[VB 2008] "System.NullReferenceException wurde nicht behandelt"
12/30/2009 - .NET Languages - 9 Replies
Und der Fehler passiert in der Zeile: Sub _Anmelden() WebBrowser1.Document.GetElementById("user&qu ot;).InnerText = TextBox2.Text .......... .......... .......... .......... End Sub



All times are GMT +2. The time now is 05:36.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.