This is a warning I get for this script.

Turkeyshooter.cs(34,37,34,42): warning CS0114: 'Turkeyshooter.OnHit(Mobile, Mobile)' hides inherited member 'BaseWeapon.OnHit(Mobile, Mobile)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.

This is the actual script for the turkeyshooter:

using System;
using Server;
namespace Server.Items
{
public class Turkeyshooter : CompositeBow
{

public override int ArtifactRarity{ get{ return 50; } }
public override int EffectID{ get{ return 0x2764; } }

public override Type AmmoType{ get{ return typeof( Arrow ); } }
public override Item Ammo{ get{ return new Arrow(); } }
public override int InitMinHits{ get{ return 255; } }
public override int InitMaxHits{ get{ return 255; } }
public override int DefHitSound{ get{ return 1350; } }
public override int DefMissSound{ get{ return 617; } }
[Constructable]
public Turkeyshooter()
{
Weight = 5.0;
Name = "Turkey Shooter";
Hue = 2213;
Attributes.SpellChanneling = 1;
AccuracyLevel = WeaponAccuracyLevel.Supremely;
Quality = WeaponQuality.Exceptional;
Attributes.AttackChance = 90;
Layer = Layer.OneHanded;

}

public virtual void OnHit( Mobile attacker, Mobile defender )
{
if ( attacker.Player && !defender.Player && (defender.Body.IsAnimal || defender.Body.IsMonster) && 0.4 >= Utility.RandomDouble() )
defender.AddToBackpack( Ammo );
base.OnHit( attacker, defender );

if ( 0.25 > Utility.RandomDouble() )
{
defender.PlaySound(617);
defender.FixedParticles( 0x2764, 244, 25, 9941, 2713, 0, EffectLayer.Waist );
}
}
public Turkeyshooter( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 );
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}

Is this warning something I should be fixing? If so, can someone tell me how to fix it? I'm not a scripter, and I struggle with this stuff.

Thanks
 
public virtual void OnHit( Mobile attacker, Mobile defender )

Change to

public override void OnHit( Mobile attacker, Mobile defender )
Post automatically merged:

The reason for the error is that the script is calling a base method but not overriding it, it is hiding it, like putting a sticker over a sticker!

The proper way to work with a base class is to override the base method which should be the virtual method!
 
public virtual void OnHit( Mobile attacker, Mobile defender )

Change to

public override void OnHit( Mobile attacker, Mobile defender )
Post automatically merged:

The reason for the error is that the script is calling a base method but not overriding it, it is hiding it, like putting a sticker over a sticker!

The proper way to work with a base class is to override the base method which should be the virtual method, anything using this base class should override the base method!

Thank you so much! I really appreciate the help. I have a lot of these to fix, I'm guessing scripts were used to build other scripts and so the warning just kept going on and on and on.
Post automatically merged:

I have another couple of questions then.

I also get this warning:

\Scripts\Custom Systems\High Seas Ships\Ships\BaseShip.cs(40,43,40,51): warning CS0414: The field 'BaseShip.Backward' is assigned but its value is never used

This is the section of script that shows up with the warning:

private static readonly Direction Forward = Direction.North;
private static readonly Direction ForwardLeft = Direction.Up;
private static readonly Direction ForwardRight = Direction.Right;
private static readonly Direction Backward = Direction.South;
private static readonly Direction BackwardLeft = Direction.Left;
private static readonly Direction BackwardRight = Direction.Down;
private static readonly Direction Left = Direction.West;
private static readonly Direction Right = Direction.East;
private static readonly Direction Port = Left;
private static readonly Direction Starboard = Right;
private static TimeSpan BoatDecayDelay = TimeSpan.FromDays(13.0);

I'm guessing that backward is a command assigned to use on the ships but it's not defined anywhere else?? I don't know how to fix that either :)


And this:

Scripts\DoF Custom\Packages\Knives Chat 3[1].0 Beta 9\Knives Chat 3.0 Beta 9\General\MultiConnection.cs(165,30,165,31): warning CS0168: The variable 'e' is declared but never used

identifies this part of the script

}
catch (Exception e)
{
Errors.Report("Error disconnecting slave.");
//Console.WriteLine(e.Message);
//Console.WriteLine(e.Source);
//Console.WriteLine(e.StackTrace);
}

Last one right now:

\Scripts\DoF Custom\Utility Items\Spellbar_Ver 2\Spellbar\SpellBarScroll_XML.cs(27,22,27,32): warning CS0108: 'SpellBarScroll.Initialize()' hides inherited member 'XmlAttachment.Initialize()'. Use the new keyword if hiding was intended.



public static void Initialize()
{
EventSink.Login += new LoginEventHandler(EventSink_Login);
EventSink.Speech += new SpeechEventHandler(EventSink_Speech);
EventSink.CharacterCreated += new CharacterCreatedEventHandler(EventSink_CharacterCreated);


I'm not sure if I should be fixing warnings, but the OCD in me hates to see them everytime.
 
Last edited:
I've been learning a bit by trial and error, sometimes I remove the offending line and it still compiles and works the way it was intended. Other times it doesn't so it's been an experience. Still need help with the ones above. Thanks
 
Back