Home   Help Search Login Register  

Author Topic: AI - Scan Horizon (Snipers)  (Read 1466 times)

0 Members and 1 Guest are viewing this topic.

Offline GomerPyle

  • Members
  • *
  • OFPEC rocks.....
AI - Scan Horizon (Snipers)
« on: 15 Jun 2008, 01:30:45 »
Hi!

I have been trying to get a sniper i got placed in a lighthouse to shoot at enemies. But either he runs off from the lighthouse and shoots them (waypoints) or he just standing there. I think i remembered something about scan horizon from OFP. But I have forgotten all about it. The thing is am not great at scripting. And I hope there are someone in here that got such a script or know how to do this with snipers.

Yours Sincerly GomerPyle

Edit: Is it possible to have an sniper ai watch an area and if he see someone shoot them? If that is the case how?
« Last Edit: 15 Jun 2008, 11:18:46 by GomerPyle »

Offline AirCav

  • Members
  • *
  • I'm a llama!
Re: AI - Scan Horizon (Snipers)
« Reply #1 on: 16 Jun 2008, 00:18:28 »
Have you tried using the <this disableAI "MOVE"> command? 

Somewhere I saw a script designed to make AI scan back and forth with scripted left and right boundaries.  it was posted in the last couple weeks.  Do a search. 

I know in the squad leader's action menu, you can tell AI units to 'scan horizon.'  I don't know how to order that function in a script though. 

Someone else chime in here, please.

-Ry

Offline Rommel92

  • Members
  • *
Re: AI - Scan Horizon (Snipers)
« Reply #2 on: 16 Jun 2008, 01:10:44 »
To achieve the AI to effectively 'scan' the horizon is not very easy, thats saying your not just doing "setDir" this way and that. The AI have incredibly good and incredibly poor LOS at times.

Using the disableAi "move" should be effective stopping the running away, and perhaps a few spotters or reveals out in the field will increase the AIs spotting skills, otherwise maybe someone will have something more indepth.

Offline Barbolani

  • Members
  • *
Re: AI - Scan Horizon (Snipers)
« Reply #3 on: 16 Jun 2008, 10:36:43 »
Hi,

Just an idea... theres a command named Lookat....

Link in the comref: http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=l#646

DisableAI will do de trick to make him stand up and not moving. And SetUnitPos is also needed in this case.

With LookAt you could place some markers or some GameLogics at certain points (i. e. lets say one at the front and a couple more on the sides) and making a script that makes the sniper look at them randomly on random times....

I made this one for searchlights with DoWatch and worked perfectly, but dowatch will make the sniper rotate, and thats not cool.

If the sniper is moving, maybe you can move also the markers / gamelogics, but it would be a bit more complex.

Cya!

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: AI - Scan Horizon (Snipers)
« Reply #4 on: 16 Jun 2008, 21:36:05 »
I assume your sniper starts out facing the optimal direction initially.  A small script could do the following:

- Record inital dir sniper is facing.
- Pick a maximum degrees you want sniper to scan from initial dir (say 40 degrees to left and right of center dir).
- Create a gamelogic at the the sniper's position, and setdir it to initial dir of sniper.
- Write loop that:
--setdir dir of gamelogic gradually to scan 40 degrees left, back to center, then 40 degrees right.  You could do this in increments of 10 degrees.
--After every setdir change for gamelogic, have sniper watch a position 100 meters in front of game logic:

sniper dowatch (gamelogic modelToWorld [0,0,100]);

Add a nice sleep in there so sniper doesn't change watching positions to often, and terminate the loop if sniper killed, etc.

You may also want to stop loop if sniper's knowsabout enemies is high enough, or his combatmode changes because he sees targets to shoot.
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...