OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: zwobot on 31 Jul 2011, 16:41:29

Title: [solved] How to make friendly groups engage each other?
Post by: zwobot on 31 Jul 2011, 16:41:29
Hi Community,
I want to trigger friendly units to engage the player's squad and stop the friendly units engaging the player's squad if a certain condition is met.

I tried setting a negative rating to all the units in the player's group via addRating but this makes the AI units in the player's group engage each other.

Background:
in my mission the player's squad is reentering friendly lines in the dark after a patrol and the player has to challenge the observation post to identify his group as friendlies.
Failing to do this there would be a chance that the AI manning the observation post would engage the player's squad until they use the correct challenge and password.

I need a solution which I can turn on mid-mission since the player's squad will have contact with another friendly group prior to approaching the observation post.

Edit:
another approach I just tried is to joinSilent the player's group to a WEST unit and back to an EAST unit once correctly challenged.
Basically this works however: Apart from the command bar being cluttered with the 'foreign' dummy units, also triggers checking for the presence of the group attached to the original player group seize working after these measures.
Title: Re: How to make friendly groups engage each other?
Post by: Ext3rmin4tor on 01 Aug 2011, 01:55:03
You can create a group for an enemy side (enemy to player's side and thus to all the other groups of that side) with createGroup. After that use joinSilent as you did. If there is no pre-placed unit on the map for the new group side, remember to first use createCenter for that side or it won't work.

Do the same to switch back to a friendly group.
Title: Re: How to make friendly groups engage each other?
Post by: zwobot on 01 Aug 2011, 07:58:58
Thanks Ext3rmin4tor, your solution works how I wanted  :good:

The only problem now is the presence triggers linked directly to the group are not working. As an alternative I can link the triggers only to the player ('Vehicle' activation instead of 'Whole group').
Title: Re: How to make friendly groups engage each other?
Post by: Wolfrug on 01 Aug 2011, 09:46:59
I suggest you don't use triggers linked to the group, instead use something like this in the On Activation field:

Code: [Select]
{_x in thisList} count units group Player > 0
That's the same as "any unit of the group inside this trigger's area".

Code: [Select]
Player in thisList
= Activated by the player only.

Remember to leave the trigger activations as "Anyone" instead of "BLUFOR" or "OPFOR", since the Player's group will change allegiance half-way through :)

Wolfrug out.
Title: Re: How to make friendly groups engage each other?
Post by: zwobot on 03 Aug 2011, 20:44:52
That does the trick. Thank you  :)