bishou

Initiate
Is it possible to add (and how) a RecipeScroll to SBInfo? For example, add RecipeScroll(453) (Scrappers Compendium recipe).

Thanks!
 
Add( new GenericBuyInfo( typeof( InteriorDecorator ), 200, 20, 0xfc1, 0 ) ); You may have a different buy list some are generic some are array check that
200 is price
20 is amount
0xfc1 is the id or base number
0 is the hue
scroll down a little in SBVendor it will also have to be added there
Add( typeof( InteriorDecorator ), 100 ); not positive what the 100 is for here
these are examples from 1 of My vendors hope this helps some
 
One problem is if the constructor of the items takes some arguments, you won't be able to enter it by the way you suggested.
Ex: adding a runic hammer to a vendor would require some extra tweaks from what i remember, as you have to supply the resource.

Here's the GenericBuy script constructors:
Code:
public GenericBuyInfo(Type type, int price, int amount, int itemID, int hue) : this(null, type, price, amount, itemID, hue, null)
public GenericBuyInfo(string name, Type type, int price, int amount, int itemID, int hue) : this(name, type, price, amount, itemID, hue, null)
public GenericBuyInfo(Type type, int price, int amount, int itemID, int hue, object[] args)  : this(null, type, price, amount, itemID, hue, args)
public GenericBuyInfo(string name, Type type, int price, int amount, int itemID, int hue, object[] args)

From my quick reading, object[] args seems to be the arguments that you can pass in the entity creation, as seen here:
Code:
//get a new instance of an object (we just bought it)
public virtual IEntity GetEntity()
{
	if (this.m_Args == null || this.m_Args.Length == 0)
		return (IEntity)Activator.CreateInstance(this.m_Type);

	return (IEntity)Activator.CreateInstance(this.m_Type, this.m_Args);
}

All what you have to do is passing some additional arguments.
When you have a doubt, always search for the sources, that helps a lot.
 
Can you dumb it down for those of us that don't entirely understand objects, args, and sources.

How do we specify the recipe number?

Add( new GenericBuyInfo( typeof( RecipeScroll ???? ), 200, 20, 0x2831, 0 ) );
 
i believe it's: Add( new GenericBuyInfo( typeof( RecipeScroll (????) ), 200, 20, 0x2831, 0 )

replace the (???) with the recipe #

Type type, int price, int amount, int itemID, int hue

type = RecipeScroll
amount = 200 // total in stock at one time
itemid shown in the vendor gump = 0x2831
hue = you should know this one...
 
If you have difficulties with something, search the source or examples which do the same thing you want.
If you read my post you can see the third and fourth constructors for the GenericBuyInfo (which is what you add to the list of stuffs to buy).

Let's take the fourth one:
Code:
public GenericBuyInfo(string name, Type type, int price, int amount, int itemID, int hue, object[] args)

As i said, that "object[] args" is pretty much the parameters you enter in the constructor of RecipeScroll.
If you look at the constructor of RecipeScroll, you can see it accepts two things, either a Recipe object or an integer.
If we go by the integer way, we can get just send the recipe id there.

Here's a tested example.
Code:
this.Add(new GenericBuyInfo("display name", typeof(RecipeScroll), 100, 1, <whateveritemiditis>, 0, new object[] {500}));

You can find a similar thing in SBJewel.cs, if you want something easier to understand.

If you have troubles with coding, learn some coding.
Searching the source and googling everything you see is a good start.
 
i believe it's: Add( new GenericBuyInfo( typeof( RecipeScroll (????) ), 200, 20, 0x2831, 0 )

replace the (???) with the recipe #

Type type, int price, int amount, int itemID, int hue

type = RecipeScroll
amount = 200 // total in stock at one time
itemid shown in the vendor gump = 0x2831
hue = you should know this one...

I tried that and it didn't work, I will try what Pooka has posted below, thank you.
 
If you have difficulties with something, search the source or examples which do the same thing you want.
If you read my post you can see the third and fourth constructors for the GenericBuyInfo (which is what you add to the list of stuffs to buy).

Let's take the fourth one:
Code:
public GenericBuyInfo(string name, Type type, int price, int amount, int itemID, int hue, object[] args)

As i said, that "object[] args" is pretty much the parameters you enter in the constructor of RecipeScroll.
If you look at the constructor of RecipeScroll, you can see it accepts two things, either a Recipe object or an integer.
If we go by the integer way, we can get just send the recipe id there.

Here's a tested example.
Code:
this.Add(new GenericBuyInfo("display name", typeof(RecipeScroll), 100, 1, <whateveritemiditis>, 0, new object[] {500}));

You can find a similar thing in SBJewel.cs, if you want something easier to understand.

If you have troubles with coding, learn some coding.
Searching the source and googling everything you see is a good start.
too true, realized my error in trying to pass parameters to a type instead of an instance after submitting my post

type = class level of something, like you can say type is BaseCreature, but you can't really [add a basecreature straight forward can you?
instance = creating an object that can be seen or used in game

Add(new GenericBuyInfo("1060740", typeof(BroadcastCrystal), 68, 20, 0x1ED0, 0, new object[] { 500 })); // 500 charges
 
I lost nearly an hour gravitating around the solution and i just had to change my initial "new object[500]" to "new object[] {500}".
My C# is way too rusty... xD
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back