SphereCommunity

Full Version: Vendor Shop HELP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey guys, I'm thinking to remake how vendors will buy and sell items.
I'm planning to vendors sell only basic things, and the other things would be sold by players.
But, I want to vendors to buy some items, like blacksmiths buy plates and weapons from players and sell them.

I just want to know how to store the sold item on vendor and show them in the sell gump.
Is that possible?


I find 3 vendor box at the npc, one holding nothing, one holding the items that he will sell and one holding items that he will buy.

But these last 2 boxes have lots of items...
Looking at provisioner, the sell one have around 46 items and the buy one have around 176 items!
In a shard with lots of vendors this is a great item storage...
Just they are useless.

Another thing, can I read the items list from buy/sell templates?

Thanks!
Yes you can. in speak_shopkeep.scp you will see a ON=BUY and ON=SELL trigger in there, those 2 are used to trigger BUY and SELL on vendors. Before BUY and SELL you can add/read/remove items in layers 26,27,28 - these layers are vendor boxes. You can see which layer is for sell, buy and sold in sphere_defs.scp

You can simply use 'forcont <findlayer.27>' as an example to list through the items in layer 27, or add new items using serv.newitem and new.cont=<findlayer.27>. These are 2 examples you can work with. I'm sure you can find more to do with these layers and the speech file.

Good luck!
Thanks Skul I will work on it later.
Okay, thats my tests.

I add an event to my player, E_AI_VENDOR, just to test.
PHP Code:
ON=@ITEMSELL
// ACT = ITEM BEING SOLD
// I = WHO IS SELLING THE ITEM
// ARGO = THE VENDOR THAT IS BUYING THE ITEM
ACT.ATTR |= ATTR_FORSALE
ACT
.CONT <ARGO.FINDLAYER.27
Well, it isn't working :/

When I place the item into vendor's vendor box ( layer 27 ), it appear on buy list but don't have value... and when I close the buy list, the item disappear...
try:
Code:
act.cont=<uid.<argo.uid>.findlayer.27>
argo.xx props have a hard time handling functions, although reading a value from argo as an object works fine.
Hmm will try it out.

Edit: Don't work!
It just don't go to vendor's layer... its sucks!
I know why, same problem I ran into earlier, layer 27 does not exist, therefore no layer to place the object in.
Code:
on=@itemsell
if !(<argo.findlayer.27>)
  serv.newitem=i_vendorbox
  new.layer=27
  new.cont=<argo.uid>
endif
act.attr |= attr_forsale //this is really used for player vendors, be sure to remove it with @itembuy, it may cause some unwanted behavior.
act.cont=<argo.findlayer.27>
I set RETURN 1 and the item don't get removed.
But the Sell List don't close.
interesting, return 1 stops most of the default behavior and if you don't halt default behavior then the item is not sent to the layer... I'm guessing:
Code:
act.timerf 1 cont=<argo.findlayer.27>
will do the trick, but it's not the most 'efficient' way to do it, considering the fact a player can prompt the 'buy' list before the timer expires... Is there a reason you want to toss the sold items into layer 27? Seeing as vendors have layers buy, sell, and bought. Why toss it into a seperate layer if it's sold by a player?

On my server i had to toss items 'for sale' by default into the 'items bought' layer to be sold back to players because of the item limit sphere has on the layer.

What is the purpose of tossing the items into layer 27?
How I would love some new features on buy/sell system...
Maybe it should be remade...

@Skul
I'm not aiming the layer 27.
I just want to the items sold by players to vendors, the vendors keep them to sell for other players...
Pages: 1 2
Reference URL's