Jump to content
Sign in to follow this  
Major Fubar

Making AI snipers more effective

Recommended Posts

Hi, I'm making some missions with enemy AI snipers, and want to try a few editing tricks to make them more effective.

Is there an easy way to make the sniper wait between shots? I would like the sniper to take a shot when he spots the enemy (players), then pause for around 10-15 seconds before firing again, so that players find it harder to pinpoint where the shots are coming from. Also, maybe after a certain number of shots, he would move from one hiding spot to another, predetermined spot? He will initally be positioned in some bushes, take a few shots, then move to another nearby clump of bushes.

And how about range? I know I've read some ideas about improving the range at which snipers will enage (such as this thread...

TIA - Fubar

Share this post


Link to post
Share on other sites

Let's say you call this AI sniper " Snipername " and the group you want him to monitor "Enemygroupname"

For the range , instead of the solution from the thread you found, i think using some very simple scripts that are looping like this will help:

you can name this first script " snipmonitor.sqs "

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#thesniperloop

~4

"Snipername reveal _x" foreach units Enemygroupname

?!alive Snipername : exit

goto "thesniperloop"

So each 4 seconds (no need to make a lower loop delay, we are saving performance here) , the AI sniper will know where the Enemygroupname squad potential targets are.

In the second script, removing the magazines from the sniper and adding one again after the delay you want should do the trick, here is what it could be for an East sniper with the BIS Dragunov :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; remove all the SVD magazines so the sniper can't open fire

Snipername removemagazines "SVDDragunov"

; the delay in seconds we want between each shot

~10

; let's give a magazine to the sniper again so he can open fire

Snipername addmagazine "SVDDragunov"

exit

For your delay remember that the AI sniper will have 2 seconds more to reload after your delay.

So if you add the following in the initialisation line of such sniper

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this exec "snipmonitor.sqs"; this addEventHandler ["fired",{_this exec "snipdelay.sqs"}]

It will allow the AI sniper to engage the enemy group members from higher distance (as he will know their position everytime) and he will delay his shots so it will not be very easy to spot him.

Can't guarantee it will work in MP as scripting can behave very differently, but in SP it works.

The other solution would be to create a mini addon with a config.cpp adding a new sniper that will use an addon weapon capable of engaging in longer distance , and the addon unit with a very high sensitivity value (so it can see better, more far and recognize enemy quickly).

Share this post


Link to post
Share on other sites

Thanks Sanctuary. I don't want to use any addons other than FDF 1.3, so I'll have a look at your first suggestion. wink_o.gif

Share this post


Link to post
Share on other sites

There is a script at ofpec(which is down right now) that makes a sniper shoot in a more realistic way in that it slows the shots down as if the sniper were using a bolt action rifle.

There is also another script that keeps the sniper moving to new positions.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×