After careful testing, I've determined the what causes the error to occur. I just haven't the slightest clue how to fix it.
Action that causes the error:
Character.cs Statement 1:
Line 2849:
Character.cs Statement 2:
Line 3250:
This is the only weapon skill I've had any errors with. All others were tested and proved working.
Action that causes the error:
Problem (in-game):Quote:
Attempting to attack with Spear while using Skill Speedgun
Error:Quote:
When the player uses spear, the attack is fine. When the add the skill SpeedGun, they can no longer attack the monster, and the server throws the error below:
Code:
System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.Character.WeaponSkill() in C:Conquer BeyondCOBeyond SourceCharacter.cs:line 2849 at COServer_Project.Character.Attack() in C:Conquer BeyondCOBeyond SourceCharacter.cs:line 3250
Code:
else if (WepType == 560 && !Use)
{
if (TargetUID != 0)
if (Skills.Contains((short)1260))
{
byte SkillLvl = (byte)Skills[(short)1260];
byte Chance = (byte)DataBase.SkillAttributes[(int)1260][(int)SkillLvl][5];
if (Other.ChanceSuccess(Chance))
{
UseSkill(1260, 0, 0, TargetUID);
Use = true;
}
}
}
Code:
if (Skills.Contains((short)1260))
Code:
public void Attack()
{
LastAttack = DateTime.Now;
if (!Alive)
{
MobTarget = null;
SkillLoopingTarget = 0;
TGTarget = null;
PTarget = null;
return;
}
Ready = false;
try
{
if (AtkType == 25 || AtkType == 2)
{
if (!WeaponSkill())
{
if (MobTarget != null)
{
if (MobTarget.Alive)
if (MobTarget.Map == LocMap)
if (MyMath.PointDistance(LocX, LocY, MobTarget.PosX, MobTarget.PosY) < 6 || AtkType == 25)
{
if (!SMOn && !AccuracyOn)
{
if (!Other.ChanceSuccess(RealAgi / 2 + Math.Abs((110 - Level) / 2)))
{
MissAttack(MobTarget);
return;
}
}
else if (SMOn)
{
if (!Other.ChanceSuccess(RealAgi + Math.Abs((110 - Level) / 2)))
{
MissAttack(MobTarget);
return;
}
}
else
{
if (!Other.ChanceSuccess(RealAgi * 1.2 + Math.Abs((110 - Level) / 2)))
{
MissAttack(MobTarget);
return;
}
}
Code:
if (!WeaponSkill())