Jump to content
Sign in to follow this  
igneous01

make an ai sniper have perfect accuracy.

Recommended Posts

So im making a countersnipe mission where an enemy snipers general location was identified when they fired off a round. It seems easy enough to make them relocate from position to position without being seen by the player that easily. but the real problem is when the player is maybe 800m away, and the ai sniper detects him.

The ai sniper wont fire from this range (unless you fire on him first, which ruins the idea of him being an elite sniper) and, his accuracy is horrible at this range. I want to somehow make him have 100% accuracy (or atleast 95%) at all ranges except past 1200m. But it seems like setskill "aimingaccuracy" does not make him a great shot at these ranges. i set it to 1 but he still wasted all his ammunition trying to hit me, but never did.

btw im using ace.

Can i somehow make the ai cheat some more? also i would do setdamage on the player, but since the player will be searching him by when he fires at friendly soldiers, it would mean i need to check if he sees the right person and is aiming at the right person in order to setdamage.

Share this post


Link to post
Share on other sites

This is a very good question. I've had good luck with snipers so far but down the pipe, I do plan on making a counter-sniper mission similar to the one in Arma II.

If you couldn't get the sniper to fire at you past a certain range, you could use triggers to make soldiers fall dead and cause the "elite" sniper to move positions.

Though I am certain there is a way to make the sniper fire at another player no matter the distance.

Share this post


Link to post
Share on other sites

well its not so much getting them to fire (once seen, dowatch, dotarget, dofire)

but even with dofire their aiming is horrible (probably caused by the continous shaking of when they are aiming)

---------- Post added at 17:22 ---------- Previous post was at 16:51 ----------

it seems i have another conundrum with this.

I was thinking of scripting the snipers expertise with knowsabout, and dofire on the knowsabout target and setdamage when they fire.

However, the ai can sometimes knowabout targets that are not even in their line of sight. I would need to check to see if the ai sniper can see the unit before firing, otherwise he would fire behind a wall (or somewhere where he cant be seen at all) and end up killing them anyway.

Share this post


Link to post
Share on other sites

did it, maxed out all settings for him, still cant hit anything past 500m :S

instead he will try to advance towards your position, and once hes within 250m he will fire his weapon.

surely there must be some way to make the ai sniper have better aiming? maybe creating a bullet and calculating its ballistics prior to firing?

Share this post


Link to post
Share on other sites

maybe try using the firednear eventhandlers, then if projectile passed by firednear is within certain range of target you setdammmage it to simulate a hit.

Could look silly if shot lands at ground front of player and he dies...

Otherwise try with a invicible target 250 away from sniper in direct line to target, then recreate hits on that and simulate same hits on invicible target via createscripts on the intended target (player)???

Zeus AI has some good AI snipers, maybe look into that for a solution.

Share this post


Link to post
Share on other sites

thats actually a very solid suggestion with the firednear handlers, that makes alot more sense as it requires the sniper having a shot on his target.

I was thinking that i would make my campaign (hence last mission here) just be ace required, then incorporate zeus into it afterwards (to make it more flexible)

but yes zeus makes life alot easier with this

Share this post


Link to post
Share on other sites

I'm sorry, but firedNear doesn't "fire" if some unit is beeing shot at. Instead that event handler fires if someone _near_ that unit is fireing a weapon (which is most of the time a friendly guy shooting "outwards"). See the difference?

Share this post


Link to post
Share on other sites

ahh i just clued in on that now. Looks like that wont work.

i guess ill need to somehow model the ballistics for certain ranges. but thats a load of work for me (and my physics are crap)

guess ill just have to experiment a bit then

---------- Post added at 02:34 ---------- Previous post was at 01:37 ----------

now that i look at it - theres no command listed in the wiki about setting the velocity of an object. unless i missed it, looks like i cant just create projectile and launch it at something.

and a question:

if i adjust setvectordir for the projectile of a bullet (which i can only grab from fired eventhandler) will it effect the bullets course? maybe some way of getting the bullet to lock on to a unit to simulate an ai snipers accuracy would be my workaround to getting this puzzle solved.

or does setvectordir not work for projectiles?

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  

×