ID:166232
![]() Sep 2 2006, 12:15 pm
|
|
How would I go about making it so that mobs could only see a certain distance/area in front of them? Like those nifty vision-cones you see all too often in commercial games.
|
![]() Sep 2 2006, 12:17 pm
|
|
i'm not sure how to do it, but i think it has to do with either eye_perspective or range()
|
Seraphrevan wrote:
How would I go about making it so that mobs could only see a certain distance/area in front of them? Like those nifty vision-cones you see all too often in commercial games. See luminosity, and/or client.view. |
I think you're misunderstanding me. I know how to make it so that you can only see things within a certain radius around yourself, but I want it so that I can make NPCs only detect things directly in front of them (which I think I have an idea of how to do), and off to the sides a little bit. You know, like those vision cones in games. They can't see behind or too far to the sides, and they also can only see so far.
|
You can do it by looking at all the tiles in the player's screen, and checking if the player is facing the general direction. Here is an example on how one would work.
proc/cone_turfs(atom/A) In order to make it so the player can only see the turfs, you would have to use screen objects, and block off the view dynamically. ~~> Unknown Person |
I asked a very similar question a few months back when working on a camera object. I was given this, which returns a list of locations/turfs in a cone. With a little work you could adapt it into your code like I did mine.
proc/cone(atom/target, dist = 2, dir) Should be self-explanatory. |