Jump to content
L3GAL

Adding damage to a specific smoke

Recommended Posts

So I am trying to add damage to smoke and make it like a mustard gas. Unfortunately for me, I couldn't find it anywhere and I don't know how to script. Is there a way to do it or is this even possible? Thank you in advance.

Share this post


Link to post
Share on other sites

ToxicGas.sqf:

/*
	Author: AryX (noaim)
	Description: Toxic Gas (Green Smoke + GL Green Smoke)
	Version: 0.5
	Updated: 02.11.2019
*/

_gasMask = ["H_CrewHelmetHeli_B", "H_CrewHelmetHeli_O", "H_CrewHelmetHeli_I", "H_CrewHelmetHeli_I_E"];
_gasMaskGog = ["G_AirPurifyingRespirator_02_black_F", "G_AirPurifyingRespirator_02_olive_F", "G_AirPurifyingRespirator_02_sand_F", "G_AirPurifyingRespirator_01_F", "G_RegulatorMask_F"];
_exemptVehicles = ["B_MRAP_01_hmg_F", "B_MRAP_01_F", "B_MRAP_01_gmg_F", "O_MRAP_02_F", "O_MRAP_02_gmg_F", "O_T_MRAP_02_ghex_F", "O_T_MRAP_02_gmg_ghex_F", "O_MRAP_02_hmg_F", "I_MRAP_03_F", "I_MRAP_03_hmg_F", "I_MRAP_03_gmg_F", "B_MBT_01_cannon_F", "O_MBT_02_cannon_F", "I_MBT_03_cannon_F", "B_APC_Wheeled_01_cannon_F", "O_APC_Wheeled_02_rcws_F", "O_APC_Wheeled_02_rcws_v2_F", "I_APC_Wheeled_03_cannon_F", "B_APC_Tracked_01_AA_F", "B_APC_Tracked_01_CRV_F", "B_APC_Tracked_01_rcws_F", "O_APC_Tracked_02_AA_F", "O_APC_Tracked_02_cannon_F", "I_APC_tracked_03_cannon_F"];
_AAPositions = ["B_SAM_System_02_F","B_AAA_System_01_F"];

while {true} do {
	"dynamicBlur" ppEffectEnable true; // enables ppeffect
	"dynamicBlur" ppEffectAdjust [0]; // enables normal vision
	"dynamicBlur" ppEffectCommit 15; // time it takes to normal
	resetCamShake; // resets the shake
	20 fadeSound 1; //fades the sound back to normal
	
	waitUntil{
		((nearestObject [getPosATL player, "SmokeShellOrange"]) distance player < 10) and (getPosATL (nearestObject [getPosATL player, "SmokeShellGreen"]) select 2 < 0.5)
		or
		((nearestObject [getPosATL player, "G_40mm_SmokeOrange"]) distance player < 10) and (getPosATL (nearestObject [getPosATL player, "G_40mm_SmokeGreen"]) select 2 < 0.5) 
	};

	if (((((headgear player) in _gasMask) || (goggles player in _gasMaskGog)) && !((typeOf (vehicle player)) in _AAPositions)) || ((typeOf vehicle player) in _exemptVehicles)) then {
		"dynamicBlur" ppEffectEnable true; // enables ppeffect
		"dynamicBlur" ppEffectAdjust [0]; // intensity of blur
		"dynamicBlur" ppEffectCommit 3; // time till vision is fully blurred
		enableCamShake false; // enables camera shake
		5 fadeSound 0.1; // fades the sound to 10% in 5 seconds
	} else {
		"dynamicBlur" ppEffectEnable true; // enables ppeffect
		"dynamicBlur" ppEffectAdjust [6]; // enables normal vision
		"dynamicBlur" ppEffectCommit 15; // time it takes to normal
		enableCamShake true;                             	// enables camera shake
		addCamShake [10, 45, 10];     
		resetCamShake; // resets the shake
		20 fadeSound 1; //fades the sound back to normal
		player setDamage (damage player + 0.15);     		//damage per tick
		sleep 3;
		_Choke_Sounds = [
	    "A3\Sounds_f\characters\human-sfx\Person0\P0_choke_02.wss",
	    "A3\Sounds_f\characters\human-sfx\Person0\P0_choke_03.wss",
	    "A3\Sounds_f\characters\human-sfx\Person0\P0_choke_04.wss",
	    "A3\Sounds_f\characters\human-sfx\Person1\P1_choke_04.wss",
	    "A3\Sounds_f\characters\human-sfx\Person2\P2_choke_04.wss",
	    "A3\Sounds_f\characters\human-sfx\Person2\P2_choke_05.wss",
	    "A3\Sounds_f\characters\human-sfx\Person3\P3_choke_02.wss"] call BIS_fnc_selectRandom; 
		playSound3D [_Choke_Sounds, player, false, getPosASL player, 1, 1, 0];
	};
	uiSleep 0.5;
};

init.sqf:

[] execVM "ToxicGas.sqf";

This script makes players' screen blur and lose health and choke within 10m near an orange smoke grenade

  • Like 2

Share this post


Link to post
Share on other sites

And you can be immune to the gas by wearing gas masks (in Contact DLC) or inside certain kinds of vehicles

Share this post


Link to post
Share on other sites

just another solution with checkVisibility command. but it has problems with gras and therefore it does not hurt if u are prone...

works with any smoke.
Its thought for testing in debug console.

private _dummy = [ player ] spawn
{
 params [ "_unit" ];
 
 _pelvis_selection = "pelvis";
 _pelvis_pos = _unit selectionPosition _pelvis_selection;
 
 // "pelvis" does not exist in model, script can't work, exit
 if ( _pelvis_pos isEqualTo [ 0, 0, 0] ) exitWith {};

 _end_selections = ["head", "lefthand", "righthand", "leftfoot", "rightfoot"];

 while { alive _unit } do
 {
  _pelvis_pos = _unit modelToWorldVisualWorld ( _unit selectionPosition _pelvis_selection );

  _selection_visabilities = _end_selections apply 
  {
   _selection_pos = _unit modelToWorldVisualWorld ( _unit selectionPosition _x );
   
   [ _unit, "VIEW" ] checkVisibility [_pelvis_pos, _selection_pos]
  };
  
  _average_visibility = _selection_visabilities call BIS_fnc_arithmeticMean;
  
  if ( ( stance _unit ) in ["STAND", "CROUCH"] and _average_visibility < 0.8 ) then
  {
   _unit setDamage ( damage _unit + ( 0.1 * (1 - _average_visibility ) ) );
  };
  
  systemChat str (damage _unit);
  
  sleep 2;
 };
};

 

  • Like 3
  • Thanks 1

Share this post


Link to post
Share on other sites
7 minutes ago, sarogahtyp said:

just another solution with checkVisibility command. but it has problems with gras and therefore it does not hurt if u are prone...

works with any smoke.


private _dummy = [ player ] spawn
{
 params [ "_unit" ];
 
 _pelvis_selection = "pelvis";
 _pelvis_pos = _unit selectionPosition _pelvis_selection;
 
 // "pelvis" does not exist in model, script can't work, exit
 if ( _pelvis_pos isEqualTo [ 0, 0, 0] ) exitWith {};

 _end_selections = ["head", "lefthand", "righthand", "leftfoot", "rightfoot"];

 while { alive _unit } do
 {
  _pelvis_pos = _unit modelToWorldVisualWorld ( _unit selectionPosition _pelvis_selection );

  _selection_visabilities = _end_selections apply 
  {
   _selection_pos = _unit modelToWorldVisualWorld ( _unit selectionPosition _x );
   
   [ _unit, "VIEW" ] checkVisibility [_pelvis_pos, _selection_pos]
  };
  
  _average_visibility = _selection_visabilities call BIS_fnc_arithmeticMean;
  
  if ( ( stance _unit ) in ["STAND", "CROUCH"] and _average_visibility < 0.8 ) then
  {
   _unit setDamage ( damage _unit + ( 0.1 * (1 - _average_visibility ) ) );
  };
  
  systemChat str (damage _unit);
  
  sleep 2;
 };
};

 

That is brilliant man

  • Thanks 1

Share this post


Link to post
Share on other sites

canceled. Checking several visibilities as above seems to be a good approach.

  • 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

×