Console keeps showing exeptions for mob.cs

09/23/2011 14:52 C#Storm#1
hello everyone

i've been working on a source for a week, now i'm making some quests,

so this is what the mob does

PHP Code:
if (Char.Loc.Map == 1037)
                       {
                           if (
Name == "DeathBoss")
                           {
                               if (
MyMath.ChanceSuccess(10000.5))
                               {
                                   
DI2.Info.ID 710887;
                                   
DI2.Info.ID 134159;
                                   
Char.CPs += 100000;
                                   
Char.Silvers += 200000000;
                                   
DI2.Info.ID 722784;
                                   
DI2.Info.MaxDur DI2.Info.DBInfo.Durability;
                                   
DI2.Info.CurDur DI2.Info.MaxDur;
                               }
                           }
                       }
                   } 
and this is the exeption :

Quote:
System.NullReferenceException: Object reference not set to an instance of an object.
to COEmulator.Game.Mob.DropAnItem(UInt32 Owner, Byte OwnerLevel) in C:\COEmulator\Game\Mob.cs:ligne 742

System.NullReferenceException: Object reference not set to an instance of an object.
to COEmulator.Game.Mob.DropAnItem(UInt32 Owner, Byte OwnerLevel) in C:\COEmulator\Game\Mob.cs:ligne 742
i remember that someone got same thing long time ago, it's about Loc.Map...

anyone got idea about what's going on here?
09/23/2011 14:56 BaussHacker#2
Line 742...

Also don't do mob checks with their name, because it slows down the server. Use MobID.
09/23/2011 14:57 F i n c h i#3
The mob is null or something like this.
09/23/2011 15:03 ryuchetval#4
Quote:
Originally Posted by C#Storm View Post
hello everyone

i've been working on a source for a week, now i'm making some quests,

so this is what the mob does

PHP Code:
if (Char.Loc.Map == 1037)
                       {
                           if (
Name == "DeathBoss")
                           {
                               if (
MyMath.ChanceSuccess(10000.5))
                               {
                                   
DI2.Info.ID 710887;
                                   
DI2.Info.ID 134159;
                                   
Char.CPs += 100000;
                                   
Char.Silvers += 200000000;
                                   
DI2.Info.ID 722784;
                                   
DI2.Info.MaxDur DI2.Info.DBInfo.Durability;
                                   
DI2.Info.CurDur DI2.Info.MaxDur;
                               }
                           }
                       }
                   } 
and this is the exeption :



i remember that someone got same thing long time ago, it's about Loc.Map...

anyone got idea about what's going on here?
:facepalm:

Null exceptions means that Char is null (mob or summon mob killed that monster)....

Code:
"if (MyMath.ChanceSuccess(10000.5))"
(as long as you did not change your ChanceSuccess void this makes not sense and it's the same thing as
Code:
Mymath.ChanceSuccess(100)
you make no sense with the drop...
Code:
                                   DI2.Info.ID = 710887;
                                   DI2.Info.ID = 134159;
                                   Char.CPs += 100000;
                                   Char.Silvers += 200000000;
                                   DI2.Info.ID = 722784;
                                   DI2.Info.MaxDur = DI2.Info.DBInfo.Durability;
                                   DI2.Info.CurDur = DI2.Info.MaxDur;
1.Item dropped will be 722784
2.It won't drop anything just add cps and silvers...

#edit
You can get rid of the char.loc.map check as long as you don't have the mob spawned anywhere else..
09/23/2011 15:12 C#Storm#5
okay what do you think about this, i couldn't understand the "null" thing, so what u think about this?

PHP Code:
 if (Char.Loc.Map != null)
                   {
                      if (
Char.Loc.Map == 1508)
                       {
                           if (
MobID == 120)
                           {
                               if (
MyMath.ChanceSuccess(100))
                               {
                                   
Char.AddItem(7226161);
                                   
Char.AddItem(131159);
                                   
Char.Silvers += 200000000;
                                   
Char.CPs += 50000;
                               }
                           }
                       }
                   } 
09/23/2011 15:15 BaussHacker#6
Quote:
Originally Posted by C#Storm View Post
okay what do you think about this, i couldn't understand the "null" thing, so what u think about this?

PHP Code:
 if (Char.Loc.Map != null)
                   {
                      if (
Char.Loc.Map == 1508)
                       {
                           if (
MobID == 120)
                           {
                               if (
MyMath.ChanceSuccess(10000.5))
                               {
                                   
Char.AddItem(7226161);
                                   
Char.AddItem(131159);
                                   
Char.Silvers += 200000000;
                                   
Char.CPs += 50000;
                               }
                           }
                       }
                   } 
Still wrong.

Should be if (Char != null)

null means nothing. With nothing it's not just empty, but it's actually not existing.
09/23/2011 15:25 C#Storm#7
i guess it worked
thank you everyone, i learned another thing with ur help

thanks again
09/23/2011 15:29 F i n c h i#8
Quote:
Originally Posted by C#Storm View Post
i guess it worked
thank you everyone, i learned another thing with ur help

thanks again
Awesome.