Jump to content
Lala14

[RELEASE] Vehicle IR strobe

Recommended Posts

16 hours ago, Jnr4817 said:

How do I get rid of the time variable? I want the IR strobe to work at any given time, not just between 1800-0500. 

 

Thanks 

remove the "daytime" condition(s) in the addAction(s)

  • Like 1

Share this post


Link to post
Share on other sites

Hey @Lala14 been using this for years now with no problems, but recently the strobe seems to be way above the helmet and floating in the air, any chance of a fix? it seems the Contact DLC broke it.

 

Thanks.

Share this post


Link to post
Share on other sites
On 8/23/2019 at 3:07 AM, darkxess said:

Hey @Lala14 been using this for years now with no problems, but recently the strobe seems to be way above the helmet and floating in the air, any chance of a fix? it seems the Contact DLC broke it.

 

Thanks.

Huh, I'm guessing Bohemia must have moved the mempoint or something rather on the character model to cause that, it'll just be simply adjusting the offset value where the attachTo occurs in the script, I can post an update to the script sometime this week, been super busy with life atm

  • Like 1

Share this post


Link to post
Share on other sites

@darkxess I went ahead and tried to replicate the issue you were saying but I haven't had any issues, are you able to maybe provide a mission or steps to reproduce?

  • Like 1

Share this post


Link to post
Share on other sites
On 8/31/2019 at 3:01 PM, Lala14 said:

@darkxess I went ahead and tried to replicate the issue you were saying but I haven't had any issues, are you able to maybe provide a mission or steps to reproduce?

 

lol ooo so sorry mate, I didn't get the notification for some reason that you replied. So for my late reply - "strange that is, I did it exactly how I have always used it in our missions and never had the problem since the last update".

I will try it again as I have not used it for a while and see if its still the same 🙂

Share this post


Link to post
Share on other sites

Here you go mate, follow up from my post above... showing that its no longer on the helmet but very much above it. This was only using CBA and Archiles mod.

 

Image one / Image two (hosted on imgur)

Share this post


Link to post
Share on other sites

lol nope, that's not it ...

Look Here 😄 

If you tell me which line to edit then I can play around with it myself live, then once I have it on spot I will send the fixed version back to you.

Also which parts do I mess around with or comment out to stop it working on vehicles? there is a bug with the USS Liberty and the automatic boats that 

drop from the side when you release and/or attach back to the main vessel the Ir Strobe option spams the menu and its kind of messed up where nothing then works 😛

Share this post


Link to post
Share on other sites

You have to set the option in the script line no 13 Player_IR_SF to 1 to have it position it on the head.

As for moving the position around line no 61 has _pos, change those numbers around, you can see _muzzle = "head" for the head part and _muzzle = "spine3" for the chest connection part.

As for the  attach/take they're both on lines 30 and 31, if you comment those out it should disable them.

Share this post


Link to post
Share on other sites

Here you go mate, all fixed and as it once was. Changed around some of the values to fit it exactly onto the helmet as before but also commented out attach too for my own reason (as mentioned)
 

Spoiler

// // // // // // // // // // // // // // // // // // // // // // // // // // // // //
// Player IR script
// Version 5.6b
// Date: 2020.02.14
// Authors: Lala14, Tajin
// Feel free to edit, would appreciate it if you also post your own strobe setups ;)
// // // // // // // // // // // // // // // // // // // // // // // // // // // // //

// init line:
// nul = [] execVM "irstrobe.sqf";

/*DEFINABLE*/
Player_IR_SF = 1; //Position for IR strobe Position, either 1 for on the head or 0 for on the vest
Player_IR_Debug = 0; //See which vehicles are moving their strobes and what positions
IR_Item_Restric = 1; //Restrict IR to military uniform only (uses blacklist instead of whitelist) if set to 0 still requires at least something in the slot
Player_IR_Mark_Sides = 0; //If set to one on radar Units will come up as friendly when using IR strobe if set to 0 they come up as empty on radar

/*Don't touch unless you know what your doing*/
if (isDedicated) exitWith {};

waitUntil {!isNull player};

HelmetsM = ["","H_Shemag_khk","H_Shemag_olive","H_Shemag_olive_hs","H_Shemag_tan","H_ShemagOpen_khk","H_ShemagOpen_tan","H_StrawHat","H_StrawHat_dark","H_TurbanO_blk","H_Watchcap_blk","H_Watchcap_camo","H_Watchcap_khk","H_Watchcap_sgg","H_MilCap_blue","H_MilCap_dgtl","H_MilCap_gry","H_MilCap_mcamo","H_MilCap_ocamo","H_MilCap_oucamo","H_MilCap_rucamo","H_Beret_02","H_Beret_blk","H_Beret_blk_POLICE","H_Beret_brn_SF","H_Beret_grn","H_Beret_grn_SF","H_Beret_ocamo","H_Beret_red","H_Booniehat_dgtl","H_Booniehat_dirty","H_Booniehat_grn","H_Booniehat_indp","H_Booniehat_khk","H_Booniehat_khk_hs","H_Booniehat_mcamo","H_Booniehat_tan","H_Cap_blk","H_Cap_blk_CMMG","H_Cap_blk_ION","H_Cap_blk_Raven","H_Cap_blu","H_Cap_brn_SPECOPS","H_Cap_grn","H_Cap_grn_BI","H_Cap_headphones","H_Cap_khaki_specops_UK","H_Cap_oli","H_Cap_oli_hs","H_Cap_red","H_Cap_tan","H_Cap_tan_specops_US","H_Bandanna_camo","H_Bandanna_cbr","H_Bandanna_gry","H_Bandanna_khk","H_Bandanna_khk_hs","H_Bandanna_mcamo","H_Bandanna_sgg","H_Bandanna_surfer","H_BandMask_blk","H_BandMask_demon","H_BandMask_khk","H_BandMask_reaper"];
VestsM = ["","V_Rangemaster_belt","V_BandollierB_blk","V_BandollierB_cbr","V_BandollierB_khk","V_BandollierB_oli","V_BandollierB_rgr","V_Chestrig_blk","V_Chestrig_khk","V_Chestrig_oli","V_Chestrig_rgr"];

LALA_fnc_Strobe_addActions = {
	player setVariable ["strobeplayer",objNull,true];
	IRstrobeOn = player addAction ["<t color='#FF0000'>IR Strobe On</t>", {(_this select 0) spawn LALA_fnc_IRStrobeOn;},"",-99,false,true,"",'(isNull (_target getVariable "strobeplayer")) && (_target == _this) && (daytime > 18.7 OR daytime < 5.3) &&  if (IR_Item_Restric == 1) then { if (Player_IR_SF == 1) then { !(headgear _this in HelmetsM) } else { !(vest _this in VestsM) }; } else { if (Player_IR_SF == 1 ) then { (headgear _this != "") } else { (vest _this != "") } };'];
	IRstrobeOff = player addAction ["<t color='#FF0000'>IR Strobe Off</t>", {(_this select 0) spawn LALA_fnc_IRStrobeOff;},"",-99,false,true,"",'!(isNull (_target getVariable "strobeplayer")) && (_target == _this)'];
  /*AttachIRAction = player addAction ["<t color='#FF0000'>Attach IR Strobe</t>", {(_this select 0) spawn LALA_fnc_AttachIR;},"",-99,false,true,"",'(("B_IR_Grenade" in magazines _this) OR ("O_IR_Grenade" in magazines _this) OR ("I_IR_Grenade" in magazines _this)) && typeName (nearestvehicle) == "OBJECT" && (_target == _this) && (nearestvehicle getVariable "strobes") isEqualTo false && [_target] call LALA_fnc_Refresh'];
	TakeIRAction = player addAction ["<t color='#FF0000'>Take IR Strobe</t>", {(_this select 0) spawn LALA_fnc_TakeIR;},"",-99,false,true,"",'typeName (nearestvehicle) == "OBJECT" && typeName (nearestvehicle getVariable "strobes") == "OBJECT" && (_target == _this)'];*/
	player addAction ["<t color='#FF0000'>UGV Strobe On</t>", {(playeruav) spawn LALA_fnc_CreateIR;},"",-99,false,true,"",'typeName (playeruav getVariable "strobe") != "OBJECT" && (daytime > 18.7 OR daytime < 5.3) && playeruav isKindOf "LandVehicle" && (_target == _this) && [_target] call LALA_fnc_UavRefresh']; //UGV or any other land typed Uav
	player addAction ["<t color='#FF0000'>UAV Strobe On</t>", {(playeruav) spawn LALA_fnc_CreateIRAir;},"",-99,false,true,"",'typeName (playeruav getVariable "strobe") != "OBJECT" && (daytime > 18.7 OR daytime < 5.3) && playeruav isKindOf "Air" && (_target == _this) && [_target] call LALA_fnc_UavRefresh']; //UAV or any other Air type UAV
	player addAction ["<t color='#FF0000'>UGV Strobe Off</t>", {(playeruav) spawn LALA_fnc_DeleteIR;},"",-99,false,true,"",'typeName (playeruav getVariable "strobe") == "OBJECT" && playeruav isKindOf "LandVehicle" && (_target == _this) && [_target] call LALA_fnc_UavRefresh'];
	player addAction ["<t color='#FF0000'>UAV Strobe Off</t>", {(playeruav) spawn LALA_fnc_DeleteIRAir;},"",-99,false,true,"",'typeName (playeruav getVariable "strobe") == "OBJECT" && playeruav isKindOf "Air" && (_target == _this) && [_target] call LALA_fnc_UavRefresh'];
};

LALA_fnc_IRStrobeOn = {
	private ["_strobe","_pos","_muzzle"];
	if (Player_IR_Mark_Sides == 1) then {
		if (side _this == EAST) then {
			_strobe = "NVG_TargetW" createVehicle getPos _this;
		};

		if (side _this == WEST) then {
			_strobe = "NVG_TargetE" createVehicle getPos _this;
		};

		if (side _this == resistance) then {
			_strobe = "NVG_TargetC" createVehicle getPos _this;
		};
	} else {
		_strobe = "NVG_TargetC" createVehicle getPos _this;
	};
	if !(isNull _strobe) then {
		_this setVariable ["strobeplayer",_strobe,true];
	};

	if (isNull _strobe) exitWith { systemChat "failed to create strobe for player"; };

	if (Player_IR_SF == 1) then { _pos = [-0.01,0,0.30]; _muzzle = "head"; } else { _pos = [-0.1,0.3,0]; _muzzle = "spine3" };

	if (Player_IR_Debug == 1) then { _this groupChat format ["strobe attachto %1",[getText (configFile >> "cfgVehicles" >> typeOf _this >> "displayName"),_pos,_muzzle]]; };
	if (Player_IR_Debug == 1) then {
		if (str _pos != "[0,0,0]") then {
			hintSilent format ["%1 has moved the strobe into the defined position",getText (configFile >> "cfgVehicles" >> typeOf _this >> "displayName")];
		} else {
			hintSilent format ["%1 has no _pos defined",typeOf _this];
		};
	};
	_strobe attachTo [_this, _pos, _muzzle];
	//the following was an alternative way to use selectionPosition to return position from different LOD
	/*while {!isNull _strobe} do {
		if (isNull _strobe) exitWith {};
		_nPos = (_this selectionPosition [_muzzle,"HitPoints"]) vectorAdd _pos;
		_strobe attachTo [_this,_nPos];
		sleep 1e-2;
	};*/
};

LALA_fnc_IRStrobeOff = {
	deleteVehicle (_this getVariable "strobeplayer");
	_this setVariable ["strobeplayer",objNull,true];
};


LALA_fnc_AttachIR = {
	if ("B_IR_Grenade" in magazines _this && typeName (nearestvehicle getVariable "strobes") == "BOOL") then {
		_this removeMagazine "B_IR_Grenade";
		nearestvehicle setVariable ["TypeIR","B_IR_Grenade",true];
		_this playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
		_attachstrobe = "NVG_TargetW" createVehicle [0,0,0];
		_attachstrobe attachTo [_this,[0,0,0],"leftHand"];
		sleep 1;
		_attachstrobe attachTo [nearestvehicle];
		nearestvehicle setVariable ["strobes",_attachstrobe,true];
	};

	if ("O_IR_Grenade" in magazines _this && typeName (nearestvehicle getVariable "strobes") == "BOOL") then {
		_this removeMagazine "O_IR_Grenade";
		nearestvehicle setVariable ["TypeIR","O_IR_Grenade",true];
		_this playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
		_attachstrobe = "NVG_TargetE" createVehicle [0,0,0];
		_attachstrobe attachTo [_this,[0,0,0],"leftHand"];
		sleep 1;
		_attachstrobe attachTo [nearestvehicle];
		nearestvehicle setVariable ["strobes",_attachstrobe,true];
	};

	if ("I_IR_Grenade" in magazines _this && typeName (nearestvehicle getVariable "strobes") == "BOOL") then {
		_this removeMagazine "I_IR_Grenade";
		nearestvehicle setVariable ["TypeIR","I_IR_Grenade",true];
		_this playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
		_attachstrobe = "NVG_TargetC" createVehicle [0,0,0];
		_attachstrobe attachTo [_this,[0,0,0],"leftHand"];
		sleep 1;
		_attachstrobe attachTo [nearestvehicle];
		nearestvehicle setVariable ["strobes",_attachstrobe,true];
	};
};

LALA_fnc_TakeIR = {
	_this playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
	sleep 1;
	deleteVehicle (nearestvehicle getVariable "strobes");
	_this addMagazine (nearestvehicle getVariable "TypeIR");
	nearestvehicle setVariable ["TypeIR",nil,true];
	nearestvehicle setVariable ["strobes",false,true];
};

LALA_fnc_Refresh = {
	_unit = _this select 0;
	_nearvehicle = nearestObjects [_unit,["Air","Ship","LandVehicle"],7];
	nearestvehicle = _nearvehicle select 0;

	attachirname = format ["<t color='#FF0000'>Attach IR Strobe to %1</t>",getText (configFile >> "cfgVehicles" >> typeOf nearestvehicle >> "displayName")];
	takeirname = format ["<t color='#FF0000'>Take IR Strobe from %1</t>",getText (configFile >> "cfgVehicles" >> typeOf nearestvehicle >> "displayName")];

	_unit setUserActionText [AttachIRAction,attachirname];
	_unit setUserActionText [TakeIRAction,takeirname];

	{ if ( (isNil {_x getVariable "strobes"}) ) then {
		_x setVariable ["strobes",false,true];
		};
	} forEach vehicles;

	_return = ( (count _nearvehicle > 0) && (alive _unit) );
	_return
};

LALA_fnc_UavRefresh = {
	_unit = _this select 0;
	playeruav = getConnectedUav _unit;
	_UavReturn = (typeName (playeruav) == "OBJECT");
	_UavReturn
};

[] spawn LALA_fnc_Strobe_addActions;
player addEventHandler ["Respawn", {
	[] spawn LALA_fnc_Strobe_addActions;
}];

sleep 0.1;

if (Player_IR_SF == 1) then {
	player setUserActionText [IRstrobeOn,"<t color='#FF0000'>IR Strobe On</t>"];
	player setUserActionText [IRstrobeOff,"<t color='#FF0000'>IR Strobe Off</t>"];
} else {
	player setUserActionText [IRstrobeOn,"<t color='#FF0000'>IR Strobe On</t>"];
	player setUserActionText [IRstrobeOff,"<t color='#FF0000'>IR Strobe Off</t>"];
};

 

Thank you 🙂

Edited by Dedmen
Put the Code into a Spoiler tag, please don't just paste blobs of text into a post without a spoiler tag

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

×