Full Version : poisoning crash
xmlspawner >>Scripting Support >>poisoning crash


<< Prev | Next >>

Galfaroth- 02-09-2006
Line 801-804:
CODE
 public Account Prisoner
 {
  get {return Accounts.GetAccount(Name);}
 }


And here is my Poisoning.cs crash :|. These two crashes very good destroys my shard... and are the only ones that it has.

CODE
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
  at Server.SkillHandlers.InternalTimer.OnTick() in d:\Ultima Online\Tools\WoG(Moj)\Scripts\Skills\Poisoning.cs:line 124
  at Server.Timer.Slice()
  at Server.Core.Main(String[] args)


Here is this part:
CODE
    protected override void OnTick()
    {
     if ( m_From.CheckTargetSkill( SkillName.Poisoning, m_Target, m_MinSkill, m_MaxSkill ) )
     {
      if ( m_Target is Food )
      {
       ((Food)m_Target).Poison = m_Poison;
      }
      else if ( m_Target is BaseWeapon )
      {
       ((BaseWeapon)m_Target).Poison = m_Poison;
       ((BaseWeapon)m_Target).PoisonCharges = 18 - (m_Poison.Level * 2);
      }

      m_From.SendLocalizedMessage( 1010517 ); // You apply the poison

      Misc.Titles.AwardKarma( m_From, -20, true );
     }
     else // Failed
     {
      // 5% of chance of getting poisoned if failed
      if ( m_From.Skills[SkillName.Poisoning].Base < 80.0 && Utility.Random( 20 ) == 0 )
      {
       m_From.SendLocalizedMessage( 502148 ); // You make a grave mistake while applying the poison.
       m_From.ApplyPoison( m_From, m_Poison );
      }
      else
      {
       if ( m_Target is Food )
       {
        m_From.SendLocalizedMessage( 1010518 ); // You fail to apply a sufficient dose of poison
       }
       else if ( m_Target is BaseWeapon )
       {
        BaseWeapon weapon = (BaseWeapon)m_Target;

        if ( weapon.Type == WeaponType.Slashing )
        {
         m_From.SendLocalizedMessage( 1010516 ); // You fail to apply a sufficient dose of poison on the blade
        }
        else
        {
         m_From.SendLocalizedMessage( 1010518 ); // You fail to apply a sufficient dose of poison
        }
       }
      }
     }
    }
So my crashes: jail and poisoning.

ArteGordon- 02-09-2006
I'm assuming that your problem is here

((BaseWeapon)m_Target).PoisonCharges = 18 - (m_Poison.Level * 2);

where m_Poison is null. Why it is null will depend on any mods that you might have made. Probably involves changes to potions.

Galfaroth- 02-09-2006
I changed it to:
((BaseWeapon)m_Target).PoisonCharges = 18;
But still causes error... So it wasn't that... I think the problem is in SkillCheckTarget, but these are my only thinkings.

ArteGordon- 02-09-2006
if would be more helpful if you could identify the actual line in the script that is causing the crash using the debugging information in the crashlog.

Online\Tools\WoG(Moj)\Scripts\Skills\Poisoning.cs:line 124

As a guess, you might want to add a check for a null m_From at the beginning of the OnTick method.

CODE

protected override void OnTick()
   {
if(m_From == null) return;

Galfaroth- 02-09-2006
Ou yeah Arte... But why was it crashing my server. Is default RunUO poisioning.cs crashing too? Or maybe I did sth so it has to check this condition of null. Now the only crash is my jailing.

ArteGordon- 02-09-2006
you must have added some system that is applying poisoning in some non-standard way. This does not occur with the standard RunUO distribution.

ArteGordon- 02-09-2006
QUOTE (Galfaroth @ Feb 9 2006, 03:47 PM)
Now the only crash is my jailing.

did you look at my post in the thread on your jail system crash?

Galfaroth- 02-10-2006
Yes, but where is this post about cells (I think the problem was that if there is no cell it crashed). Now poisoning work, but it doesn't poison anything. I saw in props, that there are charges ok but Poision Type is -null-. So it simply doesn't apply the potion type I think - maybe it is because I changed the line:
((BaseWeapon)m_Target).PoisonCharges = 18 - (m_Poison.Level * 2);
to
((BaseWeapon)m_Target).PoisonCharges = 18; But I think it doesn't matter. If i have this paranthesis after 18, server crashes.

ArteGordon- 02-10-2006
you have changed something else in the poisoning system. What other custom scripts have you added?

Galfaroth- 02-10-2006
If XMLSpawner didn't provided custom script for Poisoning.cs I didn't change anything...

ArteGordon- 02-10-2006
it would not be a change to poisoning.cs, more likely a change to potions or to poison.cs

Galfaroth- 02-10-2006
Oh yeah... Thank you, I found it... The whole problem was that I translated the poision types more than half a year and completely forgotten about it (Poison.cs in Scripts/Misc). Now scripts wanted to take the potion level based on poison name and it nullified, so now I gave back the original RunUO names and everything work perfect.