ID:169011
 
I have macros and what not, and I figured why not make your self able to climb on to things, well.... i have it all thought out... but ive been off of byond for along time... What I want to get done is this:

say there is a box and when you get near the verb climb appears(i'll change it to a macro later)... so far i can do this..

obj/interactable
crate
icon='Objects.dmi'
icon_state="crate"
density=1
verb
climb()


Ok, from there... How can I make it to where a player(once clicking the verb) moves onto the object and up 30 pixels(not quite the whole block)... I know it can be done but im not sure how...

Even harder part...

Next, if that player moves in any direction(while on top of the object) they will go one space in that direction and down 30 pixels, only if there is not a dense ATOM in the way.
bump....
any body?
For moving ON to the object, do usr.loc = src.loc.

As for the moving up 30 pixels, look up pixel_y (and while you're at it, look up pixel_x).
In response to DeathAwaitsU
Thanks, I have it exactly how I envisioned now, but I have yet one more request.

I have the idea, but its not quite it.
something like

an if statement....

if obj/crate is in view(1) of usr...

if there is a crate in one space of you

thats all i need to be put into code just that if statement, if someone can once again be so kind.


In response to Cloudiroth
Have you read the DM guide?

for(var/obj/crate/O in oview(usr)) //loop through all crates within 1 distace of you
if(O) //if there really was a crate
... //the rest of the code


I'm pretty sure this would have been covered in the DM Guide.
In response to DeathAwaitsU
ok never mind that helped slightly, tho my idea was simply flawed in design..ok i need it to be alittle more specific in design, say, if a crate is one space south of the player, and so on... sorry, but thanks for this help... anymore is welcomed, and appreciated greatly. I'll mess with it, while I wait for a response...if any at all.
In response to DeathAwaitsU
That if is unnecessary. For statements don't run if there isn't anything to for over, if you see what I mean.
In response to Jp
The point is to then be able to do else later on.
In response to Jp
dont know what you mean.. but umm... how do i get it to check if there is a crate only south of him 1 space, and ill change it to north and what not... my desired effect in the long run once i apply this to a bigger code, is basically being able to walk on top of multiple crates... i have it all envisioned but im missing a vital,yet small, part of it.
In response to Cloudiroth
To find things in a certain direction, say south, use this:

proc/ViewInDir(var/atom/start, var/dist, var/dir)
if(istype(start, /area)) return list()
var/list/result = list()
var/turf/T = start
while(!isturf(T))
T = T.loc
do
result += T
result += T.contents
T = get_step(T,dir)
--dist
while(dist && T)
return result

for(var/obj/crate/O in ViewInDir(usr, 2, SOUTH)) //see things in the distance of 2, in the direction SOUTH of usr.
if(O)
....


In response to Cloudiroth
Look up get_step()