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!

Custom Vendors On The Fly

alambik

Sorceror
Custom Vendors On The Fly

Custom Vendors On The Fly
-UPDATED 20th Sep 2005-

Brief description:
This script allows to use customizable vendors. Those scripts allow:
- To choose which Item to sell simply by adding them in his backpack
- To make invisible bags of items sold by the vendor
- To allow a "Rate" of price for those items (items more expensive in a shop than another for example)
- To allow the player to sell to the vendor those items at 33% of the price

Instalation:
Compatibility: RunUO 36, RunUO 1.0 and above
First, correct the 2 bugs in Scripts/Mobiles/Vendors/GenericBuy.cs
Replace:
Code:
		public GenericBuyInfo( string name, Type type, int price, int amount, int itemID, int hue, object[] args )
		{
			amount = 20;
By:
Code:
		public GenericBuyInfo( string name, Type type, int price, int amount, int itemID, int hue, object[] args )
		{
			if (amount<1)
			amount = 20;
And replace this function:
Code:
		//get a new instance of an object (we just bought it)
		public virtual object GetObject()
		{
			if ( m_Args == null || m_Args.Length == 0 )
				return Activator.CreateInstance( m_Type );
 
			return Activator.CreateInstance( m_Type, m_Args );
			//return (Item)Activator.CreateInstance( m_Type );
		}

By this one:
Code:
		//get a new instance of an object (we just bought it)
		public virtual object GetObject()
		{
			object myObject;
 
			if ( m_Args == null || m_Args.Length == 0 )
				myObject=Activator.CreateInstance( m_Type );
			else
				myObject=Activator.CreateInstance( m_Type, m_Args );
 
			if ( m_Type == typeof(Item) )
			{
				((Item)myObject).ItemID=m_ItemID;
				((Item)myObject).Hue=m_Hue;
				/* Next line not well managed. Commented.*/
				/*((Item)myObject).Name=m_Name;*/
			}
 
			return myObject;
		}




Then just drag and drop scripts in your custom script folder


Usage:

1) Create a vendor:
[add MyVendor

2) Add a vendor bag (optional):
[add MyVendorBag
When opening it, it also proposes you to dupe it and all its containt (useful for having several set of bags for a kind of vendors)

3) Put the item you want to sell in this bag:
On each item, use the [props command to modify the value you want:
-Name: name of the object
-Amount: maximum amount of items allow to be sold
-Weight: price of one of this item
-Hue: hue of the sold object

3) Customize the Vendor:
Open the vendor backpack and put the vendor bag with the items in it.
A gump propose you to dupe the bag and all its containt eventually (useful when doing one bag per kind of vendor and wanting to dupe it)

4) Validate the changes:
You MUST double click again on the vendor to validate what you put in the backpack.

4) Customize the vendor rate (optional)
The vendor default rate is 1,0
That is to say that all item are sold at their normal price.
If you set the rate to 0,5 for example, all the items will be sold and bought at half of there defined price.
You can change this rate using [props command on the vendor and DOUBLE CLICK on the vendor to compute the new prices.

HOPE YOU'LL ENJOY!
 

Karavoc

Sorceror
Its the same file, The only difference is i edited the GenericBuy.cs so you don't have to. now just extrac into custom folder and remove old GenericBuy.cs runner and go. (Good job on this script btw)

NOTE:All credit for this script goes to the original scripter.
 

Attachments

  • Custom Vendor.zip
    5.6 KB · Views: 128

alambik

Sorceror
yes they do.

however, if you change the content of their bag, you have to double click the vendor to validate the changes.
 
Top