ID:267184
 
Hello, I've been getting frusterated with this same thing for like 3 days now and still can't seem to figure out whats wrong with the codeing.I've tried many ways and seemed to learn nothing from my mistakes.

obj
PlayerEliminatorfirst
icon='Objects.dmi'
icon_state="PE"
density=0
Entered(mob/M)
if(ismob(M) && M.client)
M.loc=locate(M.startx,M.starty,M.startz)
New()
spawn() upDown()
..()
proc/upDown()
while(src)
if(loc == initial(loc))
step(src,NORTH)
sleep(50)
if(loc != initial(loc))
step(src,SOUTH)
sleep(50)


Here I have the code for my Player Eliminator, it moves up and down and eliminites players like it's supposed to do.The problem is, it will only elimiate when the player bumps into it from another tile and if the players on the tile when it moves up it just ignores him and nothing happens but it moving behind him.I thought up a solution that involed a proc and was like this

obj 
proc
abc()
for (var/mob/M.loc=locate(src.x,src.y+1,src.z)
M<<"It works?"


Yet this gives me two errors.One of them that, when double clicked leads to a part of my code that has nothing to do with this part.The second says "list started here" and points to the "for (var/mob/M.loc=locate(src.x,src.y+1,src.z" part.Does anyone see the problem here?

-Beld
The latter error is a simple one: You forgot to close the parentheses properly.

As for the thing not killing people when it moves, just move the player elimination part to another proc, and any time you successfully Move() it, check for an elimination:
Move()
.=..()
if(. && loc)
EliminatePlayersAt(loc)

proc/EliminatePlayersAt(turf/T)
for(var/mob/M in T)
if(M.client)
M.loc=locate(M.startx,M.starty,M.startz)

Lummox JR
In response to Lummox JR
Dangit, I was in the middle of writing a post to help him, then you come out and do so much of a better job I had to delete my post....:P