ID:139105
 
Code:
    Item_Seller
icon_state="Item Seller"
verb
Shop()
set src in oview(1)
var/list/ItemList=list("Restore"=300,"Beam"=500,"torch"=50,"Nothing"=0) //The item name and price
var/Item2Buy=input("What can I get for you today?","Item Seller") as anything in ItemList //they pick an item
var/Price=ItemList[Item2Buy] //this gets the price based on the list
if(Price) //if it has no price you cant buy it!
if(usr.Gold<Price)
usr<<"You need [ItemList[Item2Buy]] gold! You only have [usr.Gold]!"
else
usr<<"You Buy a [Item2Buy]"
var/obj/NewItem="/obj/[Item2Buy]" //note: this only sells items of the obj/Items/ path
NewItem=new NewItem //creates the actual object
usr.contents+=NewItem//add it to both their contents and Items list
usr.Gold-=Price
usr<<"Item Seller: Come again!"

obj
var
ammount
oname
proc
add_item(var/obj/item,var/mob/player)

obj
verb
get()
set src in oview(1)
usr<<"You picked up an [src]"
var/counter=0
switch(src.oname)
if("torch")
for(var/obj/Items/torch/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/torch/O in usr.contents)
O.ammount+=src.ammount
O.name= "[O.oname] ([O.ammount])"
del(src)
if("Restore")
for(var/obj/Items/Scrolls/Restore/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/Scrolls/Restore/O in usr.contents)
O.ammount+=src.ammount
O.name= "[O.oname] ([O.ammount])"
del(src)
if("Beam")
for(var/obj/Items/Scrolls/Beam/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/Scrolls/Beam/O in usr.contents)
O.ammount+=src.ammount
O.name= "[O.oname] ([O.ammount])"
del(src)

bj
Items
torch
icon='torch.dmi'
icon_state="Unlit"
luminosity=0
ammount=1
oname="torch"
verb/light()
set src in usr
icon_state="Lit"
luminosity=2
usr.see_in_dark=3
usr<<"You light the [src]"
sleep(900)
usr.see_in_dark=1
var/give=1
if(src.ammount>=1)
usr<<"[src] is used up"
src.ammount-=give
src.name="[src.oname] ([src.ammount])"
if(src.ammount<=0) // if you have less then one torch delete stack
del(src)

Scrolls
Restore //20hp/mp
name="Restore Scroll"
icon='scroll.dmi'
icon_state="Healing1"
ammount=1
oname="Restore"
verb/cast()
set src in usr
if(usr.BasicSkillUse(src))
view()<<sound('restore.wav',volume=20)
usr.HP+=20
if(usr.HP>=usr.MaxHP) usr.HP=usr.MaxHP
usr<<"You gain 20 Health and Mana from the [src]!"
if(usr.BasicSkillUse(src))
usr.MP+=20
if(usr.MP>=usr.MaxMP) usr.MP=usr.MaxMP
var/give=1
if(src.ammount>=1)
usr<<"[src] is used up"
src.ammount-=give
src.name="[src.oname] ([src.ammount])"
if(src.ammount<=0)
del(src)



Problem description:Can anybody plz help me to fix this code to let my
item seller npc sell me multiple items and stack them?

runtime error: Cannot create objects of type null.
proc name: Shop (/mob/NPCs/Item_Seller/verb/Shop)
source file: NPCs.dm,67
usr: Bordakius (/mob)
src: Item Seller (/mob/NPCs/Item_Seller)
call stack:
Item Seller (/mob/NPCs/Item_Seller): Shop()
You Buy a Beam

this is what happens when i try to buy any of the items from the seller, it doesnt give me the item and i get the following error.
heres all the code for it all :) any help/code fix's greatly appreciated!!! :D


Where is the Beam code?
In response to Lugia319
Heres the beam code and all..

 obj/Items
torch
icon='torch.dmi'
icon_state="Unlit"
luminosity=0
ammount=1
oname="torch"
verb/light()
set src in usr
icon_state="Lit"
luminosity=2
usr.see_in_dark=3
usr<<"You light the [src]"
sleep(900)
usr.see_in_dark=1
var/give=1
if(src.ammount>=1)
usr<<"[src] is used up"
src.ammount-=give
src.name="[src.oname] ([src.ammount])"
if(src.ammount<=0) // if you have less then one torch delete stack
del(src)

Scrolls
Restore //20hp/mp
name="Restore Scroll"
icon='scroll.dmi'
icon_state="Healing1"
ammount=1
oname="Restore"
verb/cast()
set src in usr
if(usr.BasicSkillUse(src))
view()<<sound('restore.wav',volume=20)
usr.HP+=20
if(usr.HP>=usr.MaxHP) usr.HP=usr.MaxHP
usr<<"You gain 20 Health and Mana from the [src]!"
if(usr.BasicSkillUse(src))
usr.MP+=20
if(usr.MP>=usr.MaxMP) usr.MP=usr.MaxMP
var/give=1
if(src.ammount>=1)
usr<<"[src] is used up"
src.ammount-=give
src.name="[src.oname] ([src.ammount])"
if(src.ammount<=0)
del(src)
Greater_Restore
name="Greater Restore Scroll"
icon='scroll.dmi'
icon_state="Healing2"
ammount=1
oname="Greater_Restore"
verb/cast()
set src in usr
if(usr.BasicSkillUse(src))
view()<<sound('restore.wav',volume=20)
usr.HP+=100
if(usr.HP>=usr.MaxHP) usr.HP=usr.MaxHP
usr<<"You gain 100 Health and Mana from the [src]!"
if(usr.BasicSkillUse(src))
usr.MP+=100
if(usr.MP>=usr.MaxMP) usr.MP=usr.MaxMP
var/give=1
if(src.ammount>=1)
usr<<"[src] is used up"
src.ammount-=give
src.name="[src.oname] ([src.ammount])"
if(src.ammount<=0)
del(src)

Beam
icon='scroll.dmi'
icon_state="attack1"
oname="Beam"
ammount=1
verb/Beam()
set category="Skills"
if(usr.BasicSkillUse(src))
var/damage=round(usr.MaxMP/2)
damage+=rand(-10,1)
usr.Projectile("[src.name]",damage)
view()<<sound('beam.wav',volume=20)
var/give=1
if(src.ammount>=1)
usr<<"[src] is used up"
src.ammount-=give
src.name="[src.oname] ([src.ammount])"
if(src.ammount<=0)
del(src)
Greater_Beam
icon='scroll.dmi'
icon_state="attack2"
oname="Greater_Beam"
ammount=1
verb/Beam()
set src in usr
set category="Skills"
if(usr.BasicSkillUse(src))
var/damage=round(usr.MaxMP*2)
damage+=rand(-10,100)
usr.Projectile("[src.name]",damage)
view()<<sound('beam.wav',volume=20)
var/give=1
if(src.ammount>=1)
usr<<"[src] is used up"
src.ammount-=give
src.name="[src.oname] ([src.ammount])"
if(src.ammount<=0)
del(src)


obj/var
ammount
oname



obj
verb
get()
set src in oview(1)
usr<<"You picked up an [src]"
var/counter=0
switch(src.oname)
if("torch")
for(var/obj/Items/torch/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/torch/O in usr.contents)
O.ammount+=src.ammount
O.name= "[O.oname] ([O.ammount])"
del(src)
if("Restore")
for(var/obj/Items/Scrolls/Restore/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/Scrolls/Restore/O in usr.contents)
O.ammount+=src.ammount
O.name= "[O.oname] ([O.ammount])"
del(src)
if("Beam")
for(var/obj/Items/Scrolls/Beam/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/Scrolls/Beam/O in usr.contents)
O.ammount+=src.ammount
O.name= "[O.oname] ([O.ammount])"
del(src)
if("Greater_Beam")
for(var/obj/Items/Scrolls/Greater_Beam/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/Scrolls/Greater_Beam/O in usr.contents)
O.ammount+=src.ammount
O.name="[O.oname] ([O.ammount])"
del(src)
if("Greater_Restore")
for(var/obj/Items/Scrolls/Greater_Restore/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/Scrolls/Greater_Restore/O in usr.contents)
O.ammount+=src.ammount
O.name= "[O.oname] ([O.ammount])"
del(src)


mob/NPCs
icon='NPCs.dmi'
New()
src.AddName()
return
Item_Seller
icon_state="Item Seller"
verb
Shop()
set src in oview(1)
var/list/ItemList=list("Restore"=300,"Beam"=500,"torch"=50,"Nothing"=0) //The item name and price
var/Item2Buy=input("What can I get for you today?","Item Seller") as anything in ItemList //they pick an item
var/Price=ItemList[Item2Buy] //this gets the price based on the list
if(Price) //if it has no price you cant buy it!
if(usr.Gold<Price)
usr<<"You need [ItemList[Item2Buy]] gold! You only have [usr.Gold]!"
else
usr<<"You Buy a [Item2Buy]"
var/obj/NewItem="/obj/[Item2Buy]" //note: this only sells items of the obj/Items/ path
NewItem=new NewItem //creates the actual object
usr.contents+=NewItem//add it to both their contents and Items list
usr.Gold-=Price
usr<<"Item Seller: Come again!"


mob/proc/BasicSkillUse(var/obj) //since we do an MP check on all skills anyway, lets put it into a proc
if(src.MP<=MaxMP) //checks if you have enough MP to use the skill
src.MP-=10 //take the MP from the user
return 1 //return a 1 to let them use the skill
else
src<<"Not Enough MP!"
return 0 //if they dont have enough MP dont let them use the skill


obj/Supplemental
Projectile //this will be modded to make up any projectile attacks!
density=1 //make sure it can actualy hit stuff!
var/mob/Owner //somebody had to shoot it right?
var/damage //and we want it to actualy hurt stuff eh?
icon='Projectiles.dmi' //setup its icon
New()
spawn(100) del src //this will automaticaly delete it after 10 seconds, if its still around
Bump(mob/M)
if(ismob(M))
if(src.Owner) //make sure it has an owner! otherwise dont bother
M.HP-=src.damage
M.DamageShow(damage,200,0,0) //flashes the damage on the screen
M.DeathCheck(src.Owner)
del src //delete it after it hits something

mob/proc/Projectile(var/IS,var/damage) //the arguments inside the () allow us to easily customize the proc
//The Icon States for this proc are Kept in Projectiles.dmi
//Simply add a new icon state and name it to match the skill and youre good to go!
var/obj/Supplemental/Projectile/P=new() //first we'll make a new projectile
P.icon_state=IS //this sets the icon state to whatever we need
P.damage=damage //this will set up the damage that we passed in through the arguments
P.Owner=src //set its owner to the person that shot it
P.dir=src.dir //make it face the same direction as the attacker
P.loc=src.loc //locate it on the player
walk(P,src.dir) //this will get P moving in the direction u shot it


Theres all the code i can possibly think to give to solve this.i think maybe my get verb is pretty noobish like this?.. also with the beam and greater beam... the projectile doesnt show up it just does the dmg and the sound any ideas on that after the darn npc problem? :D
In response to Bordakius
 var/obj/NewItem="/obj/[Item2Buy]"  //note: this only sells items of the obj/Items/ path


lol well thats why it was giving me those runtime errors!
i needed:
 var/obj/NewItem="/obj/Items/[Item2Buy]"


now i do get ONE item but it still does not join the stack i already have! and i still cannot for the life of me figure out how to buy more then just ONE :(
thats basically my games only problem right this moment... (and my beam graphic doesnt show up)

if anybody can help me out with this a bit id be very grateful!

-tnx in advance!
Bordakius

In response to Bordakius
*sigh* It would help if you didn't write your code so similar to Falacy.

At any rate, my guess is that the new object that you're trying to create via Shopcode is being read as a text string rather than a path. Thus, new object is a text string, and not a path. And text strings do not have New()
In response to Bordakius
To stack items, check for how many are in your contents, compile them into 1, and add a suffix of how many are in your contents.

Edit: One final note. Please do not try to use Falacy's code as a substitute for your own. It will save you a lot of hassle to come up with your own Shop proc (that could be very similar to his) that will handle all of the business it has to in your game, than to modify his to suit your needs. It's a guide, it's not meant to be used. That's not to say you can't use his code to test your own stuff!
In response to Lugia319
yerp yerp im not like tryin to make any kind of game for any1 im just using a bunch of stuff n learning as i go along n start to use stuff n fix it to my own needs and falacy's stuff was basically what taught me the LITTLE i know while i trudge thru the DM guide n whatnot :P

ill try to figure out what exactly u meant by the new object strings n try to fix what i got but if not ill keep readin n jus do it mahself!

any examples of code at all i could use that i wouldnt have to greatly change anything ive got would b wooonderful though! as i said im just using this to learn enough so i can just start writing all of it myself! :D

EDIT: lol if u could just show me how i would set up the check for the contents so the stuff will stack i just have no clue where or what to put...(i think my whole get verb and npc shop has to go cuz i just dont understand it like this lol)
In response to Bordakius
"this is a text string"

/this/is/a/type/path

new() only works with type paths because type paths have the New() proc

as for the code you're trying to use, I'd probably try something like this.

mob
proc
CompressItem(var/obj/X) // Compresses the Item (X is a type path)
var/Y = 0 // Define Y to be 0
for(X in src.contents) // For every instance of X in src.contents
Y = X.suffix // Y = The amount of X in contents.
Y ++ // Add 1 to account for the new object you're adding
src.Amount = Y // Set src.Amount equal to Y
if(Y > 1) // If there is more than 1 object Y in src.contents)
del(X) // Delete the object X in src.contents
var/obj/Z = new X(Y) // Define Z to be a New instance of X with arg
src.contents += Z
Z.suffix = Z.Amount
else // If(Y <= 0)
del(X) // Delete the object

obj
var
Amount // Ammount

proc // Obj procs
Use() // Use
return

Apple
Use()
if(src.Amount > 1) // If there is more than 1 left
src.Amount -= 2 // Subtract 2 to account for the fact that I'm going to add 1 in the CompressItem
usr.Hp += 10 // Add Hp
usr.CompressItem(src) // Compresses the item again
else // If(src.Amount <= 1)
usr.Hp += 10 // Add Hp
del(src in usr.contents) // Delete the object


EDIT: Added the code

I've left tons of comments but if you have any questions, just page me. If my code is retarded, no doubt Garthor or someone will come in and tell you the proper way.

In response to Lugia319
the item seller still just gives me one thing and it still wont add it to my stack in my contents.... : /

can anybody show me where i went wrong/how to get it to let me input an amount of the obj i want and then stack it in my contents for me?

cuz i just cant figure out where to put the code you gave me so it allows the item seller to sell me amounts of my stackable objs.... Plzzzzzz heelp me to understand what to do!!! (ill even scrap my whole npc item seller)! just as long as sum1 helps me make a new one that will work with my code! :D
In response to Bordakius
I gave you the code. When you buy something you want it to call CompressItem(Item you are compressing)

In my example if you wanted to compress Apples in inventory you call usr.CompressItem(src) in the Use() proc in Apple.
In response to Lugia319
lol ive tried to put the code you gave me into mine i just cant figure out WHERE... when i put it in the item seller i get errors(dont think im putting it in the right place)?

could u just possibly show me what my item sellers code should look like? :D (heres what it is now)

 mob/NPCs
icon='NPCs.dmi'
New()
src.AddName()
return
Item_Seller
icon_state="Item Seller"
verb
Shop()
set src in oview(1)
var/list/ItemList=list("Potion"=200,"ManaPotion"=300,"Regen"=2000,"Restore"=600,"Beam"=500,"torch"=50,"Nothing"=0) //The item name and price
var/Item2Buy=input("What can I get for you today?","Item Seller") as anything in ItemList //they pick an item
var/Price=ItemList[Item2Buy] //this gets the price based on the list
if(Price) //if it has no price you cant buy it!
if(usr.Gold<Price)
usr<<"You need [ItemList[Item2Buy]] gold! You only have [usr.Gold]!"
else
usr<<"You Buy a [Item2Buy]"
var/obj/NewItem="/obj/Items/[Item2Buy]"
NewItem=new NewItem //creates the actual object
usr.contents+=NewItem//add it to both their contents and Items list"
usr.Gold-=Price
usr<<"Item Seller: Come again!"


lol learning by example FTW! xD
In response to Bordakius
You must need to add a line that calls CompressItem() at the end when you actually buy the item. That's it.
In response to Lugia319
Lugia319 wrote:
You must need to add a line that calls CompressItem() at the end when you actually buy the item. That's it.

mob/NPCs
icon='NPCs.dmi'
New()
src.AddName()
return
Item_Seller
icon_state="Item Seller"
verb
Shop()
set src in oview(1)
var/list/ItemList=list("Potion"=200,"ManaPotion"=300,"Regen"=2000,"Restore"=600,"Beam"=500,"torch"=50,"Nothing"=0) //The item name and price
var/Item2Buy=input("What can I get for you today?","Item Seller") as anything in ItemList //they pick an item
var/Price=ItemList[Item2Buy] //this gets the price based on the list
if(Price) //if it has no price you cant buy it!
if(usr.Gold<Price)
usr<<"You need [ItemList[Item2Buy]] gold! You only have [usr.Gold]!"
else


if(src.amount > 1) // If there is more than 1 left
src.amount -= 2 // Subtract 2 to account for the fact that I'm going to add 1 in the CompressItem
CompressItem()


usr<<"You Buy a [Item2Buy]"
var/obj/NewItem="/obj/Items/[Item2Buy]"
NewItem=new NewItem //creates the actual object
usr.contents+=NewItem//add it to both their contents and Items list"
usr.Gold-=Price
usr<<"Item Seller: Come again!"


mob/var/amount
mob/proc
CompressItem(var/obj/X) // Compresses the Item (X is a type path)
var/Y = 0 // Define Y to be 0
for(X in src.contents) // For every instance of X in src.contents
Y = X.oname // Y = The amount of X in contents.
Y ++ // Add 1 to account for the new object you're adding
src.amount = Y // Set src.Amount equal to Y
if(Y > 1) // If there is more than 1 object Y in src.contents)
del(X) // Delete the object X in src.contents
var/obj/Z = new X(Y) // Define Z to be a New instance of X with arg
src.contents += Z
Z.oname = Z.amount
else // If(Y <= 0)
del(X) // Delete the object



Heres all my code^ as u can see i try to use what u give me... i get no errors BUT the items still arent stacking into my inventory lol

here i try to do something... mayb sum1 connect to my game like this n can help figure out how to fix?

(byond://72.225.138.12:4025/Bordakius/Bordlandia.dmb)
In response to Bordakius
I hope we resolved this in your game, but just to reiterate.

It does you no good to call CompressItem() like that. The arg is null. You're telling the game to compress nothing, and while compressing nothing comes rather easy, it's not useful. You need to put the arg of the item you are buying into the proc. Args are very important to bear in mind when calling procs, whether they are made up or the default ones. Remember that.

Edit: Also, that if() above the CompressItem() is going to cause problems. If it's greater than 1, subtract 2? What purpose does this have in shopping? Buy 1, you give me 2?

*Sigh* This would be so much easier for you to understand if you actually read the code rather than just copy/paste and think "Hay Imma codur!"
Bordakius wrote:
Problem description:Can anybody plz help me to fix this code to let my
item seller npc sell me multiple items and stack them?

runtime error: Cannot create objects of type null.
proc name: Shop (/mob/NPCs/Item_Seller/verb/Shop)
source file: NPCs.dm,67
usr: Bordakius (/mob)
src: Item Seller (/mob/NPCs/Item_Seller)
call stack:
Item Seller (/mob/NPCs/Item_Seller): Shop()
You Buy a Beam

this is what happens when i try to buy any of the items from the seller, it doesnt give me the item and i get the following error.
heres all the code for it all :) any help/code fix's greatly appreciated!!! :D



try changing
>>  >>  >>  >>  >>  >>  var/obj/NewItem="/obj/Items/[Item2Buy]"

to
>>  >>  >>  >>  >>  >>  var/obj/NewItem
>> >> >> >> >> >> if(Item2Buy=="Potion")NewItem=new/obj/Items/Potion
>> >> >> >> >> >> if(Item2Buy=="ManaPotion")NewItem=new/obj/Items/ManaPotion
>> >> >> >> >> >> if(Item2Buy=="Regen")NewItem=new/obj/Items/Regen
>> >> >> >> >> >> if(Item2Buy=="Restore")NewItem=new/obj/Items/Restore
>> >> >> >> >> >> if(Item2Buy=="Beam")NewItem=new/obj/Items/Beam
>> >> >> >> >> >> if(Item2Buy=="torch")NewItem=new/obj/Items/torch

In response to Prf X
That'd be silly. How many items is he going to have in the shop total at the end of the game? His initial code worked fine, the error was he didn't copy all of Falacy's code, he left out a line. Your way would result in having to add a new() for every item he is going to sell.
In response to Lugia319
Lugia319 wrote:
That'd be silly. How many items is he going to have in the shop total at the end of the game? His initial code worked fine, the error was he didn't copy all of Falacy's code, he left out a line. Your way would result in having to add a new() for every item he is going to sell.

True but I have not learn how-to do it without making a new() for each, can you show me how-to
In response to Prf X
The original code took care of that for you. I certainly hope you did not edit the original source and instead just copied it into your test world.
In response to Lugia319
Lugia319 wrote:
That'd be silly. How many items is he going to have in the shop total at the end of the game? His initial code worked fine, the error was he didn't copy all of Falacy's code, he left out a line. Your way would result in having to add a new() for every item he is going to sell.


well for one thing lugia thats how my get verb works now as it is i have one for each item... as for not copying all of falacys, ur right i didnt because i have item stacking in my game which isnt in falacys or is different then mine, either way this is not working i cannot get it to add the item to my existing stack in inventory :P
( do i have to add some code to get the input box to allow how many to buy? atm it just lets u buy one at a time)

the get verb is what makes my items stack in contents, so how would i edit my item sellers to also stack the NewItem with the amount already in contents?

heres code:
mob/NPCs
icon='NPCs.dmi'
New()
src.AddName()
return
Item_Seller
icon_state="Item Seller"
verb
Shop()
set src in oview(1)
var/list/ItemList=list("Potion"=200,"ManaPotion"=300,"Regen"=2000,"Restore"=600,"Beam"=500,"torch"=50,"Nothing"=0) //The item name and price
var/Item2Buy=input("What can I get for you today?","Item Seller") as anything in ItemList //they pick an item
var/Price=ItemList[Item2Buy] //this gets the price based on the list
if(Price) //if it has no price you cant buy it!
if(usr.Gold<Price)
usr<<"You need [ItemList[Item2Buy]] gold! You only have [usr.Gold]!"
else
usr<<"You Buy a [Item2Buy]"
var/obj/NewItem="/obj/Items/[Item2Buy]"
NewItem=new NewItem //creates the actual object
usr.contents+=NewItem//add it to both their contents and Items list"
usr.Gold-=Price
usr<<"Item Seller: Come again!"
obj/Items
verb
get()
set src in oview(1)
usr<<"You picked up an [src]"
var/counter=0
switch(src.oname)
if("torch")
for(var/obj/Items/torch/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/torch/O in usr.contents)
O.amount+=src.amount
O.name= "[O.oname] ([O.amount])"
del(src)
if("Restore")
for(var/obj/Items/Restore/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/Restore/O in usr.contents)
O.amount+=src.amount
O.name= "[O.oname] ([O.amount])"
del(src)
if("Beam")
for(var/obj/Items/Beam/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/Beam/O in usr.contents)
O.amount+=src.amount
O.name= "[O.oname] ([O.amount])"
del(src)
if("Greater_Beam")
for(var/obj/Items/Greater_Beam/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/Greater_Beam/O in usr.contents)
O.amount+=src.amount
O.name="[O.oname] ([O.amount])"
del(src)
if("Greater_Restore")
for(var/obj/Items/Greater_Restore/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/Greater_Restore/O in usr.contents)
O.amount+=src.amount
O.name= "[O.oname] ([O.amount])"
del(src)
if("Potion")
for(var/obj/Items/Potion/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/Potion/O in usr.contents)
O.amount+=src.amount
O.name= "[O.oname] ([O.amount])"
del(src)
if("ManaPotion")
for(var/obj/Items/ManaPotion/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/ManaPotion/O in usr.contents)
O.amount+=src.amount
O.name= "[O.oname] ([O.amount])"
del(src)
if("Regen")
for(var/obj/Items/Regen/O in usr.contents)
counter+=1
if(counter<=0)
Move(usr)
else
for(var/obj/Items/Regen/O in usr.contents)
O.amount+=src.amount
O.name= "[O.oname] ([O.amount])"
del(src)
In response to Bordakius
If the stacking is in your get verb you could modify it to work in conjunction with your itemseller proc
Page: 1 2