Jump to content
Sign in to follow this  
Grumpy Old Man

AI Artillery - Aiming without firing

Recommended Posts

Hey Folks,

is it possible to make AI artillery aim at a target (with proper azimuth and elevation) without firing?

Would be for cosmetic reasons for my artillery script because currently the AI artillery is aiming and firing way too fast to be authentic

Couldn't find any commands that would fit my needs, and aiming at a floating marker ain't a solution either.

Cheers

Share this post


Link to post
Share on other sites
doWatch is what I use personally, in conjunction with fireAtTarget. The first cmd will make adjust the artillery towards the target (it will aim STRAIGHT at the target, so if the target isn't in the air the barrel etc will not go upwards. You'll have to work around this by using a dummy target placed midair), whilst the second cmd will make the artillery fire one shell towards that target (This is where the artillery will adjust accordingly and on it's own)

Share this post


Link to post
Share on other sites

Now that I think of it, shouldn't it be possible to somehow calculate the height of a dummy target so that the shell will hit the actual target?

This way I could make the arty aim at the correct elevation, without using the stock artillery commands at all and probably could even integrate low angle and medium angle firing solutions so the ETA wouldn't be as high

Share this post


Link to post
Share on other sites

Dummy targes, more often than not, are just used for cosmetical purposes. The thing is that with stock commands like fireAtTarget, the artillery properly calculates everything, but only really aims properly once it fires. That's why, for the rare occasion that a player is near the artillery, you'd spawn a dummy target in the air, let the artillery aim, and then fire at it. Then you delete the shell and respawn it on target after some calculated time (really simple calculation would be (artillery distance target) / 100). That's the way I'm using it, I'm not really bothering waiting for the actual shell to hit the target. The problem with using a dummy target as a go-to "bridge" between shell and actual target is that offset calcs etc will apply to the dummy and more often than not it won't hit the real target properly. I suppose a simpler way of achieving the "aim without firing" but then properly firing at the target would be to delete the dummy after a set time and then instantly tell the artillery to fire.

_artillery = [_this,0,objNull,[objNull]] call BIS_fnc_param;
_target = [_this,1,[0,0,0],[[],objNull]] call BIS_fnc_param;

_dummy = createVehicle ["DummyTarget",[_target select 0, _target select 1, 500],[],0,"NONE"];
_artillery doWatch _dummy;

sleep 5;

deleteVehicle _dummy;
_artillery fireAtTarget [_target];

Something like the above could possibly work. At the end of the day, getting the artillery to aim properly before actually firing is purely cosmetical, as proper calculations are done when using fireAtTarget.

Share this post


Link to post
Share on other sites

That's not what I meant,

there has to be a way to determine the correct elevation and azimuth for the artillerygun

then you can place a dummy target in the bulletpath shortly behind the barrel

so you would get no movement for the barrel after it's steadied. That's what I want to prevent.

---------- Post added at 12:46 ---------- Previous post was at 11:14 ----------

Just to be a bit more specific, how does the AI arty gunner know which elevation and azimuth he should use to hit his assigned target?

Is there any way to get those values?

Share this post


Link to post
Share on other sites

That'd be interesting to know. I have no idea, to be honest. The artillery entries in CfgVehicles don't have anything super-specific or useful, although digging around in the A3 pbo's might yield some results.

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  

×