RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

excuse me : don't add new object

Vitremer

Sorceror
excuse me : don't add new object

i've created a new object "Wishes Lamp" or lampada dei desideri. GM on doubleclick create into own backpack objects at various level of runic enenchement.

but the object don't appear when i use command [add lampada or [add lamp....i don't understand the cause

Code:
using System;
using System.Collections.Generic;
using Server;
using Server.ContextMenus;
using Server.Engines.PartySystem;
using Server.Gumps;
using Server.Items;
using Server.Multis;
using Server.Mobiles;
using Server.Network;

namespace Server.Items
{
	public class LampadaDeiDesideri : Item
	{
		private int m_Levell = 0;
		[CommandProperty( AccessLevel.GameMaster )]
		public int Levell
		{ get{ return m_Levell; } set{ m_Levell = value; } }


		[Constructable]
		public LampadaDeiDesideri( int itemID ) : this( itemID, 0 )
		{
		//	m_Levell = levell;
			Name = "Lampada dei Desideri";
			LootType = LootType.Blessed;
		}

		[Constructable]
		public LampadaDeiDesideri( int itemID, int levell ) : base( 0x1084 )
		{
			m_Levell = levell;
			Name = "Lampada dei Desideri";

			Movable = true;

		}

		public LampadaDeiDesideri( Serial serial ) : base( serial )
		{
		//		ItemID = 0x1084;
		}

		public override void OnDoubleClick( Mobile from )
		{
			PlayerMobile pm = from as PlayerMobile;

			if ( pm.Alive && pm.AccessLevel < AccessLevel.GameMaster )
			{
				from.SendMessage( "Non hai la possibilita' di utilizzarla" ); // The bola must be in your pack to use it.
			}
			else if ( !IsChildOf( from.Backpack ) )
			{
				from.SendMessage( "Deve essere nella tua sacca per essere usato" ); // The bola must be in your pack to use it.
			}
			else
			{
				from.SendMessage( "Il potere della Lampada genera un oggetto incantato!" ); // 
				GeneraOggetto( from, m_Levell );
			} 
		}

		private static void GetRandomAOSStats( out int attributeCount, out int min, out int max )
		{

			int rnd = Utility.Random( 15 );

			if ( rnd < 1 )
			{
				attributeCount = Utility.RandomMinMax( 2, 6 );
				min = 20; max = 70;
			}
			else if ( rnd < 3 )
			{
				attributeCount = Utility.RandomMinMax( 2, 4 );
				min = 20; max = 50;
			}
			else if ( rnd < 6 )
			{
				attributeCount = Utility.RandomMinMax( 2, 3 );
				min = 20; max = 40;
			}
			else if ( rnd < 10 )
			{
				attributeCount = Utility.RandomMinMax( 1, 2 );
				min = 10; max = 30;
			}
			else
			{
				attributeCount = 1;
				min = 10; max = 20;
			}
		}

		public static void GeneraOggetto( Mobile from, int levell )
		{
		//	from.Backpack = false;


		/*	{
				cont.LockLevel = 0; // Can't be unlocked

				cont.DropItem( new Gold( Utility.RandomMinMax( 50, 100 ) ) );

				if ( Utility.RandomDouble() < 0.75 )
					cont.DropItem( new TreasureMap( 0, Map.Trammel ) );
			}	*/

			if ( levell >= 0 )
			{
				for ( int i = 0; i < levell * 6; ++i )
				{
					Item item;

					if ( Core.AOS )
						item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
					else
						item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();

					if ( item is BaseWeapon )
					{
						BaseWeapon weapon = (BaseWeapon)item;

						if ( Core.AOS )
						{
							int attributeCount;
							int min, max;

							GetRandomAOSStats( out attributeCount, out min, out max );

							BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min+levell, max+(levell)*2 );
						}
						else
						{
							weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
							weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
							weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
						}

							from.AddToBackpack( item );
					//	( from.Backpack ).DropItem( item );
					}
					else if ( item is BaseArmor )
					{
						BaseArmor armor = (BaseArmor)item;

						if ( Core.AOS )
						{
							int attributeCount;
							int min, max;

							GetRandomAOSStats( out attributeCount, out min, out max );

							BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
						}
						else
						{
							armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
							armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
						}

							from.AddToBackpack( item );
					//	( from.Backpack ).DropItem( item );
					}
					else if( item is BaseHat )
					{
						BaseHat hat = (BaseHat)item;

						if( Core.AOS )
						{
							int attributeCount;
							int min, max;

							GetRandomAOSStats( out attributeCount, out min, out  max );

							BaseRunicTool.ApplyAttributesTo( hat, attributeCount, min, max );
						}

							from.AddToBackpack( item );
					//	( from.Backpack ).DropItem( item );
					}
					else if( item is BaseJewel )
					{
						int attributeCount;
						int min, max;

						GetRandomAOSStats( out attributeCount, out min, out max );

						BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );

							from.AddToBackpack( item );
					//	( from.Backpack ).DropItem( item );
					}
				}
			}

		}

	//	public LampadaDeiDesideri( Serial serial ) : base( serial )
	//	{
	//			ItemID = 0x1084;
	//	}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version

			writer.Write( (int) m_Levell );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 0:
				{
					m_Levell = reader.ReadInt();

					break;
				}
			}

		}

	}
}
 

Soteric

Knight
Code:
[Constructable]
public LampadaDeiDesideri( int itemID ) : this( itemID, 0 )

[Constructable]
public LampadaDeiDesideri( int itemID, int levell ) : base( 0x1084 )
Your constructors expect some arguments from you. It can't understand what itemID to choose when you type just "[add lampadadeidesideri". You should add id number at the end of the command or add another constructor to your code that doesn't need itemID argument to be passed (you should write some default one there).

P.S. Why uokgames still hasn't banned?
 
Top