Simple /sell skript that lowers value of items that are sold frequently

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Status
Not open for further replies.

Mightor

Member
May 16, 2019
1
0
0
25
Hello! So I'm looking for a simple /sell skript let me describe it a bit.

So the user does /sell:
- It will then check if the item in the player's hand is in a list of sellable items (maybe make this a text document I can edit or just like a /sell additem <item> or something cause I basically want to just be able to sell crops etc sugarcane, melons, etc.
- Ok so if the item is sellable it will tell me the value of the item and the amount of $ I would get from selling my whole inventory worth and then I just left click with the item to confirm the sale and sell all of that item in the players inventory and award them money (I have vault and EssentialsEconomy).

- The kicker here is then I want it to add the amount sold to a variable so like the variables will look like this. This will be the amount of each item sold for each player.

Mightor:
itemname : # sold
sugarcane: 1200
melon: 100
wheat: 240
total sold of all items: 1540

and then when they go to /sell next time I want the price to be adjusted so if they've sold a lot of that item and very little of other items it will reward very little money. Formula for prices would be like this:

Price = 1 - (# of that item / # of total items)

so like the value of sugarcane now is
Price = 1 - 1200/1540
or
Price = .22

so next time I go to /sell I only get $.22 / sugarcane. This will force me to not just farm and sell 1 item but make a new farm every once and a while because the value of that new item will now be worth a lot more so its worth my time to make a new farm for that item.

Please let me know if you could skript this for me. In 1.13.2! Thanks!
 
Status
Not open for further replies.