Jump to content

Recommended Posts

Hello guys:
I'm trying to get an FIA shooter to appear at night with night vision. I have prepared this script but it gives an error and does not do its job. Can someone tell me what am I doing wrong?

 

if (!isServer) exitWith {};

// SHOOTER //

_markerstr = createMarker ["Unit_1",[3263.3,912.274]];
_markerstr setMarkerShape "ICON";
_height = 0;
_pos = getMarkerPos "Unit_1";
_Unit_1 = [ [_pos select 0, _pos select 1, _height], EAST, ["O_G_Sharpshooter_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;
{_x setFormDir 0; _x allowFleeing 0; _x setdir 0; _x addItem "ACE_NVG_Gen4"; _x assignItem "ACE_NVG_Gen4"; _x enableAI "TARGET"; _x enableAI "AUTOTARGET"; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units _Unit_1;
_Unit_1 action ["ACE_NVG_Gen4", _Unit_1 ];

sleep 4;


Thanks.

Share this post


Link to post
Share on other sites
11 minutes ago, Coladebote said:

it gives an error

 

What is the error?

 

In the meantime, instead of 

_x addItem "ACE_NVG_Gen4"; _x assignItem "ACE_NVG_Gen4";

you can simply do

_x linkItem "ACE_NVG_Gen4";

 

  • Like 1

Share this post


Link to post
Share on other sites
19 minutes ago, Coladebote said:

_Unit_1 action ["ACE_NVG_Gen4", _Unit_1 ];

 

 

Not sure what you are trying to do here. Force the AI to use the NVGs? If it is dark out, they'll use them. Just remove that line.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Excellent. Suggested changes work perfectly. The shooter appears in the position with night vision activated. The little script, therefore, is as follows:

 

if (!isServer) exitWith {};

// SHOOTER //

_markerstr = createMarker ["Unit_1",[3263.3,912.274]];
_markerstr setMarkerShape "ICON";
_height = 0;
_pos = getMarkerPos "Unit_1";
_Unit_1 = [ [_pos select 0, _pos select 1, _height], EAST, ["O_G_Sharpshooter_F"],[],[],[],[],[],0] call BIS_fnc_spawnGroup;
{_x setFormDir 0; _x allowFleeing 0; _x setdir 0; _x linkItem "ACE_NVG_Gen4"; _x enableAI "TARGET"; _x enableAI "AUTOTARGET"; _x setUnitPos "AUTO"; _x setBehaviour "SAFE"; _x setCombatMode "RED"} forEach units _Unit_1;

sleep 4;

 

Harzach, thank you very much for your help.

Greetings from the Mediterranean coast.

  • Like 2

Share this post


Link to post
Share on other sites

btw, _unit_1 can't be a group && a unit. If I'm right you tried to pass the spawned group to action.

imho, too much similar names ("unit_1", _unit_1) for marker, group and unit. So, you're lost.

Try something like "mk1"  _grp1  and _unit1 as leader _grp1  or units _grp1 #0

 

Greetings from Pacific ocean.

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you very much Pierre. You know that this humble learner greatly values your opinions and advice. Thank.

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

×