Erm, well, seeing if a mob is in a mob's sight...a straight line infront of him...is there a proc for that already? Or is there another way to do it?
Well, thanks for reading.
ID:268922
![]() Dec 28 2004, 4:56 pm
|
|
Hell Ramen wrote:
Erm, well, seeing if a mob is in a mob's sight...a straight line infront of him...is there a proc for that already? Or is there another way to do it? Directly in front is probably not what you want, since it's a 0° field of view. A mob standing 2 tiles north and 1 east, for example, would be completely invisible. You probably want something more along the lines of a slightly wider field of view. Try these out: proc/get_approx_dir(atom/ref,atom/target) If you use these procs, you should also use view(src) to see if the target is actually visible. Using them would look something like this: if(fov45(target) && (target in view(src))) The parentheses around (target in view(src)) are very important. Lummox JR |
"The parentheses around (target in view(src)) are very important." :p because usr is its default, right?
Well, thanks Lummox. That helps. :) |
Hell Ramen wrote:
"The parentheses around (target in view(src)) are very important." :p because usr is its default, right? Actually, it's because, it's checking to see if "target" is in the view of src, which is a list. And, since he's comparing to variable checks in that if(), he needs to place them around it, or else its precedent will misunderstand it. |
I believe AbyssDragon has a math library that contains a proc that does just this.