Jump to content
Johno89

A2 Trial by Fire - port to A3 - ai spot distance issue

Recommended Posts

Hi all

 

I've ported the Arma 2 single player scenario Trial by fire to Arma 3. After play testing it I'm certain the scenario behaves the same as the A2 original. However, there is one problem which I can't fix despite trying numerous fixes I've found on these forums/bi wiki.

 

In the original mission, you and the Ai squad are air lifted to Utes island, during transit they don't spot any enemies, they disembark the helicopter and promptly run up the hill as their behaviour is set to aware.

In my A3 port, you and the Ai squad are air lifted to Utes island, during transit they spot enemies up to 2km away, they disembark the helicopter and slowly run/walk up the hill as their behaviour now set to combat.

 

I've tried all sorts of things such as 'disableAi' and 'setskill spotdistance' in the units init field but nothing works. Every time the helicopter nears the beach the Ai engage Legolas vision and set themselves to combat mode when they see an enemy. Aside from putting 100% fog down on the map how can I prevent this from happening? Is this something i can rectify in the units init field or does it require scripting in a sqf file?

 

Thanks for your time

Cheers

Share this post


Link to post
Share on other sites

Set their behavior to "CARELESS" until you want them aware.

  • Like 1

Share this post


Link to post
Share on other sites

I'll try this after work. Would it I set each individual unit to 'CARELESS' or should I click the group icon and do it there?

 

Cheers

Share this post


Link to post
Share on other sites

Yeah this doesn't work, I set the group to "CARELESS" and their first move way-point as "CARELESS" as well. But when the chopper neared the beach I heard those fateful words..... 'Enemies!' The Ai raise their weapons, begin aiming out the chopper and set their behavior to "COMBAT". When they disembark they are slow as fuck getting up the hill, instead of just running at full speed.

Share this post


Link to post
Share on other sites
23 hours ago, Johno89 said:

'setskill spotdistance'

 

#also

This works by the way , but you need to test the desired amount :

Ex : add this in your initserver

{
	if(
		(alive _x)
		&& (!(side group _x == playerSide))
		)then{
			_x setSkill ["spotDistance", 0.05 + (random 0.05)];
	};
}forEach allUnits;

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Hi George

 

I've tried the setCaptive approach, upon mission startup instead of being inside the helicopter the squad was standing on the deck of the ship.....some of them floating in the sea lol. I've also read that if you set Ai to captive and then revert them back to opfor/blufor it screws up their move waypoints etc.

 

Thanks for the code you provided, however how do i configure it for the Ai squad that the player joins? Their details are as follows:

 

Squad leader

Object Init

Variable name: recon

Init: crewman moveInCargo heli; {_x moveInCargo heli} forEach units group this; BIS_grpMain = group this;

 

Cheers

John

 

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Johno89 , can you write below exacly what you want to do , in order to make this more clear ?

 

How many squads there are ?

The SL is a player or ai ?

The units are placed in the editor and they are active with WP or you just activate them to be playable in the lobby or they spawn ?

Do you want to apply the code to the friendly or the enemy?

 

You can change the side of the enemy to yours and change them again with a trigger , or as i post above with setcaptive or setFriend.

 

  • Thanks 1

Share this post


Link to post
Share on other sites

George

 

I'll attach images of the editor so hopefully it'll explain things better. The first image is at mission start when on the ship. The second is when the heli unloads the squad on Utes island. 

 

First Image

Spoiler

Ship.jpg

 

 

Second image

Spoiler

utes.jpg

 

Note this is a single player scenario only. The player joins an Ai squad and is always led by them (unless they are killed ofc). The problem is when the helicopter is flying in to unload the squad, they spot the enemy on Utes island.  They then set their behavior to COMBAT and as a result of this when moving from first to second waypoints they are slow because they are seeking cover. In the original A2 mission the Ai squad don't set themselves to COMBAT but stay as AWARE, when unloaded they run up the hill at full speed.

 

All attempts I've made at preventing the squad spotting the enemy have been done in their init fields, but nothing seems to work.

  • Thanks 1

Share this post


Link to post
Share on other sites
8 hours ago, Johno89 said:

All attempts I've made at preventing the squad spotting the enemy

 

Here is the example with setFriend :

add in your initserver.sqf

 

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

West setFriend [East, 1];

( you can also add the East to be friend with West )

 

and create a trigger with the following:

RhLhrC7.png

4OwLSNP.png

 

 

and since i also talk before about changing the side , here is also a quick example of a code , with the same workaround :

call{hint "changing independent to east";_change = allgroups select {side _x isEqualTo INDEPENDENT};
_change apply{
_newGrp = creategroup east; 
units _x joinSilent _newGrp; 
};}

 

  • Thanks 1

Share this post


Link to post
Share on other sites

George

 

I tried setFriend but cannot use this as the mission now ends straight away as soon as its started. The reason? I think its because now that WEST sees EAST as friend, the game assumes the final objective waypoint (which is to kill all opfor in a certain radius) has been facilitated. 

 

Instead of setfriend could you provide an example with 'setCaptive' for the ai squad only and when they move past a trigger it is removed?

 

Cheers

John

  • Like 1

Share this post


Link to post
Share on other sites
6 minutes ago, Johno89 said:

Instead of setfriend could you provide an example with 'setCaptive' for the ai squad only and when they move past a trigger it is removed?

 

Yes , use the same workaround and add your group name ex: grp_1 and add this in your initserver and add the same code "false" in your trigger.

{_x setCaptive true;}forEach units grp_1;

 

  • Thanks 1

Share this post


Link to post
Share on other sites

George

 

Thanks for the solution, had a few issues at first. When pasting the code into the init field of the trigger I couldn't hit enter as i received 'error in expression' message. It looks like you threw me a curve ball because there was a space missing between '} & forEach' lol.

 

Anyway after the code was in the trigger/init.sqf it still wouldn't work - despite the the Ai squad being named 'grp_1' in both entities. Then I realised in the init field of the squad leader this was present;

Spoiler

crewman moveInCargo UH1Y; {_x moveInCargo UH1Y} forEach units group this; BIS_grpMain = group this;

 

I then changed 'grp_1' to BIS_grpMain in both the trigger and init.sqf and it works!

 

Thanks for the help, now I've just gotta work through all the other errors!

 

Cheers

 

Edit: Jumped the gun here! It worked on the first attempt, on the second and third tries the Ai set themselves to combat. How the fuck are these annoying c***s suddenly disobeying code lol, it makes no logical sense!!!!.

  • Like 1

Share this post


Link to post
Share on other sites
On 6/5/2019 at 7:33 AM, Johno89 said:

Yeah this doesn't work, I set the group to "CARELESS" and their first move way-point as "CARELESS" as well. But when the chopper neared the beach I heard those fateful words..... 'Enemies!' The Ai raise their weapons, begin aiming out the chopper and set their behavior to "COMBAT". When they disembark they are slow as fuck getting up the hill, instead of just running at full speed.

 

You had to apply that on chopper!

  • Like 1

Share this post


Link to post
Share on other sites

 

On 6/11/2019 at 5:29 PM, pierremgi said:

You had to apply that on chopper!

Pierremgi this would not have worked as the ai squad is not in anyway shape or form linked to the helicopter. Its just a transport for them.

 

I did get this to work in the end (apologies for my bad language in the prior post, this issue was driving me insane lol) but not with setCaptive as this created more errors in the long run. Instead what i did was along the helicopters route I placed a trigger that it would pass through. It was linked to the Ai squad lead. In it i put the following code;

Spoiler

{_x disableAI "AUTOCOMBAT":} forEach units BIS_grpMain;

{_x disableAI "SUPPRESSION":} forEach units BIS_grpMain;

{_x disableAI "TARGET":} forEach units BIS_grpMain;

{_x disableAI "AUTOTARGET":} forEach units BIS_grpMain;

 

This prevented the Ai from setting their behaviour to COMBAT when they spotted enemy on Utes. They do call out enemy units, but their behaviour always stays as aware. At the top of the hill in front of the town (where the squad always runs through) I placed another trigger re enabling the 4 settings;

Spoiler

{_x enableAI "AUTOCOMBAT":} forEach units BIS_grpMain;

{_x enableAI "SUPPRESSION":} forEach units BIS_grpMain;

{_x enableAI "TARGET":} forEach units BIS_grpMain;

{_x enableAI "AUTOTARGET":} forEach units BIS_grpMain;

 

This setup works 99% of the time, the ai squad when disembarking the helicopter always run up the hill now at full speed (as intended) and never stop to seek cover.

 

Cheers for the help guys

 

  • Like 1

Share this post


Link to post
Share on other sites

Depending on what you want. On my Arma, I guess same as yours, when a group is in a captive vehicle, even if the team (group) is not captive, the enemy will not fire at the vehicle! Even if the vehicle (captive) fires at enemy. If you disembark the non-captive group, the enemy will fire at it, as usual. Simple as that!

Reproducible:

- place an opfor squad;

- place a Huron (armed) in front of it, 50 m high,  this setcaptive true in its init field;

- add a whole blufor squad into it; design the leader as player;

 

Preview

As you can see, the squad is not in the same group as the huron crew.

The opfor never fire at helo

The helo fires at them (captive doesn't mean friend)

Order "disembark", the helo will land even if pilot is not on your group

When disembarked, if you don't add any code, the blufor will be engaged by the remaining opfor.

 

  • Like 1

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

×