Jump to content
Sign in to follow this  
doubledizz

setfriend no longer works (how to get OPFOR to attack civilians)

Recommended Posts

I've got the following in my init file:

civilian setFriend [opfor, 0];
opfor setFriend [civilian, 0];

It doesn't work. Nor does adding it to a unit init line.

Can anyone please help me get OPFOR units attacking civilians OR a script to change Indep into random civilian clothing please. I've been trying this for hours now and still can't get anything to work.

This was the script I tried to get Indep to wear civilian clothing, but it hasn't worked.

this is removeitems.sqf


_civ_clothes = ["U_C_Commoner1_1",
               "U_C_Commoner1_2",
               "U_C_Commoner1_3",
               "U_C_Poloshirt_blue",
               "U_C_Poloshirt_burgundy",
               "U_C_Poloshirt_redwhite",
               "U_C_Poloshirt_salmon",
               "U_C_Poloshirt_stripped",
               "U_C_Poloshirt_tricolour"];

_unit = _this select 0;

// Remove original equipment
removeAllWeapons _unit;
removeUniform _unit;
removeHeadgear _unit;
removeVest _unit;
removeBackpack _unit;
_unit unassignItem "NVGoggles";
_unit removeItem "NVGoggles";

// Add clothing
_cloth_item = _civ_clothes call BIS_fnc_selectRandom;
_unit addUniform _cloth_item;

and this went in the unit's init line

nul = [this] execVM "removeitems.sqf"

I am about to rip my hair out. Help!

Share this post


Link to post
Share on other sites

You can simply group a civil unit to an (high ranking) independend or a bluefor unit and set the presence of the bluefor/independend unit to zero. Then the civ unit will show up as bluefor or independend. Thats they easiest way without fuzz.

Share this post


Link to post
Share on other sites

unfortunately not, the civilians are being generated with Dynamic Civilian Life. Too many for me to create manually...

Share this post


Link to post
Share on other sites

You may edit the script part when the civvies are created, and put another line joining them with the enemy unit you placed in map...

This will make all the civvies created enemy to whatever faction you need from the begining.

If you wan't to do this from certain point, then maybe a solution name that enemy with zero condition (let's say "enemigo"), place a trigger covering the whole area, selecting the civilians present, the condition you want, and on Act put something like: civvies = thislist; {[_x] joinSilent enemigo} forEach civvies

Not tested...

Share this post


Link to post
Share on other sites

setfriend would appear to be bugged. I was building a mission today and copied the init.sqf from a mission where setfriend worked. It didn't work in the mission I was building, so I started a new mission, copied in the same init.sqf file without editing it and it worked perfectly, so the script in the file must be correct but something in the mission must conflict with it. The advanced intel had exactly the same settings so it must be something else in the mission. I used the script from Das Attorneys other thread and that stopped them attacking each other, but some triggers no longer worked. The triggers shouldn't have been affected by the script.

Share this post


Link to post
Share on other sites

The code I used was

{ 
   _group = _x; 
   if (side _group == east) then 
   { 
       _newGroup = createGroup independent; 
       (units _group) joinSilent _newGroup; 
       deleteGroup _group; 
   }; 
   if (side _group == civilian) then 
   { 
       _newGroup = createGroup west; 
       (units _group) joinSilent _newGroup; 
       deleteGroup _group; 
   }; 
} forEach allGroups;  

The setfriend in the init was

EAST setFriend [WEST, 1];
WEST setFriend [EAST, 1];

---------- Post added at 20:44 ---------- Previous post was at 20:41 ----------

I altered the code for my mission to this

{  
   _group = _x;  
   if (side _group == east) then  
   {  
       _newGroup = createGroup west;  
       (units _group) joinSilent _newGroup;  
       deleteGroup _group;  
   };  

};

Share this post


Link to post
Share on other sites

Have you guys created centers by createcenter? I guess a placed unit on the editor does that but spawned units do not. Just a what if tip.

Share this post


Link to post
Share on other sites

Try doing this:

{   
   _group = _x;   
   if (side _group == east) then   
   {   
       _newGroup = createGroup west;   
       (units _group) joinSilent _newGroup;   
       deleteGroup _group;   
   };   
} forEach allGroups;

I should point out though that if West and East are already friends, then changing all of the East groups into West ones will achieve nothing (as they were already friends, and now will be on the same side).

What are you trying to achieve?

Enemies to friends, or friends to enemies (or something else)?

Share this post


Link to post
Share on other sites

I should point out though that if West and East are already friends, then changing all of the East groups into West ones will achieve nothing (as they were already friends, and now will be on the same side).

What are you trying to achieve?

Enemies to friends, or friends to enemies (or something else)?

I was trying to stop a CSAT convoy firing on a FIA fireteam. The setfriend command didn't work, so I substituted your code instead of the setfriend, which did work. Then the convoy wouldn't set off when the trigger was completed by the FIA fireteam. There is nothing in your code that should cause this to happen. Until I added the CSAT convoy the mission was working perfectly, even after I added the setfriend command. The only problem was that CSAT engaged the fireteam and everyone died which is bit of a mission breaker. I think there must something in the mission causing a problem, and the only way round it is to start from scratch. I will try deleting anything unnecessary first in case that fixes it. I can think of a couple of ways of altering the mission without setfriend, but require specific timings which aren't always reliable and is not good. Whilst the player can engage the convoy if he wants, I don't want the AI firing at each other first.

Share this post


Link to post
Share on other sites

Thanks for logical reply. :)

It could be a number of things that are causing the problem from what you say.

1 - Are you setting up "friend" status only in the init.sqf? (ie: not doing it when mission is underway)

2 - How is the trigger set up for the FIA?

If you like, post up the mission here or PM a copy of the mission to me and I can have a look. I can't promise I can get it sorted, but don't mind trying.

Share this post


Link to post
Share on other sites

Why can't you put the FIA group into a civ group temporarily?

Share this post


Link to post
Share on other sites

I have done a bit of testing this morning just using the setfriend command. If I put an FIA rifleman against an OPFOR rifleman on the runway at the airfield on Stratis then setfriend works. If I move the two riflemen elsewhere on the map, Kamino for instance, setfriend doesn't work. The problem with setfriend seems to be one of locality on the map. I will try and use setcaptive for the FIA squad while the convoy passes.

Share this post


Link to post
Share on other sites

As stated before, usually you use WEST, EAST, independent and civilian as parameters for setfriend.

I've tested it today with these settings: east unit and civilian unit (man) on the map. After five seconds a trigger sets civilian and east hostile to each other. At this point the east units starts to aim at snakes but does not fire at the snake and at civilians.

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  

×