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!

trying to duplicate a large script...

Just got an error:

No overload for method 'BlacksmithVendorBackpack' takes '0' arguments

This points to this line of code:

Code:
AddItem( new BlacksmithVendorBackpack() );




Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Gumps;
using Server.Prompts;
using Server.Targeting;
using Server.Misc;
using Server.Multis;
using Server.ContextMenus;

public class BlacksmithPlayerVendor : PlayerVendor
{

	public class BlacksmithVendorBackpack : VendorBackpack
	{


	public override bool CheckHold( Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight )
	{
		if ((item.ItemID != 5121) || //Kryss
			(item.ItemID != 3932) || //Mace
			(item.ItemID != 3938) || //Spear
			(item.ItemID != 5179) || //Maul
			(item.ItemID != 5123) || //ShortSpear
			(item.ItemID != 5177) || //WarHammer
			(item.ItemID != 5125) || //WarFork
			(item.ItemID != 5127)) //WarMace
		{return false;}
		if ( !base.CheckHold( m, item, message, checkItems, plusItems, plusWeight ) )
			return false;

		if ( !BaseHouse.NewVendorSystem && Parent is PlayerVendor )
		{
			BaseHouse house = ((PlayerVendor)Parent).House;

			if ( house != null && house.IsAosRules && !house.CheckAosStorage( 1 + item.TotalItems + plusItems ) )
			{
				if ( message )
					m.SendLocalizedMessage( 1061839 ); // This action would exceed the secure storage limit of the house.

				return false;
			}
		}

		return true;
	}

		public BlacksmithVendorBackpack( Serial serial ) : base( serial ) {}
		public override void Serialize(GenericWriter writer ){base.Serialize(writer);}
		public override void Deserialize(GenericReader reader ){base.Deserialize(reader);}

	}


	public BlacksmithPlayerVendor( Mobile owner, BaseHouse house ) : base( owner, house )
	{
		if( Backpack != null && !Backpack.Deleted )
			Backpack.Delete();

		AddItem( new BlacksmithVendorBackpack() );
	}
	public BlacksmithPlayerVendor(Serial s):base(s){}
	public override void Serialize(GenericWriter writer ){base.Serialize(writer);}
	public override void Deserialize(GenericReader reader ){base.Deserialize(reader);}
}


P.S. - Your patience with a complete newb is amazing. I salute you sir.
 
Well we are really close on this.... it compiles but it seems like checkhold returns false all of the time now.... i tried to drop some items with the specific itemid's onto the pack as well as random items and it does not allow any items now....i've simplified the code to only check for these items and it still seems to return false all of the time...

It has to be my test expression on my if...My only guess is that the || operator can't be used more than once?

What do you think?

Code:
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Gumps;
using Server.Prompts;
using Server.Targeting;
using Server.Misc;
using Server.Multis;
using Server.ContextMenus;

public class BlacksmithPlayerVendor : PlayerVendor
{

	public class BlacksmithVendorBackpack : VendorBackpack
	{
		public BlacksmithVendorBackpack() {}

	public override bool CheckHold( Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight )
	{
		if ((item.ItemID != 5121) || //Kryss
			(item.ItemID != 3932) || //Mace
			(item.ItemID != 3938) || //Spear
			(item.ItemID != 5179) || //Maul
			(item.ItemID != 5123) || //ShortSpear
			(item.ItemID != 5177) || //WarHammer
			(item.ItemID != 5125) || //WarFork
			(item.ItemID != 5127)) //WarMace
		{return false;}
//		if ( !base.CheckHold( m, item, message, checkItems, plusItems, plusWeight ) )
//			return false;
//
//		if ( !BaseHouse.NewVendorSystem && Parent is PlayerVendor )
//		{
//			BaseHouse house = ((PlayerVendor)Parent).House;
//
//			if ( house != null && house.IsAosRules && !house.CheckAosStorage( 1 + item.TotalItems + plusItems ) )
//			{
//				if ( message )
//					m.SendLocalizedMessage( 1061839 ); // This action would exceed the secure storage limit of the house.
//
//				return false;
//			}
//		}
		else
		return true;
	}

		public BlacksmithVendorBackpack( Serial serial ) : base( serial ) {}
		public override void Serialize(GenericWriter writer ){base.Serialize(writer);}
		public override void Deserialize(GenericReader reader ){base.Deserialize(reader);}

	}


	public BlacksmithPlayerVendor( Mobile owner, BaseHouse house ) : base( owner, house )
	{
		if( Backpack != null && !Backpack.Deleted )
			Backpack.Delete();

		AddItem( new BlacksmithVendorBackpack() );
	}
	public BlacksmithPlayerVendor(Serial s):base(s){}
	public override void Serialize(GenericWriter writer ){base.Serialize(writer);}
	public override void Deserialize(GenericReader reader ){base.Deserialize(reader);}
}
 

Kenko

Page
quite obvious. If you want only items on your list to be dropped, then change your CheckHold to this:

Code:
        public override bool CheckHold( Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight )
            {
            if( ( item.ItemID != 5121 ) && //Kryss
                ( item.ItemID != 3932 ) && //Mace
                ( item.ItemID != 3938 ) && //Spear
                ( item.ItemID != 5179 ) && //Maul
                ( item.ItemID != 5123 ) && //ShortSpear
                ( item.ItemID != 5177 ) && //WarHammer
                ( item.ItemID != 5125 ) && //WarFork
                ( item.ItemID != 5127 ) )  //WarMace
                return false;

            if( !base.CheckHold( m, item, message, checkItems, plusItems, plusWeight ) )
                return false;

            if( !BaseHouse.NewVendorSystem && Parent is PlayerVendor )
                {
                BaseHouse house = ( (PlayerVendor)Parent ).House;

                if( house != null && house.IsAosRules && !house.CheckAosStorage( 1 + item.TotalItems + plusItems ) )
                    {
                    if( message )
                        m.SendLocalizedMessage( 1061839 ); // This action would exceed the secure storage limit of the house.

                    return false;
                    }
                }

            return true;
            }
else, if you want to drop anything BUT items on the list, try this one instead:
Code:
        public override bool CheckHold( Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight )
            {
            if( ( item.ItemID == 5121 ) || //Kryss
                ( item.ItemID == 3932 ) || //Mace
                ( item.ItemID == 3938 ) || //Spear
                ( item.ItemID == 5179 ) || //Maul
                ( item.ItemID == 5123 ) || //ShortSpear
                ( item.ItemID == 5177 ) || //WarHammer
                ( item.ItemID == 5125 ) || //WarFork
                ( item.ItemID == 5127 ) )  //WarMace
                return false;

            if( !base.CheckHold( m, item, message, checkItems, plusItems, plusWeight ) )
                return false;

            if( !BaseHouse.NewVendorSystem && Parent is PlayerVendor )
                {
                BaseHouse house = ( (PlayerVendor)Parent ).House;

                if( house != null && house.IsAosRules && !house.CheckAosStorage( 1 + item.TotalItems + plusItems ) )
                    {
                    if( message )
                        m.SendLocalizedMessage( 1061839 ); // This action would exceed the secure storage limit of the house.

                    return false;
                    }
                }

            return true;
            }
 
It works perfectly!! Thank you. My misunderstanding there was I thought the return values did the opposite of what they really do.

once again, thank you for your patience and help. I really really appreciate it, definetly couldnt have put this together without you.

Before I have any other questions about scripting, i'll make sure the answer isn't already in this post.

thank you thank you thank you :D
 
Top