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? |
In response to Rippy
|
|
No, I tried it and no luck. Thanks anyway Rippy.
|
In response to Troglodyte
|
|
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.
|
In response to Rippy
|
|
No that doesnt matter, anyone else have any ideas?
|
In response to Troglodyte
|
|
Well, it depends how you activate it.
|
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.
|
In response to tenkuu
|
|
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. |
In response to Troglodyte
|
|
Well, you want it to check twice, right? Unless you mean it says "yes""yes" or "no""no"...
|
In response to Rippy
|
|
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.
|
In response to Troglodyte
|
|
Instead of view(0,src) use oview(0,src). [o]view() default to usr, so make sure you change it from just view(0).
|
In response to tenkuu
|
|
Ah, right. I was thinking view was the proc that excluded the usr. But oh well, that should fix it.
|
In response to tenkuu
|
|
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 |
In response to Troglodyte
|
|
This isn't really necessary, but it'll save you some space in your code o.o
M will never be the src, because view excludes src. |
That might work. I'm no expert though, so someone correct that if it's bad.