ID:147488
 
How can I drop something thats Dense? (AKA: Cant go through) I have a part in my game, that to get, you have to buy it, so it appears in your inventory, but, when I hit the drop button on it, it wont drop the item. It will for Non-dense forms. Heres my code.
obj
house_items
verb
Drop()
usr.islocked = 1
switch(alert("Once you drop this, you will NEVER be able to get it again! Are you sure you want to drop it here?","Drop?","Yes","No"))
if("Yes")
usr << "<i>You steadly place the [src.name]!</i>"
src.Move(locate(usr.x,usr.y,usr.z))
usr.islocked = 0
src.dropped = 1
if("No")
usr << "<i>You decide not to put the [src.name] here.</i>"
usr.islocked = 0
var
ownerkey = null
ownername = null

BedLeft
name = "Bed"
icon = 'turfs.dmi'
icon_state = "bedl"
density = 1

BedRight
name = "Bed"
icon = 'turfs.dmi'
icon_state = "bedr"
density = 0
verb
Sleep()
if(src == locate(usr))
usr << "<i>You would be able to get to sleep, but you can't sleep in yourself!"
return
else
set src in view(0)
usr.islocked = 1
usr << "<i>You get into bed and start to take a rest."
sleep(50)
usr << "<i>When you awaken, you are fully regenerated!"
usr.hp = usr.maxhp
usr.mp = usr.maxmp
usr.islocked = 0

The Bed part WITHOUT the density WILL DROP! The bed part WITH the density WILL NOT DROP! Please help.
Because there's already something dense one the turf: you. You can't use Move() to place two dense objects on top of ecah other. You'll just have to use loc = usr.loc.

Also, locate(usr.x, usr.y, usr.z) is rather pointless. Just use loc.
In response to Garthor
loc didnt work for some reason, and my friend suggested that.
In response to Metroid
Also this doesnt seem to work for some reason, help please

var/list/objs = list ()
obj
var/lastx
var/lasty
var/lastz

area
var/lastx
var/lasty
var/lastz

world/New()
..()
if(fexists('Map.sav'))
var/savefile/F = new ("Map.sav")
F >> objs
for(var/obj/o in objs)
o.loc = locate(o.lastx, o.lasty, o.lastz)
objs.Cut()
return ..()

world/Del()
var/savefile/F = new("Map.sav")
for(var/obj/o in world.contents)
o.lastx = o.x
o.lasty = o.y
o.lastz = o.z
objs.Add(o)
F << objs
return ..()


It wont save when its supposed to but yet it doesnt crash it either. PS: this is from OBJSAVE from Super17 (Name?)