mob/NPC/Shopkeeper
icon = 'Character Icons.dmi'
icon_state = "Shopkeeper"
density = 1
var/TagSave = 1
New()
for(var/obj/items/A)
contents += new A
Click()
if(src in oview(4))
switch(alert("Hello! Welcome to our shop, would you like to buy anything?","Shopkeeper","Buy","Sell","Leave"))
if("Buy")
var/obj/R = input(usr,"What would you like to buy?")in src.contents
switch(alert("Will you buy [R.name] for [R.price]?","Shopkeeper","Yes","No"))
if("Yes")
if(R.price == null)return
if(usr.G >= R.price)
usr.G -= R.price
usr<<"You have obtained [R]!"
new R(usr.contents)
else
usr<<"You do not have enough G for this."
if("Sell")
if(usr.contents==list())
usr<<"{NPC}[src] says: You have nothing to sell!"
return
var/obj/items/R = input(usr,"What would you like to buy?")in src.contents
if(R.name == "Cancel")
return
if(R.equipped == 1)
return
if(R.price == null)return
var/SellingPrice = R.price/2
switch(alert("Will you sell [R.name] for [SellingPrice]?","Shopkeeper","Yes","No"))
if("Yes")
usr.G += SellingPrice
R.loc=src
usr<<"You have sold [R]!"
ID:268656
Oct 3 2004, 4:27 am (Edited on Oct 3 2004, 4:35 am)
|
|
Oct 3 2004, 4:34 am
|
|
Excellent post.
|
In response to DeathAwaitsU
|
|
Had to edit it
|
Vash_616 wrote:
> mob/NPC/Shopkeeper I Want it su wen i goto sell item and i have no item he sais Just a guess, but try putting: if(usr.contents==null instead of if(usr.contents==list()) propably wont work, but worth a try. Also, how come the spelling in your code is good but the spelling in you posts is terrible? |
In response to Smoko
|
|
Spelling is bad cus i am learning from a demo and i want to test sumthing.
|
In response to Vash_616
|
|
Vash_616 wrote:
Spelling is bad cus i am learning from a demo and i want to test sumthing. wtf? Learning from a demo makes your spelling bad? |