ID:140764
 
Code:
proc
spawnitem(id as num,x as num, y as num, z as num)
var/tt
var/savefile/s = new("items/[id].dat")
s["typei"] >> tt
switch(tt)
if ("food")
var/obj/item/food/o = new /obj/item/food/(locate(x, y, z))
s["typei"] >> o.typei
s["exam"] >> o.exam
s["mod"] >> o.mod
s["name"] >> o.name
s["icon"] >> o.icon
s["iconstate"] >> o.icon_state
if ("weapon")
var/obj/item/weapon/o = new /obj/item/weapon/(locate(x, y, z))
s["typei"] >> o.typei
s["exam"] >> o.exam
s["mod"] >> o.mod
s["strmod"] >> o.strmod
s["name"] >> o.name
s["icon"] >> o.icon
s["iconstate"] >> o.icon_state
if ("helm")
var/obj/item/helm/o = new /obj/item/helm/(locate(x, y, z))
s["typei"] >> o.typei
s["exam"] >> o.exam
s["mod"] >> o.mod
s["strmod"] >> o.strmod
s["defmod"] >> o.defmod
s["name"] >> o.name
s["icon"] >> o.icon
s["iconstate"] >> o.icon_state
if ("body")
var/obj/item/body/o = new /obj/item/body/(locate(x, y, z))
s["typei"] >> o.typei
s["exam"] >> o.exam
s["mod"] >> o.mod
s["strmod"] >> o.strmod
s["defmod"] >> o.defmod
s["name"] >> o.name
s["icon"] >> o.icon
s["iconstate"] >> o.icon_state
if ("legs")
var/obj/item/legs/o = new /obj/item/legs/(locate(x, y, z))
s["typei"] >> o.typei
s["exam"] >> o.exam
s["mod"] >> o.mod
s["strmod"] >> o.strmod
s["defmod"] >> o.defmod
s["name"] >> o.name
s["icon"] >> o.icon
s["iconstate"] >> o.icon_state
if ("cape")
var/obj/item/cape/o = new /obj/item/cape/(locate(x, y, z))
s["typei"] >> o.typei
s["exam"] >> o.exam
s["mod"] >> o.mod
s["strmod"] >> o.strmod
s["defmod"] >> o.defmod
s["name"] >> o.name
s["icon"] >> o.icon
s["iconstate"] >> o.icon_state
if ("shield")
var/obj/item/shield/o = new /obj/item/shield/(locate(x, y, z))
s["typei"] >> o.typei
s["exam"] >> o.exam
s["mod"] >> o.mod
s["strmod"] >> o.strmod
s["defmod"] >> o.defmod
s["name"] >> o.name
s["icon"] >> o.icon
s["iconstate"] >> o.icon_state
if ("ring")
var/obj/item/ring/o = new /obj/item/ring/(locate(x, y, z))
s["typei"] >> o.typei
s["exam"] >> o.exam
s["mod"] >> o.mod
s["strmod"] >> o.strmod
s["defmod"] >> o.defmod
s["name"] >> o.name
s["icon"] >> o.icon
s["iconstate"] >> o.icon_state
if ("neck")
var/obj/item/neck/o = new /obj/item/neck/(locate(x, y, z))
s["typei"] >> o.typei
s["exam"] >> o.exam
s["mod"] >> o.mod
s["strmod"] >> o.strmod
s["defmod"] >> o.defmod
s["name"] >> o.name
s["icon"] >> o.icon
s["iconstate"] >> o.icon_state
if ("feet")
var/obj/item/feet/o = new /obj/item/feet/(locate(x, y, z))
s["typei"] >> o.typei
s["exam"] >> o.exam
s["strmod"] >> o.strmod
s["defmod"] >> o.defmod
s["name"] >> o.name
s["icon"] >> o.icon
s["iconstate"] >> o.icon_state
if ("gold")
var/obj/gold/o = new /obj/gold/(locate(x, y, z))
//s["typei"] >> o.typei
//s["exam"] >> o.exam
s["amount"] >> o.amount
s["name"] >> o.name
s["icon"] >> o.icon
s["iconstate"] >> o.icon_state
if ("spellbook")
var/obj/item/spellbook/o = new /obj/item/spellbook/(locate(x, y, z))
s["typei"] >> o.typei
s["exam"] >> o.exam
s["spellid"] >> o.spellid
s["name"] >> o.name
s["icon"] >> o.icon
s["iconstate"] >> o.icon_state


Problem description:
I am trying to make a mmorpg, and my friend is designing a lot of the items, but he is too lazy too code, so i made an editor for him and designed this nice save file system. Now, however, the items wont spawn on the map when i tell them too. Can anyone tell me why this is? I put the proc in world/new. People have suggested to me i form the object in the editor, then put in a savefile, then just spawn it ingame. Is that a better idea then what i have in place?
It would be considerably better to simply save and load the objects normally, with F << theobj. What you have there is simply replicating the default functionality of saving and loading and so is silly.

Also, giving xyz as arguments is silly. Just supply a location, which can be either a turf or, say, a mob.