Jump to content
Mynock

Preventing AI Artillery from lowering gun between shots?

Recommended Posts

Is there a relatively simple way of preventing an AI controlled artillery gun from lowering and then re-raising and re-acquiring a target every single shot? It's rather immersion breaking. All I'm trying to do is have an AI Artillery piece fire at a marker way off in no man's land and pause for ~20 seconds between each shot. That works all fine and dandy with the following script:

while {alive arty} do {
	arty doArtilleryFire [getMarkerPos "markername", "32Rnd_155mm_Mo_shells", 1];
	sleep 20;
	};
except the AI lowers the gun after every shot. I'm running that script via an execVM in the unit's init field. I've tried the following in the artillery piece's init field to prevent the gunner from lowering the gun with no success (doesn't matter if I use a marker or an actual object, I get the same results):

this doTarget markername
this doWatch markername
It looks stupid, I'm hoping there is some simple way around this I'm not aware of without some crazy script, otherwise I'll just leave the artillery static and not firing.

Share this post


Link to post
Share on other sites

Try setting behaviour to combat with:

_unit setBehaviour "COMBAT";

Or, rather than have the AI shoot at the marker, get the artillery to target something like a game logic and then use either the 'fire' command, 'useWeapon' command, or 'forceWeaponFire', or something like that :) By forcing the vehicle to fire against its natural volition, it ought to remain in its given position, without lowering its barrel.

Share this post


Link to post
Share on other sites

Sorry if my original post wasn't clear about firing at a marker vs something else like your suggested game logic. I've tried with a marker and an object and it doesn't make a difference. I'll try your other suggestions and see what happens, thanks.

Share this post


Link to post
Share on other sites

You could use a combination of the following:

Make them aim at the target:

https://community.bistudio.com/wiki/doTarget

https://community.bistudio.com/wiki/doWatch

Make them fire:

https://community.bistudio.com/wiki/doFire

 

The issue with doArtilleryFire is that it is hardcoded for them to reset their target and drop their barrel. You'll just have to make your own similar system to circumvent this.

Share this post


Link to post
Share on other sites

Sorry if my original post was unclear radioman, but I am using doWatch and doTarget already.

I've got the barrel up and static, but now the unit refuses to fire with any of the firing commands available. This may be too complicated for me to figure out. I've tried running the script on the artillery piece itself and on the gunner inside without any success.

There was some mission that had artillery firing and you had to shoot when the artillery fired to mask the sound or something, I don't know I saw a youtube video of someone playing it a while ago. Maybe I can find that video, figure out who made the mission, and ask them if I can see their script. If someone asked to see something I made I'd gladly show them, but I've only been around the Arma community for a year, so I don't know how frowned upon it is to ask people to share their mission files or information about how they made complex things. I feel like some people might take that offensively.

  • Like 1

Share this post


Link to post
Share on other sites

Could you fake the artillery fire? Get the artillery to aim at a game logic (up high, I would assume) and fire using a script command. Use the 'fired' eventhandler to delete the projectile and then create an explosion on the marker position? Sorry, I'm extremely tired, I might not have read your post properly - again, apologies :P

 

Also, could you use disable simulation between shots, to keep the barrel high?

Share this post


Link to post
Share on other sites

A Fire Mission waypoint will make a Scorcher shoot and shoot and shoot again till they run dry without lowering their muzzle.  It's not really 20 seconds between shots, it's however long their reload is, but it's still a decent "Someone's having a bad day" effect.

Share this post


Link to post
Share on other sites

Could you fake the artillery fire? Get the artillery to aim at a game logic (up high, I would assume) and fire using a script command. Use the 'fired' eventhandler to delete the projectile and then create an explosion on the marker position? Sorry, I'm extremely tired, I might not have read your post properly - again, apologies :P

 

Also, could you use disable simulation between shots, to keep the barrel high?

I can get it to aim wherever I want with the doWatch command now (sort of, the barrel angle takes some guessing and checking, but it just needs to look like it's shooting somewhere far away). But I still can't get the damn thing to actually fire the gun at the "target" which is an object a few km away. I've checked that this "target" is within the range of the artillery piece, but right now the doArtilleryFire is the only way I can get it to fire a round, but the problem with that is that's what causes the aiming readjustments and the barrel dropping. I've made sure I've selected the correct weapon and muzzle and projective type as well, so I honestly have no idea why it's not firing. I'm still doing some research on it today.

I do like that idea of deleting the projectile, because despite my "target" being quite far away (practically off of the map), you can still hear the round impact when using the doArtilleryFire, and I'd like to avoid that. I'll have to look into how to delete it.

A Fire Mission waypoint will make a Scorcher shoot and shoot and shoot again till they run dry without lowering their muzzle.  It's not really 20 seconds between shots, it's however long their reload is, but it's still a decent "Someone's having a bad day" effect.

A possibility I suppose, but the delay effect is sort of important to me if I can implement it somehow. It's going to take the player a bit to get to the artillery, so I don't want to annoy the living hell out of them with constant artillery fire. We'll see.

Share this post


Link to post
Share on other sites

Have you tried the 'UseWeapon' command?

 

_Logic action ["useWeapon", _vehicle, gunner _vehicle, 1]; (note, it does need to be a game logic or something similar for it to fire!)

 

and this doesn't work at all?

 

_vehicle fire ((weapons _vehicle) select 0);

 

@Kylania - great to see you so active on the forums, matey! You really were my mentor - so nice you're still helping us out :D

Share this post


Link to post
Share on other sites

Thanks for the suggestion about using select 0 for firing Kydoimos, that method does work, and I hadn't been specifying the weapon properly with the fire command before that I guess. I also found (before I checked your reply) that using fire and currentWeapon will work consistently vs calling the muzzle like some other commands require for some unknown reason. So I can use either method to get the main gun to shoot (it also works on the MLRS I noticed for anyone wondering).

Next project is to figure out how to delete the projectile.

Edit: Done, got it working in a way that works for me. Thanks for the help. I'm going to put it together into a small script that's more generalized so others can benefit.

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

×