Jump to content
Polygon

Force AI to shoot at a spot?

Recommended Posts

I want to force AI shoot at a spot. Ie, AI kills captives one after another and doesn't release the trigger when a captive is dead. For effect, the AI puts more bullets into a dead body.

Or: you're in a firing range, camera is following other AI shooters and teleporting to the spots they hit with single bursts, etc.

Share this post


Link to post
Share on other sites

FireAtTarget seems to work only with vehicles. And doFire doesn't work with dead/inanimate targets, the unit only aims at it but doesn't fire.

I guess you first need to aim (or kill a captive) with doFire for example and then forceWeaponFire right afterwards.

Share this post


Link to post
Share on other sites

You may find this useful. It is a small script that makes AI shoot a target forever.

It can be called in the units init field via

null = [this,target1] execVM "shoot.sqf";

//shoot.sqf
_unit = (this select 0);
_target = (_this select 1);

_unit dotarget _target;
sleep 2;
while {alive _unit} do {
sleep 0.3;
_unit setAmmo [currentWeapon _unit, 1];
_unit forceWeaponFire [ weaponState _unit select 1, weaponState _unit select 2];
};

Share this post


Link to post
Share on other sites

Hi sorry to bring up this old stuff again.
I need to make  a Praetorian1C to fire at ground unit (sodier, zombie, etc).

I tried using trigger combine with doTarget, doFire, but no luck.

Also have tried Bangabob's script above - but returned error on forceWeaponFire.

Any advice?

Thanks

Share this post


Link to post
Share on other sites
3 hours ago, palatine said:

Hi sorry to bring up this old stuff again.
I need to make  a Praetorian1C to fire at ground unit (sodier, zombie, etc).

I tried using trigger combine with doTarget, doFire, but no luck.

Also have tried Bangabob's script above - but returned error on forceWeaponFire.

Any advice?

Thanks

 

shootme.sqf in mission root:

params ["_target"];

_laserT = createVehicle ["LaserTargetW", [0,0,0], [], 0, "NONE"];
_laserT attachto [_target, [0, 0, 0]];

_cleanUp = [_target, _laserT] spawn {

    waituntil {!alive (_this select 0)};
    deletevehicle (_this select 1);
    true

};

 

In the infantry init field:

_bombToTheFace = [this] execVM "shootme.sqf";

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

Hi Grumpy, thanks, but still phalanx won't fire at the target.
Is there any restriction in the weapon/ammo that makes phalanx only firing on air target?
This site    https://configs.arma3.ru/   was helpful to me, but it's only up to 1.62, so I can't find phalanx config. :(

Share this post


Link to post
Share on other sites

I think I got the solution...I just know that actually we can add/remove vehicle weapons during game runtime (without mod/addons).
So a mere simple script like this will make the phalanx noisy :D

this addWeapon "gatling_20mm"; 
this addMagazine "2000Rnd_20mm_shells"; 
this addMagazine "2000Rnd_20mm_shells"; 

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

×