obj
var
Shop = null
list/wares = new(obj,obj.value)
obj/WeaponMan
icon = 'pics/person.dmi'
icon_state = "Merchant"
density = 1
Shop = 1
wares = newlist(/obj/equipable/armor/clothes,10)
Click()
if(Shop==null)
return
else
switch(input("Would you like to Buy or Sell?")in list("Buy","Sell","Cancel"))
if("Buy")
Buy()
if("Sell")
Sell()
if("Cancel")
return
proc/Buy(var/o in wares(onj,obj.value))
set src in oview(2)
switch(input("[src]: Hello, what would you like?")in list(wares,"Cancel"))
if("Cancel")
return
else
if(usr.Gold >= wares.value)
usr.Gold -= wares.value
new/wares(usr)
proc/Sell(var/obj/O in usr
set src in oview(2)
switch(alert("[src]: Are you sure you want to sell [O] for [O.value] gold?","Selling","Yes","No"))
if("Yes")
usr.Gold += O.value //
del(O)
Problem description:
I'm trying to make it so if i set a NPC's var Shop to 1 then, if clicked on, it brings up the shopping procs. I also want the wares that the NPC is to be selling defined in the var wares. Might anyone help me or offer suggestions of what to do?
/obj/NPC/Weapon_Guy sellist=list(/obj/sword,/obj/shield)
Then let them choose what to buy, thus
var/obj/a = input("Buy what?") in src.sellist