I am just wondering how I would go about checking the density of a turf two tiles away from a mob.
§atans§pawn
ID:270692
![]() Jul 29 2006, 10:10 pm
|
|
There's probably an easier reason, but I am tired.. It's 5:02 AM and I didn't sleep yet. :(
for(var/turf/T in world) |
Think something along the lines of:
// Alright, let's cut to the chase: It's one massive line, but I'm fairly certain it might get what you want done. Uh, it's highly unreadable, but I sort of explained what I did up above it. You might want to go over it again and make sure I did it all correctly, as it's 5 AM and I'm somewhat tired. ~_~ |
The problem with both of your codes (as far as I know) is that turfs do not have an x value to compare with mine, otherwise this crisis would have been averted... :( but thatnks anywho :D
§atans§pawn |
Where are you placing this stuff? Mine should work nicely as long as it can access a mob's x, y, and z.
|
I just realized mine wouldn't have worked for what you wanted anyways. X_x I misunderstood.. Like I said.. Tired. I could've done that method a lot better, too. Dunno what I was thinking.
-Exophus |
Audeuro wrote:
Where are you placing this stuff? Mine should work nicely as long as it can access a mob's x, y, and z. turf Basically, I want to check to see if the player is able to hop over a fence or not... This is still the very early stages of the game, so I plan on making it better, but for now this is just to find out how to do it and then elaborate it. §atans§pawn |
I managed to sesolve my issue, I will post my code later on today so that I can get it critiqued, and possibly optimized as well, thanks :D
§atans§pawn |
Here is my current code. I didn't write an optimized code, obviously, I just went with something that would work, and this does just that. However, I am now looking for ways that this can be optimized. Any suggestions are welcome.
turf §atans§pawn |
First of all, get rid of all of the direction checks. You should be able to use get_step() to get the turf in a certain direction instead of using locate(). Also, block() returns turfs, so you your failure check will not always be correct.
turf/outside/fence ~~> Unknown Person |
I replaced my stuff with yours, but it doesn't seem to be working. I will continue playing with it, but from what I can figure out is it won't get past "if(src in get_step(usr, usr.dir))". I put in a check of world<<src under that line and indented properly, but there is no output.
§atans§pawn |
Sorry, I forgot that src was a turf. Since get_step() returns a turf, you have to compare src with the get_step(). I modified my original post.
~~> Unknown Person |
-Exophus