ID:164517
 
Im working on a game where I want certain items to combine to make one new item but I have no idea where to start.
There are a couple of diffrent ways to do that.
Just make it to where, if they have to 2 or 3 items you want to combine, take it to a smith or whatever and make them give up the 2 or 3 items for 1 new item.
Give me a few seconds, I am actually just finishing up a library for this.
obj
Herb
Red_Herb
verb
Combine_Herbs(var/obj/Herb/H in usr)
set src in usr.contents
usr << H
if(H==src)
usr << "<b>You cannot combine 2 red herbs."
else
if(istype(H,/obj/Herb/Green_Herb))
usr << "<b>You combine the Green Herb with the Red Herb!"
var/obj/Herb/Combined/B = new()
usr << "[B] was added to your contents."
usr.contents+=B
del(H)
del(src)
else
usr << "You cannot combine this herb with that!"
Use_Herb()
set src in usr.contents
usr.poisoned-=50
del src
Get()
set src in oview(1)
usr.contents+=src
icon = 'herbs.dmi'
icon_state = "r"


Green_Herb
verb
Combine_Herbs(var/obj/Herb/H in usr)
set src in usr.contents
usr << H
if(H==src)
usr << "<b>You cannot combine 2 red herbs."
else
if(istype(H,/obj/Herb/Red_Herb))
usr << "<b>You combine the Green Herb with the Red Herb!"
var/obj/Herb/Combined/B = new()
usr << "[B] was added to your contents."
usr.contents+=B
del(H)
del(src)
else
usr << "You cannot combine this herb with that!"
Use_Herb()
set src in usr.contents
usr.health+=50
del src
Get()
set src in oview(1)
usr.contents+=src
icon = 'herbs.dmi'
icon_state = "g"


Combined
verb
Use_Herb()
set src in usr.contents
usr << "The combination of the 2 herbs enhanced the strenght and healed both your poison and health all the way!"
usr.poisoned = 0
usr.health = 100
del src
Get()
set src in oview(1)
usr.contents+=src
icon = 'herbs.dmi'
icon_state = "gr"
Super
verb
Use()
set src in usr.contents
del world
usr << "You have overdosed!"
usr.poisoned = 100
usr.health = 0
icon = 'herbs.dmi'
icon_state = "super"

mob/Stat()
stat("Inventory and Stats",src.desc)
if(src == usr) stat(src.contents)
if(src == usr) stat("Poison = [src.poisoned]")
if(src == usr) stat("Health = [src.health]")

That is basically what you would do. I JUST made that, so it is not as efficient as possible, but basically, you just delete the items that you combined and make a new one.