ID:170456
 
can anyone help?

I need to make a shop keeper where I can make it so people have to pay to get stuff.
obj
Shopkeep
verb
BuyDeath()
set src in oview(1)
if(usr.Money>=5)
usr.Money-=5
usr<<"Death Comes"
del usr
In response to Artekia
nice, but I need to have it so when you click on a mob a window appears adn you can select what you want to buy.
In response to Artekia
Artekia wrote:
> obj
> Shopkeep
> verb
> BuyDeath()
> set src in oview(1)
> if(usr.Money>=5)
> usr.Money-=5
> usr<<"Death Comes"
> del usr

Rather odd example... Here's mine:
mob
Shopkeeper
verb
Buy()
set src in oview(2)
switch(input("What do you want to buy?")in list("obj1","obj2"))
if("obj1")
if(src.gold>=5)
src<<"You buy obj1!"
var/obj/I = new /obj/obj1
src.contents+=I
if("obj2")
if(src.gold>=10)
src<<"You buy obj2!"
var/obj/I = new /obj/obj2
src.contents+=I

there's more than one way of course, and depending on how you have your game laid out that might not even work. (src maybe should be usr, I'll have to check my notes..."
In response to Jamesburrow
alright thanks, that is just what I wanted.
In response to Hobble
obj
Shopkeep()
var/list/Items=list("Food")
Click()
Shop(usr,src)

proc/Shop(mob/M,obj/O)
var/A = input("What do you want to buy?")in O.Items
if(M.Money>=5)
M.Money-=5
M<<"The food was poisoned!"
del M
In response to Artekia
Artekia wrote:
> obj
> Shopkeep()
> var/list/Items=list("Food")
> Click()
> Shop(usr,src)
>
> proc/Shop(mob/M,obj/O)
> var/A = input("What do you want to buy?")in O.Items
> if(M.Money>=5)
> M.Money-=5
> M<<"The food was poisoned!"
> del M

Do you just have a thing with making objects that kill the buyers?
In response to Hobble
Wait.. didn't you just say you wanted to have to click the mob? Oh and most of the srcs in there should be usr.

In that case src = the shopkeep and usr = the player using the verb.
In response to Artekia
Artekia wrote:
> obj
> Shopkeep()
> var/list/Items=list("Food")
> Click()
> Shop(usr,src)
>
> proc/Shop(mob/M,obj/O)
> var/A = input("What do you want to buy?")in O.Items
> if(M.Money>=5)
> M.Money-=5
> M<<"The food was poisoned!"
> del M


Actually, that should be

<dm>obj
Shopkeep()
var/list/Items=list("Food")
Click()
Shop(usr,src)

proc/Shop(mob/M,obj/O)
var/A = input(src,"What do you want to buy?")in O.Items // Input defaults to usr =P
if(M.Money>=5)
M.Money-=5
M<<"The food was poisoned!"
del M
In response to Artekia
Artekia wrote:
Wait.. didn't you just say you wanted to have to click the mob? Oh and most of the srcs in there should be usr.

I said I thought so... besides, you can get that by clicking the mob. All you have to do is right click and there you go :P
In response to N1ghtW1ng
Actually you made a mistake, correcting my mistake. That is just a regular old proc so I don't think src refers to anything. It should be M.
In response to Artekia
She's right ya know...
In response to Jamesburrow
.....She? I sooooo hate that damn a at the end of my name.
In response to Artekia
Artekia wrote:
.....She? I sooooo hate that damn a at the end of my name.

ooops! I guess ur a guy then, huh? really, that 'a' does give the wrong impression...
In response to Artekia
Whoops, didn't see mob/M =P