Jump to content
Sign in to follow this  
Guest

Make AI Target Entire Group?

Recommended Posts

Guest

Hi all,

I am messing around with the mission editor, and I have set up a mission where a Shilka ambushes a convoy from very long range. (1000m+)

Unfortunately, even with AI mods, the AI are incapable of targeting anything at ranges longer than about 800m. So the Shilka would just sit there as the convoy drove past.

Using DoTarget, and Dofire, I have successfully forced the Shilka to open fire on the vehicles, and it is epic! I have created a trigger that basically says:

"When Truck1 enters trigger, target Truck1, open fire on Truck1"

Gunman1 doTarget Target1; Gunman1 doFire Target1;

The above code forces the Shilka to open fire, but unfortunately, as soon as the truck is destroyed, the Shilka stops firing. By this point, the trucks full of troops have unloaded and everyone is scattering for cover, but the Shilka will not engage the soldiers.

So here is my question:

Is there any way, that instead of the Shilka targeting "Target1", (a single target), I can get it to target an entire group?

For example, it might be similar to this:

"Gunman1 doTarget Group1; Gunman1 doFire Group1;"

This way, I could get the Shilka to engage the whole group, not just a single Target.

Thanks very much for any help! I greatly appreciate it!

Richie.

Share this post


Link to post
Share on other sites

Try using the lookat command combined with the fire command on the shilka gunner. You may not need lookat but I find it works reliably. The fire command should work on the turret very well unless recent patches have changed the behaviour.

Share this post


Link to post
Share on other sites
Guest

Hi mate,

Thanks very much for the reply! Could you maybe go into a little more detail with the lookat command?

How would I place it in the trigger?

"Gunman1 lookat Target1; Gunman1 doFire Target1;?

Thanks!

Share this post


Link to post
Share on other sites

The trigger will run the code but I would use a script and run it with a trigger.

The lookat part should only be needed to aim the turret. If its stays aimed allready then you should not need it.

The fire command works like this:

unit fire weaponName

e.g.

Shilkaname fire "AZP85" - this might not be the right weapon so you will have to test this. If its right you should have complete controll of the Shilkaname gun.

lookat works like this:

unit lookat target/position target

shilkagunner lookAt target1

this would work if your shilka gunner was named shilkagunner and your target unit would be named target1. If your crew is spawned in the tank you can run the gunner command to get the gunner unit instead of his name.

shilkagunner = gunner shilkaname;shilkagunner lookat target1;shilkagunner fire "AZP85"

I would put them in separate triggers just to test them and give the lookat part some time to aim the barrel. Then I would put the code into a script and execute it somehow like from a trigger or init.sqs.

Edited by TJ72

Share this post


Link to post
Share on other sites
Guest

Ok thanks a lot! I really appreciate the detailed help! :)

I'm going to get experimenting now!

Share this post


Link to post
Share on other sites

Here's the odd thing I just set up a test, I paced a Hummer 1000 meters away from a Shilka and put this reveal car;this dofire car in the init line. I also set skill slider to max and nothing happened. But if I put myself in as commander the Shilka suddenly has improved ability and opens fire even though I've done nothing.

Share this post


Link to post
Share on other sites
Guest
Here's the odd thing I just set up a test, I paced a Hummer 1000 meters away from a Shilka and put this reveal car;this dofire car in the init line. I also set skill slider to max and nothing happened. But if I put myself in as commander the Shilka suddenly has improved ability and opens fire even though I've done nothing.

Perhaps your AI skill is something to do with it?

Like, on the difficulty you play on, is enemy AI skill lower than friendly AI skill?

And how about in your config?

Hope that helps!

Share this post


Link to post
Share on other sites

Simple enough:

removeAllWeapons this;
this addMagazine "1350Rnd_30mmAP_A10";
this addWeapon "GAU8";

:butbut: :yay:

Share this post


Link to post
Share on other sites

Obviously, something in the AI logic is deciding for you what should be fired upon and when. Im not sure why that would change when the player is commander but it obviously means the AI full crews will not dofire reliably unless the firing conditions are considered good enough by said AI logic.

The AI wont reliably fire on what the mission designer wants them to unless the weapon is force aimed and force fired and that is why I use the fire and lookat commands because it pushes the AI to fire no matter what. Its nice when dofire works and I have made scripts that try it and if it fails then go to the next method.

The lookat command is reliable but if the AI is distracted by nearby enemies it may start to aim off the desired target so the lookat command has to be entered again like in a simple loop.

Share this post


Link to post
Share on other sites
Here's the odd thing I just set up a test, I paced a Hummer 1000 meters away from a Shilka and put this reveal car;this dofire car in the init line. I also set skill slider to max and nothing happened. But if I put myself in as commander the Shilka suddenly has improved ability and opens fire even though I've done nothing.

I've had similar experiences, especially at night. It turns out that even though you can force them to know about an object with reveal, it can still tag them as "unknown" which forces them to hold fire.

Share this post


Link to post
Share on other sites

Actually you only need to be grouped to the Shilka, you don't even have to be in it.

---------- Post added at 07:36 PM ---------- Previous post was at 07:31 PM ----------

Perhaps your AI skill is something to do with it?

Like, on the difficulty you play on, is enemy AI skill lower than friendly AI skill?

And how about in your config?

Hope that helps!

I have AI set to super AI and difficulty is regular.

I'm not using mods or changed config files.

I've thrown up a Ticket for it anyway. http://dev-heaven.net/issues/24066

Share this post


Link to post
Share on other sites
Guest

Ok so I got everything nailed down, and this is what the final ambush looks like:

GJGPsjQhgsc&feature=channel_video_title

Thanks for all the help!

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  

×