ExX
Member
I have this old Paintball system originally made by Greywolf. It's awesome and I used it for a long time back when I ran a RunUO 2.0 server. I am trying to get it to work now and I have it all set up properly but there is an issue with the guns not shooting. I go to shoot a bot or another player and nothing happens. I don't even try to shoot I just stand there. No animation or anything. I have gone over it a hundred times cutting out various parts that I think might be the issue but never having any luck. Thanks for any help. Once I have it fully working I'll release the updated version on the forums here.
I also uploaded the file for anyone that would find it easier.
Code:
using System;
using Server.Network;
using Server.Items;
using System.Collections;
namespace Server.Items
{
public class PaintBallGunBase : BaseRanged
{
public override int EffectID{ get{ return 0x1BFE; } }
public override Type AmmoType{ get{ return typeof( Arrow ); } }
public override Item Ammo{ get{ return new Arrow(); } }
public override WeaponAbility PrimaryAbility{ get{ return WeaponAbility.Block; } }
public override WeaponAbility SecondaryAbility{ get{ return WeaponAbility.ForceOfNature; } }
public override int AosStrengthReq{ get{ return 0; } }
public override int AosMinDamage{ get{ return 1; } }
public override int AosMaxDamage{ get{ return 1; } }
public override int AosSpeed{ get{ return 25; } }
public override int OldStrengthReq{ get{ return 0; } }
public override int OldMinDamage{ get{ return 1; } }
public override int OldMaxDamage{ get{ return 1; } }
public override int OldSpeed{ get{ return 25; } }
public override int DefMaxRange{ get{ return 10; } }
public override int InitMinHits{ get{ return 0; } }
public override int InitMaxHits{ get{ return 0; } }
[Constructable]
public PaintBallGunBase() : base( 3920 )
{
WeaponAttributes.SelfRepair = 20;
//Attributes.NightSight = 1;
Weight = 1.0;
Hue = Utility.RandomMetalHue();
}
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
{
if (defender.Player && defender.Region.Name == "The Paintball Arena" )
{
Item paintrobe = defender.FindItemOnLayer(Layer.OuterTorso );
defender.SendMessage( "You feel wet paint on you" );
if ( paintrobe == null)
{
defender.SendMessage( "You have NO Robe on!" );
ArrayList list = new ArrayList();
foreach ( Item item in World.Items.Values )
{
if( item.RootParent == defender)
{
if ( item is PaintBallPellets ) list.Add( item );
else if ( item is PaintBallRobe ) list.Add( item );
else if ( item is PaintBallGunBase ) list.Add( item );
}
}
foreach ( Item item in list ) item.Delete();
defender.SendMessage( "You have been eliminated, and the paintball equipment has been removed from your pack." );
defender.X = 5705;
defender.Y = 662;
defender.Z = 0;
defender.Map = Map.Felucca;
}
else if ( paintrobe.Hue == 6) paintrobe.Hue = 11;
else if ( paintrobe.Hue == 11) paintrobe.Hue = 21;
else if ( paintrobe.Hue == 21) paintrobe.Hue = 31;
else if ( paintrobe.Hue == 31) paintrobe.Hue = 38;
else if ( paintrobe.Hue == 38)
{
paintrobe.Hue = 6;
defender.SendMessage( "You have been hit 5 times!" );
ArrayList list = new ArrayList();
foreach ( Item item in World.Items.Values )
{
if( item.RootParent == defender)
{
if ( item is PaintBallPellets ) list.Add( item );
else if ( item is PaintBallRobe ) list.Add( item );
else if ( item is PaintBallGunBase ) list.Add( item );
}
}
foreach ( Item item in list ) item.Delete();
defender.X = 5705;
defender.Y = 662;
defender.Z = 0;
defender.Map = Map.Felucca;
defender.SendMessage( "You have been eliminated, and the paintball equipment has been removed from your pack." );
this.Name = this.Name + "/";
}
else
{
defender.SendMessage( "You are not wearing the proper robe!" );
ArrayList list = new ArrayList();
foreach ( Item item in World.Items.Values )
{
if( item.RootParent == defender)
{
if ( item is PaintBallPellets ) list.Add( item );
else if ( item is PaintBallRobe ) list.Add( item );
else if ( item is PaintBallGunBase ) list.Add( item );
}
}
foreach ( Item item in list ) item.Delete();
defender.X = 5705;
defender.Y = 662;
defender.Z = 0;
defender.Map = Map.Felucca;
defender.SendMessage( "You have been eliminated, and the paintball equipment has been removed from your pack." );
}
}
else if ( defender.Region.Name == "The Paintball Arena" )
{
attacker.SendMessage( "You stunned the bot for a moment" );
defender.Freeze( TimeSpan.FromSeconds( 30.0 ) );
}
damageBonus = -10;
base.OnHit( attacker, defender, damageBonus );
}
public PaintBallGunBase( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}
I also uploaded the file for anyone that would find it easier.