SYSEVENT_MERCHANT_SOLD?

Archive of the older Feature Request Forum Posts
Locked
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am

SYSEVENT_MERCHANT_SOLD?

Post by MontuZ »

Maybe another struct member that has a reference to all the items sold to the player?
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Post by Austin »

Im looking at it right now..

It looks like it would be best to move most of it to script side..
EVID_MERCHANT_SOLD is received by the npc (items the player selected from the gump)

Then with that event have .items which is an array
The array would cain a reference to the item, the cost, and the amount.
Cost and amount would be used for handling subtracting from a stack in the vendor's pack and adding to the player's pack.

.amount would remain to check right away if the player's has enough gold to save going through the items array.

Code: Select all

struct
.type - EVID_MERCHANT_SOLD
.amount - Total cost of everything
.purchases (array)
   [1] (struct)
     .item      - <APPOBJ:ITEM> (say a sword cause theyre pointy)
     .amount - 1
     .cost      - 65
   [2] (struct)
     .item      - a stack of 200 lockpicks
     .amount - 25
     .cost      - 16
   [3] (struct )
     .item      -  a pair of scissors (note: not stackable)
     .amount -  5
     .cost      - 80
For 1: you know you just need to move it because only 1 was purchased and the item in index 1 is the one selected and just take 65 gold from the player.

For 2: You know that the amount purchased (25) is less than the amount selected from .item. It is safe to subtract 25 from its amount, and add them to the player's pack, then take 16*25 gold from the player.

For 3: This is more difficult. The vendor had say 100 pairs of scissors for sale, but they are not stackable. The player purchased 5 of them.
You need to go through the forsale container and find 4 more items that match (this isnt gonna be done in the core anymore). Then subtract 80*5 gold from the player.
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am

Post by MontuZ »

Sounds badass.

Any word on CreateScript when an item is created in merchant inventory via CreateItemInInventory()?
Locked