ID:161946
 
Does anyone knw how to mae a basic Inventory?

Here's what I have so far,

mob/var
contents
weapons
armor

statpanel("Weapons and Armor")
stat(usr.weapons)
stat(usr.armor)
statpanel("Inventory")
stat(usr.contents)

//The normal stuff now for an object.

obj/Potion
name = "Potion"
desc = "Heals up to 20-30 HP."
icon = 'potion.gif'


How would I have it so that when a usr buys that item, it get puts into the Statpanel labeled "Inventory", do you put addtypesof+=verbs or something or what?
contents is pre-defined, very special variable. You don't need to declare it yourself, and it should throw up an error if you do. All you need to do to show somebody's contents is:

mob/Stat()
statpanel("Inventory", contents)


Look up statpanel() and Stat() in the reference.

To add an itme to a player's contents, you just need to move it into the player, or create it right in their contents.

object.Move(player) //I suggest using this
object.loc = player
new objecttype(player)
In response to Garthor
And look up src setting in the DM F1 help. In other words, if you put a verb on the object you will be able to use the verb when it is in your inventory.
In response to Traztx
Traztx wrote:
And look up src setting in the DM F1 help. In other words, if you put a verb on the object you will be able to use the verb when it is in your inventory.






mob/Stat()
stat("Name:",src.name)
stat("Gold:",src.gold)
stat("Level:",src.level)
stat("Health:","[usr.HP]/[usr.MHP]")
stat("Magic:","[usr.MP]/[usr.MMP]")
stat("Strength:",usr.Str)
stat("Experience:","[usr.Exp]/[usr.Mexp]")
statpanel("Inventory")
stat("", contents)