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!

Lootable Bank Check

Lootable Bank Check

Summary:
This is an edited version of Bank Check that came with RunUO36. I made it because I wanted to script a monster with 25k gold and obviously players can't carry that much, so this was the solution spawning checks on the monsters instead. But when you kill them they are blessed and stay with the monster.

This is a new version and works : )

Description:


Installation:
 

Attachments

  • LootableCheck.cs
    2.4 KB · Views: 239

twoballcane

Wanderer
fixxed it

There was one small "glitch" in the script. When you put the mouse over the bank check it doesn't tell you its value.
You need to add these lines of code for it work:
Code:
		public override void GetProperties(ObjectPropertyList list)
		{
			base.GetProperties( list );

			list.Add( 1060738, m_Worth.ToString() ); // value: ~1_val~
		}

So your LootableCheck.cs looks like this:
Code:
using System;
using Server.Items;
using Server.Network;

namespace Server.Items
{
	public class LootableCheck : Item
	{
		private int m_Worth;

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

		public LootableCheck( Serial serial ) : base( serial )
		{
		}

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

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

			writer.Write( (int) m_Worth );
		}

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

			int version = reader.ReadInt();

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

		[Constructable]
		public LootableCheck( int worth ) : base( 0x14F0 )
		{
			Weight = 0.0;
			Hue = 0x44;
			LootType = LootType.Regular;

			m_Worth = worth;
		}

		public override bool DisplayLootType{ get{ return false; } }

		public override int LabelNumber{ get{ return 1041361; } } // Lootable Check

[COLOR=Red]		public override void GetProperties(ObjectPropertyList list)
		{
			base.GetProperties( list );

			list.Add( 1060738, m_Worth.ToString() ); // value: ~1_val~
		}[/COLOR]
		public override void OnSingleClick( Mobile from )
		{
			from.Send( new MessageLocalizedAffix( Serial, ItemID, MessageType.Label, 0x3B2, 3, 1041361, "", AffixType.Append, String.Concat( " ", m_Worth.ToString() ), "" ) ); // Lootable Check:
		}

		public override void OnDoubleClick( Mobile from )
		{
			BankBox box = from.BankBox;

			if ( box != null && IsChildOf( box ) )
			{
				Delete();

				int deposited = 0;

				int toAdd = m_Worth;

				Gold gold;

				while ( toAdd > 60000 )
				{
					gold = new Gold( 60000 );

					if ( box.TryDropItem( from, gold, false ) )
					{
						toAdd -= 60000;
						deposited += 60000;
					}
					else
					{
						gold.Delete();

						from.AddToBackpack( new LootableCheck( toAdd ) );
						toAdd = 0;

						break;
					}
				}

				if ( toAdd > 0 )
				{
					gold = new Gold( toAdd );

					if ( box.TryDropItem( from, gold, false ) )
					{
						deposited += toAdd;
					}
					else
					{
						gold.Delete();

						from.AddToBackpack( new LootableCheck( toAdd ) );
					}
				}

				// Gold was deposited in your account:
				from.SendLocalizedMessage( 1042672, true, " " + deposited.ToString() );
			}
			else
			{
				from.SendLocalizedMessage( 1047026 ); // That must be in your bank box to use it.
			}
		}
	}
}

Hope this helps.

POTS
 

Zidane4056

Wanderer
Why not just [set loottype normal on the check?

Also, I find it is easier to oversee the players fighting the monster then use
[addtopack bancheck 50000
Because, see, the problem is, regular bank checks will say "Blessed" beneath them, but on this monster's corpse, you've got one that doesn't. That means this bank check is a one-of-a-kind item. Now, whether or not that matters, I guess, depends on the size of your shard. If it is less than 10 players on at most times, they will probably just want to cash the check. On the other hand, if there are almost always more than 10 players on, they might try to sell it for an amount higher than its worth, because it's the only bank check that doesn't say "Blessed" under it.

Now, if you want a more realistic "first come first serve" type looting thing, add a useless item to the monsters pack, and name it "Check Token" or something, and whoever takes that item will get the check. Be sure to remove the item from their pack, though, otherwise now they've got a different one-of-a-kind item!

More complicated, yes, but that's what I always do.
 
Are you a scriptor or just a world builder?

The reason you don't just say [set loottype regular, is because I wanted to script a monster that automatically had the checks inside they're pack. Scriptors will use this when they script new monsters. The reason it doesn't say blessed is because its NOT. HELLO thats the entire point. Why don't you accually read what I wrote about it before criticsizing?
 
Top