Jump to content
johnnyboy

[Release] JBOY Patrol Chatter and Lights On/Off scripts

Recommended Posts

...so Johnny, if I wanted to put this in Rydygiers Mission, "Pilgrimage", can you tell me how I can do this?  @zagor64bz had the question about "spawned AI". In Pilgrimage there are numerous spawned garisons (Patrols). Would you be able to provide me with a easy to understand (zeeeeero scripting ability) method to get this to work in Pilgrimage

OR

should I try to work this out in reverse by asking Rydygier to look at your mod and see what he might do?

 

Thanks!

Share this post


Link to post
Share on other sites

Hey @pvt. partz Its probably best to ask Rydgier.  Its a matter of calling my scripts when a group is spawned, and I don't know how he does that. So once that spawn script has created a group, you call my scripts:

dummy = [SPAWNED_GROUP_NAME, 60] execVM "Scripts\JBOY_PatrolChatter.sqf"; // 60 is number of seconds to wait between speaking
dummy = [SPAWNED_GROUP_NAME, 60, 5] execVM "Scripts\JBOY_LightsOnOff.sqf"; // 60 is duration light is off, and 5 is duration light is 

Just replace SPAWNED_GROUP_NAME with whatever Rydgier's spawn scripts call a newly spawned group.  Find Rydier's spawn scripts and it should be easy to add this in.

Share this post


Link to post
Share on other sites

....Hey Johnnyboy

Thanks for getting back to me.

I'll go wake up Rydygier and see what he says

😄

  • Haha 2

Share this post


Link to post
Share on other sites

Hey Jonnyboy, very nice scripts you put out for mission immersion.  I made a similar gun light script just didn't think anyone would be interested in it. I added a couple of checks, not just time of day but also if unit has NVGs. To me, it looked a  little strange for a unit to be walking around with NVGs on and flash light on. 

You are more than welcome to use it in your script if you want. The nvg_array contains BIS and CUP nvgs.

AI_gunlights = 
{

private ["_grp","_this","_items","_nvg_array"];

_nvg_array = [
				"CUP_NVG_PVS14","CUP_NVG_PVS14","CUP_NVG_PVS15_black","CUP_NVG_PVS15_green","CUP_NVG_PVS15_tan","CUP_NVG_PVS15_winter","CUP_NVG_PVS7","O_NVGoggles_ghex_F",
				"O_NVGoggles_hex_F","O_NVGoggles_urb_F","NVGogglesB_blk_F","NVGogglesB_grn_F","NVGogglesB_gry_F","CUP_NVG_GPNVG_black","CUP_NVG_GPNVG_green","CUP_NVG_GPNVG_tan",
				"CUP_NVG_GPNVG_winter","CUP_NVG_HMNVS","NVGoggles_OPFOR","NVGoggles","NVGoggles_INDEP","NVGoggles_tna_F","H_HelmetO_ViperSP_ghex_F","H_HelmetO_ViperSP_hex_F"
			];

_this= _this select 0;
_items = primaryWeaponItems _this; 


//time > 5;

		if ( !(isplayer _this) && {(side _this isequalto independent) || (side _this isequalto east)}) then 
		{	
			switch ("PARAM_GUNLIGHT_TOGGLE" call BIS_fnc_getParamValue ) do 
			{
				case 0: //off
				{				 
					
					_this enableGunLights "forceoff";
					
				};	
				case 1: //on
				{
					if ((date select 3) < 6 or (date select 3) > 19 ) then 
					{
						if ({_x in (items _this + assignedItems _this)}count _nvg_array > 0) exitwith {};
						_this removePrimaryWeaponItem (_items select 1);
						sleep .1;
						_this addPrimaryWeaponItem "acc_flashlight";  
						sleep .1;
						_this enableGunLights "forceon";
						
						while {!(_this isFlashlightOn (currentWeapon _this))} do
						//if (!(_this isFlashlightOn (currentWeapon _this))) then
							{
								_this enableGunLights "forceon";
								
								sleep 5;
							};	
					};
				};
				case 2: //random
				{	
					if ((date select 3) < 6 or (date select 3) > 19 ) then 
					{
						if ({_x in (items _this + assignedItems _this)}count _nvg_array > 0) exitwith {};
						_this addPrimaryWeaponItem "acc_flashlight"; 
						sleep .5;
						while {alive _this} do
						{
							_this enableGunLights "forceon";
							
							sleep 30 + random 30;
							_this enableGunLights "forceoff";
							
							
							sleep 20 + random 20;
						};
					};
				};
			};
		};

};

 

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, nomadd said:

To me, it looked a  little strange for a unit to be walking around with NVGs on and flash light on. 

Thanks nomad.  That is a very smart addition to this script.  Who would use a flashlight with NVG on?  Thanks bro!

Share this post


Link to post
Share on other sites

Whelp 😪

 

https://imgur.com/a/dVky9bD

 

error image, says it's missing a ";" and in second line it has some # that isn't present in first and third, so i tried to backspace it out and rewrite it but it didn't help....

Share this post


Link to post
Share on other sites

Hi Rok.  Sorry bud, but these scripts work for me.   They are fairly simple, so I don't know what went wrong for you.  But sometimes when you copy and paste from the forums you get strange invisible characters in your text.  So re-typing that part might fix it.  I know you said you did that, but its all I can think of.  Good luck.

  • Like 1

Share this post


Link to post
Share on other sites
29 minutes ago, johnnyboy said:

Hi Rok.  Sorry bud, but these scripts work for me.   They are fairly simple, so I don't know what went wrong for you.  But sometimes when you copy and paste from the forums you get strange invisible characters in your text.  So re-typing that part might fix it.  I know you said you did that, but its all I can think of.  Good luck.

 

I got so pissed i retyped everything and now it's working. 😂

  • Haha 1

Share this post


Link to post
Share on other sites
1 minute ago, Rok Stuhne said:

I got so pissed i retyped everything and now it's working

I'm glad its working for you.  I know that copy/paste weirdness is super frustrating.

  • 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

×