so i want the usr to be able to buy different things from the shopkeeper depending on what has been bought and sold to it. this is what i have
Shop_Keeper
icon = 'people.dmi'
icon_state = "shop"
var/list/inventory = list(/obj/items/Healing_Herb, /obj/items/Magic_Potion)
verb
Buy()
set src in view(1)
var/obj/items/o = input("What would you like to buy?") in inventory
if(o:cost <= usr.gold)
o:loc = usr
usr.gold -= o:cost
else
usr << "ShopKeeper: That costs too much. It costs [o:cost]"
Sell()
set src in view(1)
var/obj/items/o = input("What would you like to sell?") in usr
o:loc = inventory
usr.gold += o:cost / 2
but im getting:
runtime error: Cannot read /obj/items/Healing_Herb (/obj/items/Healing_Herb).cost
proc name: Buy (/mob/Shop_Keeper/verb/Buy)
usr: Dark Weasel (/mob)
src: Shop Keeper (/mob/Shop_Keeper)
call stack:
Shop Keeper (/mob/Shop_Keeper): Buy()
when i try to buy something
Copyright © 2024 BYOND Software.
All rights reserved.
What that does is scroll through the inventory list when a new Shop_Keeper is made, then replaces the things it finds (paths) with a new object of the type.