ID:179680
 
1. I need a simple INNkeeper code example.
I already have a working shopkeeper, i just want to
know if it's almost the same.

2. Second, i want to make a treasure chest.
When you left click on it, you get the item
and when you try it again, you get a message
saying "chest is empty". I want everyone to be
able to get the item once.
Any examples, suggestions, faqs?

THX.



Ok for the inn keeper do what you would for a shop keeper
example:
mob/Bob
icon='Bob.dmi'
verb
Take_Nap(M as mob)
set src in oview(2)
switch(input("Would you like to sleep.")in list("Yes","No"))
if("Yes")
if(usr.Gold>=100)//Make sure you have a gold var
usr.Health+=usr.MaxHealth
usr.Gold-=100//This takes away 100 gold from the usr
usr<<"You feel refreshed
else
usr<<"You need more gold."
if("No")
usr<<"Well stop by again some day."
Make sure you have all the neccasary vars such as gold health and max health ok
and for the next one make an item in the chest and make a var called Chest1 or something like that if you want
then check to see if (usr.Chest1<=0)then let the guy get the item and if he gets it make his Chest1 go up to one so when he tries again he cant
Well i hope this helps at all
<FONT COLOR=RED> IF you have any question about this My AIM is The Raven1234323</FONT>
In response to Richter
Does it matter if "Bob" is a turf or a mob ?
Let's say i have a chair that speaks, should i leave him as a turf or make him a mob ?
In response to Cravens
Well i prefer a turf so he cant get killed
so i suggest you make him a turf or make him a god so he cant die
In response to Richter
Richter wrote:
Well i prefer a turf so he cant get killed
so i suggest you make him a turf or make him a god so he cant die

Duh!
If you don't attach code to the innkeeper to allow him to be killed, he can't be killed no matter what.
If all your mobs use HP and deathcheck code, you should include a simple flag to indicate whether the mob is a valid target for attack or not.

Lummox JR