stack items in Developer Help
|
|
ok! basically i got my shop working but items wont stack!!! if someone could help me would be great...
these are the obj codes
obj var Gprice=0 Sprice=0 Cprice=0 Amount=1
proc/price() if(usr.C < 0) usr.S-=1 usr.C+=100 if(usr.S < 0) usr.G-=1 usr.S+=100 if(usr.G ==0 ) view() <<"you need more gold!"
obj/weapon/
sword desc = "+5 power" icon = 'sword.dmi' Gprice=0 Sprice=5 Cprice=3 var
Aug=5
verb get() set src in oview() loc = usr suffix=desc drop() set src in usr loc = usr.loc
equip() if(usr.EquippedWeapon==0) src.name="sword" usr.EquippedWeapon=1 usr.pow +=src.Aug usr.Rage() view()<< "equipped [src.name]"
unequip() if(usr.EquippedWeapon==1) src.name="sword" usr.EquippedWeapon=0 usr.pow -=src.Aug view()<<"unequipped [src.name]"
|
ok so this is the shop code(not finished till stack works)
mob/shopkeeper
weapon_shop icon = 'shop.dmi' var/list/Inventory=list() old_town_man Inventory=list(new/obj/weapon/sword,new/obj/armor/) verb/Shop() set src in oview(1) while(1) switch(alert("What would you like to do?","Shopping","Buy","Sell","Cancel")) if("Cancel") return if("Buy") var/obj/O=input("What item would you like to buy?","Buying")as null|anything in Inventory if(!O) continue if(istype(O,/obj/weapon)) var/Quantity=input("How many would you like to buy?","Buying [O.name],[O.Gprice]G,[O.Sprice]S,[O.Cprice]")as null|num Quantity=round(abs(Quantity)) if(!Quantity||usr.G<O.Gprice*Quantity) continue O.price() usr.G-=O.Gprice*Quantity O.price() usr.S-=O.Sprice*Quantity O.price() usr.C-=O.Cprice*Quantity O.price() var/obj/N=locate(O.type) in usr.contents if(N) N.Amount+=Quantity else N=new O.type N.Amount=Quantity usr.contents+=N usr<<"Old Man: Thank you!" return
|
and in my stats i have the following inventory: statpanel("inventory",usr.contents)...so if you can help thank you and if you need more just ask ill add but this is what seemed significant
|