ID:270631
 
can somoone post the code to make a inventory item
One is basically built-in. Use usr.contents += [something] and usr.contents -= [something] to add things to and take things from the mob's inventory, respectively. To display it, create a stat panel containing src.contents.

Note that creating a seperate one from scratch would also not be difficult: Simply create a list (var/list/MyInv = new) and use the same operators.


--Vito
In response to Vito Stolidus
Vito Stolidus wrote:
Note that creating a seperate one from scratch would also not be difficult

That is true. i made a inventory that appears on a client's screen when they click on a verb.

In response to Flame48

how do i make this so it asks how much points you want to use


            switch(input(src,"Distribute Points","[src.points] Points left",text) in list ("Health","Strength","Chakra","Defense","Speed","Stamina","Save for later"))
if("Health")
if(src.points<=0)
src.points=0
return
else
src.maxhealth++
src.points--
if("Strength")
if(src.points<=0)
src.points=0
return
else
src.atkstr++
src.points--
if("Chakra")
if(src.points<=0)
src.points=0
return
else
src.maxchakra++
src.points--
if("Defense")
if(src.points<=0)
src.points=0
return
else
src.Def++
src.points--
if("Speed")
if(src.points<=0)
src.points=0
return
else
src.speed++
src.points--
if("Stamina")
if(src.points<=0)
src.points=0
return
else
src.maxstam++
src.points--
if("Save for later")
return 0
goto start<dm>
Supper yugi wrote:
can somoone post the code to make a inventory item

mob/Stat()
..()
statpanel("Inventory")
stat(src.contents)


Ask for asking how much to distribute:
switch(input("Which skill do you want to put points into?","Choose skill") in list("skill1","skill2","skill3")) //asks which skill
if("skill1")
var/AM = input("How many points?","Points") as num | null//asks how much to put in as a number
if(!AM) return //if the number is 0 or null, stop the proc
src.skill1 += AM //add the points
src.points -= AM //subtract the points from the amount you have left


DO NOT COPY PASTE THIS! This is just a quick example of how you can distribute them.