This is what I came up with, but it didnt work.
mob/proc/Same_Spot_Check()//CHECK FOR OTHER PLAYERS IN SRC.LOC
var/mob/M
if(M in view(0))
src.loc=locate(src.x+9,src.y,src.z)
src.Same_Spot_Check()
world<<"yes"
Anyone have any ideas how to fix this?
ID:171971
![]() Jul 15 2004, 5:04 am
|
|
I tried to make a Proc() that checks if there are any other mobs in your mobs view, and if there are , your mobs loc = locate(src.x+9,src.y,src.z) and then loop to check if there is a mob in your mobs new view.
This is what I came up with, but it didnt work. mob/proc/Same_Spot_Check()//CHECK FOR OTHER PLAYERS IN SRC.LOC Anyone have any ideas how to fix this? |
Hmmm... You probably shouldn't be using src though. at the beginning of the proc, put in something like var/mob/N, and replace src with N.
|
You'll need to use locate() to find something in view(). Don't forget that view() and related procs default to usr so it needs to be view(distance,src) for procs.
|
Ah yes, I got it to work for NPC mobs, but it calls the proc twice for mobs with clients attached to them. I'm guessing its including the player calling the proc. well heres what i have so far.
mob/proc/Same_Spot_Check()//CHECK FOR OTHER PLAYERS IN SRC.LOC I think all I need is a way to have the proc not include the players mob whos calling the proc. |
All I want the proc to do is check if there is a mob in the players mob's view other than the players mob and if there is, then the players mobs loc will be 9 tiles to the right and the Proc will be called again to check at the new loc. if there is no mob in the players mob's view, then the players mob's loc will stay and the proc will have done its job. I hope thats easy to understand.
|
Instead of view(0,src) use oview(0,src). [o]view() default to usr, so make sure you change it from just view(0).
|
Well I got this to work, tell me if you see any bugs, but as of now i think this is fine.
mob/proc/Same_Spot_Check()//CHECK FOR OTHER PLAYERS IN SRC.LOC |
That might work. I'm no expert though, so someone correct that if it's bad.