ID:171921
 
ok can someone here please give me a code that allows a player to push certain things if they have the right item? or how to make it so that you can push stuff at all? this has always been my weakness :/
Reinhartstar wrote:
ok can someone here please give me a code that allows a player to push certain things if they have the right item? or how to make it so that you can push stuff at all? this has always been my weakness :/

No, I'm not going to hand you "the code". But here's an explanation:

The most elegant way -- in my opinion -- is by overriding the Bump() procedure when a player bumps into the object that is pushable, and use the step() procedure to make the object move in the same direction that the player is facing. In order to see if they have the proper item to do so, just see if you can locate() said item in their inventory.
In response to Malver
ok lemme just post the cod ei tried yto use that dident. work also im not using Bump() im using a verb.
Cansomeone tell me how to fix this code?

obj/block
icon = 'blocks.dmi'
density = 1
opacity = 1
verb
Push()
set src in oview(1)
var/B=/obj/block
step(B,usr.dir)
step(usr,usr.dir)
this wont work. THe block wont move at all. Can someone tell me a way to fix this?
In response to Reinhartstar
Reinhartstar wrote:
ok lemme just post the cod ei tried yto use that dident. work also im not using Bump() im using a verb.
Cansomeone tell me how to fix this code?

obj/block
icon = 'blocks.dmi'
density = 1
opacity = 1
verb
Push()
set src in oview(1)
var/B=/obj/block
step(B,usr.dir)
step(usr,usr.dir)
this wont work.

Indeed. Since you set B to a type path, it's not an object, let alone the specific object (the block) you wanted to push. That'd be src, not B.

But this bears no resemblance to Malver's suggestion anyway.

Lummox JR
In response to Lummox JR
ok it works now thanks Lummox. u realy helped.