[5165] Question Error

03/01/2010 07:01 arab4life#1
I been getting this error on the command line...over and over again. Can someone help me to fix this issue?

at NewestCOServer.Game.Mob.DropAnItem(UInt32 Owner, Byte OwnerLevel) in C:\5165\Game\Mob.cs:line 516
System.NullReferenceException: Object reference not set to an instance of an object.


PHP Code:
                if (MyMath.ChanceSuccess(100))
                {
                    if (
MobID == 1)
                    {
      
line 516                Char.Silvers += 1;
                        
Char.CPs += 10;

                        return;
                    }
                } 
03/01/2010 09:33 Korvacs#2
Char hasnt been assigned a value.
03/01/2010 22:08 Arcо#3
More than likely you are putting it in the wrong place.
Try putting it above the met drop.
03/02/2010 02:02 arab4life#4
Quote:
Originally Posted by Korvacs View Post
Char hasnt been assigned a value.
Are you sure?

Quote:
Originally Posted by .Arco View Post
More than likely you are putting it in the wrong place.
Try putting it above the met drop.
Putting what in the wrong place?
03/02/2010 02:06 walmartboi#5
Try my 5165 cp code, it'll fix that.
03/02/2010 02:33 arab4life#6
Quote:
Originally Posted by walmartboi View Post
Try my 5165 cp code, it'll fix that.
so let me get this straight.

replace this:
PHP Code:
                if (MyMath.ChanceSuccess(100))
                {
                    if (
MobID == 1)
                    {
                        
Char.Silvers += 1;
                        
Char.CPs += 10;

                        return;
                    }
                } 
with this:
PHP Code:
if (MyMath.ChanceSuccess(100))
                {
                    
string acc "";
                    
int cpDroprate 10;//rate of cp for server
                    
int cpLow 1;//min cp drop
                    
int cpHigh 25;// max cp drop
                    
int cpMultiplyer 5;// cp drop multiplier
                    
double cpMobDropRate = (Convert.ToDouble(MobTarget.Level) / Convert.ToDouble(Char.Level)) * cpDroprate;
                    if (
MyMath.ChanceSuccess(cpMobDropRate))
                    {
                        
Random rand = new Random();
                        
int cpBaseReward rand.Next(cpLowcpHigh);
                        
int cpToAdd cpBaseReward cpMultiplyer;

                        
Char.CPs += Convert.ToUInt32(cpToAdd);
                        
Char.MyClient.LocalMessage(2005"[CPs] You have gained: " cpToAdd " CPs for killing a(n) " MobTarget.Name);
                        
Database.SaveCharacter(Characc);
                    }
                } 
Edit:

Seems to be ok now. Will let you know in about 10mins.


Edit#2:

The Error till shows, that sucks. Anyone?
03/02/2010 03:40 walmartboi#7
Try adding this at line 516:

Code:
else if (Arr == null)
                {
                    Console.WriteLine("Array list reported as NULL.");
                }
03/03/2010 03:12 arab4life#8
Got it working. Commenting out the code. Cuz if u look @ it, its a worthless code anyway.
03/03/2010 03:18 walmartboi#9
Quote:
Originally Posted by arab4life View Post
Got it working. Commenting out the code. Cuz if u look @ it, its a worthless code anyway.
Yeah, because it's going to do it all the time anyways :P
03/03/2010 04:01 arab4life#10
Thx for ur help anyway
03/03/2010 04:04 walmartboi#11
Quote:
Originally Posted by arab4life View Post
Thx for ur help anyway
No problem, any time ;)