ID:261353
 
I have this code as my bump
Bump(var/obj/grave/G)
if(usr.dir==NORTH)
G.Move(locate(usr.x,usr.y+2,usr.z))
if(usr.dir==SOUTH)
G.Move(locate(usr.x,usr.y-2,usr.z))
if(usr.dir==EAST)
G.Move(locate(usr.x+2,usr.y,usr.z))
if(usr.dir==WEST)
G.Move(locate(usr.x-2,usr.y,usr.z))

and it does move the Grave. But I can also move table and counters and other objs with density how do I make it only be able to move just this grave.
Look up your buddy istype().
In response to Nadrew
ok I have this now
Bump()
var/obj/grave/G
if(istype(G,/obj/grave))
if(usr.dir==NORTH)
G.Move(locate(usr.x,usr.y+2,usr.z))
if(usr.dir==SOUTH)
G.Move(locate(usr.x,usr.y-2,usr.z))
if(usr.dir==EAST)
G.Move(locate(usr.x+2,usr.y,usr.z))
if(usr.dir==WEST)
G.Move(locate(usr.x-2,usr.y,usr.z))
and now when I try and move the obj/grave it doesnt do any thing
In response to Green Lime
mob
Bump(G)
if(istype(G,/obj/grave))
if(usr.dir==NORTH)
G:Move(locate(usr.x,usr.y+2,usr.z))
if(usr.dir==SOUTH)
G:Move(locate(usr.x,usr.y-2,usr.z))
if(usr.dir==EAST)
G:Move(locate(usr.x+2,usr.y,usr.z))
if(usr.dir==WEST)
G:Move(locate(usr.x-2,usr.y,usr.z))

That should work. It worked for me.
In response to Green Lime
Green Lime wrote:
Bump()
var/obj/grave/G
if(istype(G,/obj/grave))
if(usr.dir==NORTH)
G.Move(locate(usr.x,usr.y+2,usr.z))
if(usr.dir==SOUTH)
G.Move(locate(usr.x,usr.y-2,usr.z))
if(usr.dir==EAST)
G.Move(locate(usr.x+2,usr.y,usr.z))
if(usr.dir==WEST)
G.Move(locate(usr.x-2,usr.y,usr.z))

Ookay. Assuming you have bump() on the player, not the grave you're trying to move.. it should be Bump(var/G).. then you should use istype(G,/obj/grave).. after that, you can put the stuff in to move it.

Also, instead of doing all those ifs, you could use a switch.. or, even better, you could do something better by making it take a step in the direction the player is facing..

So.. (In the player mob object, I think. Bump is called on the player, with blocking object as an arg.. I think. I hope.)

Bump(var/G)
if(istype(G,/obj/grave))
step(G, usr.dir)
..()


I'm probably wrong, and it's untested. If nothing else, at least you should have a clue on how to avoid all those ifs(). Seeing so many people using them instead of turn() and such is giving me a headache..

--Tarmas.
In response to Dog Man
Sorry but I figured this out this morning I just forgot to say so on the forum.