ID:178495
 
I am not able to make it so you need gold but i am able to make u get it free. how do i add in my code that i need gold to buy a item. Here is my code:
mob
Townsmen8
typechar = "ShopKeeper"
name = "SHOPBOY2K"
var/obj/armor/BasicArmor/F
verb
speak()
set src in oview(1)
switch(input("What do u want","weapons") in list("Basic Armor", "Metal Armor"))
if("Basic Armor")
switch(input("Are you sure","weapons") in list("yes","no"))
if("yes")
new/obj/armor/BasicArmor(usr)
if("no")
return
if("Metal Armor")
switch(input("Are you sure you want Metal Armor","weapons") in list("Yes","no"))
if("Yes")
new/obj/armor/MetalArmor(usr)
if("no")
return
icon = 'Townsman1.dmi'

Well thats not exactly how it looks but i bet u can picture it please help
Thank you
AceTheElvenKing

Ace2064 wrote:
I am not able to make it so you need gold but i am able to make u get it free. how do i add in my code that i need gold to buy a item. Here is my code:
mob
Townsmen8
typechar = "ShopKeeper"
name = "SHOPBOY2K"
var/obj/armor/BasicArmor/F
verb
speak()
set src in oview(1)
switch(input("What do u want","weapons") in list("Basic Armor", "Metal Armor"))
if("Basic Armor")
switch(input("Are you sure","weapons") in list("yes","no"))
if("yes")
if(usr.gold >= price) usr.gold -= price
new/obj/armor/BasicArmor(usr)
else
usr<<"You do not have enough gold"
if("no")
return
if("Metal Armor")
switch(input("Are you sure you want Metal Armor","weapons") in list("Yes","no"))
if("Yes")
if(usr.gold >= price) usr.gold -= price
new/obj/armor/BasicArmor(usr)
else
usr<<"You do not have enough gold"> if("no")
return
icon = 'Townsman1.dmi'

Well thats not exactly how it looks but i bet u can picture it please help
Thank you
AceTheElvenKing

I think thats right
price being the items cost
~Verm~
In response to Vermolius
erghh... thats not in the right order
if(usr.gold >= price)
usr.gold -= price
new/obj/armor/BasicArmor(usr)
else
usr<<"You do not have enough gold"

should be like that