Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 12-15-2006, 11:35 AM   #1 (permalink)
Forum Newbie
 
Blind Look's Avatar
 
Join Date: Dec 2005
Posts: 9
Question passing of the name

hi, while I translate some names of objects implement, I'm shrewed of an error: In the script ArmorOfCrafting developed by Daat99, as soon I add the bonus to the armor ( es. gloves carpentry +5 ), it vanishes the name, and appears the 1°th resistence ( phisic 2% ), but if bonus is 0 the name appears
this is the script:

Code:
/*
 created by:
     /\            888                   888     .d8888b.   .d8888b.  
____/_ \____       888                   888    d88P  Y88b d88P  Y88b 
\  ___\ \  /       888                   888    888    888 888    888 
 \/ /  \/ /    .d88888  8888b.   8888b.  888888 Y88b. d888 Y88b. d888 
 / /\__/_/\   d88" 888     "88b     "88b 888     "Y888P888  "Y888P888 
/__\ \_____\  888  888 .d888888 .d888888 888           888        888 
    \  /      Y88b 888 888  888 888  888 Y88b.  Y88b  d88P Y88b  d88P 
     \/        "Y88888 "Y888888 "Y888888  "Y888  "Y8888P"   "Y8888P"  
*/
using System;

namespace Server.Items
{
	public class ArmorOfCrafting : BaseArmor
	{

		public override int AosStrReq{ get{ return 20; } }
		public override int OldStrReq{ get{ return 10; } }

		public override ArmorMaterialType MaterialType{ get{ return ArmorMaterialType.Leather; } }
		public override CraftResource DefaultResource{ get{ return CraftResource.RegularLeather; } }

		public override ArmorMeditationAllowance DefMedAllowance{ get{ return ArmorMeditationAllowance.All; } }

		public override int InitMinHits{ get{ return 30 + (6*i_SkillBonus); } }
		public override int InitMaxHits{ get{ return 40 + (10*i_SkillBonus); } }
		
		public override int ArmorBase{ get{ return 13 + (4*i_SkillBonus); } }

		private int i_SkillBonus, i_Skill;
		private SkillMod sm_SkillMod;
		private SkillName sn_SkillName;

		[CommandProperty( AccessLevel.GameMaster )]
		public int SkillBonus
		{
			get
			{
				return i_SkillBonus;
			}
			set
			{
				i_SkillBonus = value;
				InvalidateProperties();

				if ( i_SkillBonus == 0 )
				{
					if ( sm_SkillMod != null )
						sm_SkillMod.Remove();

					sm_SkillMod = null;
				}
				else if ( sm_SkillMod == null && Parent is Mobile )
				{
					sm_SkillMod = new DefaultSkillMod( sn_SkillName, true, i_SkillBonus );
					((Mobile)Parent).AddSkillMod( sm_SkillMod );
				}
				else if ( sm_SkillMod != null )
				{
					sm_SkillMod.Value = i_SkillBonus;
				}
			}
		}

		public int Skill { get { return i_Skill; } set { i_Skill = value; InvalidateProperties(); } }

		public override void OnAdded( object parent )
		{
			base.OnAdded( parent );

			if ( i_SkillBonus != 0 && parent is Mobile )
			{
				if ( sm_SkillMod != null )
					sm_SkillMod.Remove();

				sm_SkillMod = new DefaultSkillMod( sn_SkillName, true, i_SkillBonus );
				((Mobile)parent).AddSkillMod( sm_SkillMod );
			}
		}

		[CommandProperty( AccessLevel.GameMaster )]
		public SkillName SkillName { get { return sn_SkillName; } set { sn_SkillName = value; InvalidateProperties(); } }
		
		public override void OnDoubleClick (Mobile from)
		{
		if ( IsChildOf( from.Backpack ) )
		{
			base.OnDoubleClick(from);
			if (!this.Movable)
			{
				from.SendLocalizedMessage(500312);
				return;
			}
			else if ( this.RootParent is Item )
			{
				Item rootp = (Item)this.RootParent;
				if (!rootp.Movable && !(rootp is Corpse))
				{
					from.SendLocalizedMessage(500312);
					return;
				}
			}
			else if (RootParent is Mobile)
			{
				Mobile rootp = (Mobile)this.RootParent;
				if ( ((rootp.AccessLevel < from.AccessLevel) && (rootp != from)) || ((rootp != from) && (from.AccessLevel == 0)) )
				{
					from.SendLocalizedMessage(500312);
					return;
				}
			}

			if (!( Parent is Mobile ))
			{
				if (Layer == Layer.TwoHanded || (from.FindItemOnLayer( Layer.TwoHanded ) != null && from.FindItemOnLayer( Layer.TwoHanded ) is BaseWeapon ))
				{
					from.ClearHands();
					from.PlaySound(0x48);
				}
				else if ( from.FindItemOnLayer( Layer ) != null )
				{
					from.ClearHand(from.FindItemOnLayer( Layer ));
					from.PlaySound(0x48);
				}
				from.EquipItem(this);
			}
		}
		else
		{
		from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
		}
		}

		public override void OnRemoved( object parent )
		{
			base.OnRemoved( parent );

			if ( sm_SkillMod != null )
				sm_SkillMod.Remove();

			sm_SkillMod = null;
		}

		[Constructable]
		public ArmorOfCrafting( int bonus, int itemID, int skill ) : base( itemID )
		{
			i_SkillBonus = bonus;
			i_Skill = skill;

			switch (i_Skill)
			{
				default: case 0: sn_SkillName = SkillName.Blacksmith; break;
				case 1: sn_SkillName = SkillName.Mining; break;
				case 2: sn_SkillName = SkillName.Tailoring; break;
				case 3: sn_SkillName = SkillName.Carpentry; break;
				case 4: sn_SkillName = SkillName.Lumberjacking; break;
			}

			string s_Type = "";
			switch (itemID)
			{
				case 5062: default: ItemID = 5062; s_Type = "gloves"; break;
				case 7609: ItemID = 7609; s_Type = "cappello"; break;
				case 5068: ItemID = 5068; s_Type = "tunica"; break;
				case 5063: ItemID = 5063; s_Type = "gorgiera"; break;
				case 5069: ItemID = 5069; s_Type = "bracciali"; break;
				case 5067: ItemID = 5067; s_Type = "gambali"; break;
			}

			if (i_SkillBonus <= 1)
				{
				Name = s_Type + " dell'Apprendista di " + sn_SkillName.ToString();
				}
			else if (i_SkillBonus <= 3)
				{
				Name = s_Type + " del Novizio di " + sn_SkillName.ToString();
				}
			else
				{
				Name = s_Type + " del Maestro di " + sn_SkillName.ToString();
				}

			Weight = 1;
			PhysicalBonus = 2 + Utility.Random((int)(1.6*bonus));
			FireBonus = 4 + Utility.Random((int)(1.6*bonus));
			ColdBonus = 3 + Utility.Random((int)(1.6*bonus));
			PoisonBonus = 3 + Utility.Random((int)(1.6*bonus));
			EnergyBonus = 3 + Utility.Random((int)(1.6*bonus));
			

			
			this.Hue = CraftResources.GetHue( (CraftResource)Utility.RandomMinMax( (int)CraftResource.DullCopper, (int)CraftResource.Platinum ) );
		}

		public override void GetProperties( ObjectPropertyList list )
		{
			base.GetProperties( list );

			if ( i_SkillBonus != 0 )
			{
				list.Add("{0} bonus +{1}", sn_SkillName, i_SkillBonus);
			}
		}
		
		public ArmorOfCrafting( Serial serial ) : base( serial )
		{
		}
		
		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

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

			writer.Write( (int) i_SkillBonus );

			writer.Write( (int) i_Skill );
		}

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

			int version = reader.ReadInt();

			switch ( version )
			{
				case 0:
				{
					i_SkillBonus = reader.ReadInt();
					i_Skill = reader.ReadInt();
					break;
				}
			}

			switch (i_Skill)
			{
				case 0: default: sn_SkillName = SkillName.Blacksmith; break;
				case 1: sn_SkillName = SkillName.Mining; break;
				case 2: sn_SkillName = SkillName.Tailoring; break;
				case 3: sn_SkillName = SkillName.Carpentry; break;
				case 4: sn_SkillName = SkillName.Lumberjacking; break;
			}

			if ( i_SkillBonus != 0 && Parent is Mobile )
			{
				if ( sm_SkillMod != null )
					sm_SkillMod.Remove();

				sm_SkillMod = new DefaultSkillMod( sn_SkillName, true, i_SkillBonus );
				((Mobile)Parent).AddSkillMod( sm_SkillMod );
			}
		}
	}
}
i've try in every mode to fix, but nothing, in someone can help me, there will be pleasing
p.s. sorry for my english :P
Blind Look is offline   Reply With Quote
Old 12-21-2006, 08:05 AM   #2 (permalink)
Forum Newbie
 
Blind Look's Avatar
 
Join Date: Dec 2005
Posts: 9
Default

plz, no help
Blind Look is offline   Reply With Quote
Old 12-21-2006, 12:50 PM   #3 (permalink)
Forum Expert
 
Join Date: Mar 2005
Location: Berlin, Germany
Age: 27
Posts: 1,136
Send a message via ICQ to Sotho Tal Ker Send a message via MSN to Sotho Tal Ker
Default

What did you change in that script?
Sotho Tal Ker is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5