
This is similar to the laser guided sentries.
Please do that tut before doing this one as the only real differences are in
the included files.
There is a new version of sentry.c with this tut. replace
the olderversion with this one. There is also a couple of new files. They are
s_ai.c and s_ai.h. Add them to your project/makefile
s_ai.c contains a number of functions. the main
one is s_findtarget this function scans the surrounding area out to a radius of
1000 units (if you want to change that look in the file and change the 100 in
the findradius call) and returns the closest that fits the parameters given
(not the ent calling it, or that ent's owner, but any other monster or player).
it checks to see if it can see the ent as well, and ignores those it can't (i
amalgamated the two functions visible and infront in g_ai.c to give me a new
function visibletome which returns true if the ent passed first can see the
second ent passed.
There is also a function s_finditems which will
find the nearest object of a type (there are some defines to make it easy to
read) which can be seen. this is of no use yet, but I wrote it as I may create
a bot from this code in the future and it's similar in function to s_findtarget.
Create sentries in the same way as before, and
point them in the right direction with the laser designator. they will then go
into free scan mode, and target anything which they see wihich is not them or
thier owner (players and monsters)