reckazoid 4 Posted July 27, 2021 Hi I'm doing a Sci-fi mission and I was wondering as to how I would go about creating air breathing scripts so that if the player took off certain clothing items they would then suffer damage for it. I would also like to include a limited amount of air that I could refill with designated objects as well as a counter to inform the player. I know it's a bit unusual but I would certainly appreciate any input or advice Thank you for time ☺️ 1 1 Share this post Link to post Share on other sites
Smart Games 76 Posted July 27, 2021 Cool idea! player setVariable ["air", 1000]; //players air tank volume private _clothes = ["H_Hat_Tinfoil_F", "U_I_CombatUniform"]; //clothes that ensure that player takes no damage (in this example only headgear and uniform) while {alive player} do { private _uniform = uniform player; private _headgear = headgear player; private _air = player getVariable "air"; private _hasAir = true; player setVariable ["air", _air - 1]; if (_air <= 100) then { hint parseText format ["<t color='#FFFFFF'>Warning: Check your air tank! Volume left:<t color='#23D9C1'> %1<t color='#FFFFFF'>/1000!</t>", _air]; //Option1 }; if (_air <= 0) then { _air = 0; hint parseText format ["<t color='#FFFFFF'>Critical Warning: Check your air tank! Volume left:<t color='#23D9C1'> %1<t color='#FFFFFF'>/1000!</t>", _air]; //Option1 _hasAir = false; }; { if !(_x in _clothes) then { _hasAir = false; }; } forEach [_uniform, _headgear]; if (_hasAir == false) then { player setDamage (getDammage player + 0.01); hint parseText format ["<t color='#FFFFFF'>Hi, <t color='#23D9C1'>%1 <t color='#FFFFFF'>, you took some damage. Better check your <t color='#23D9C1'> clothing <t color='#FFFFFF'>! Your current health: <t color='#23D9C1'> %2 <t color='#FFFFFF'> percent!</t>", name player, (1 - getDammage player) * 100]; //Option2 }; sleep 1; }; To refill the air tank add this to the init of an object: this addAction ["Refill Air Tank", {player setVariable ["air", 1000]; hint "Air Tank refilled!"}]; You can take it further and check for more equipment like the vest or the backpack. Right now it's very very basic + if you run out of air and you get any damage, the hint system is broken. Chose Option 1 or Option 2. But as I said, it's more of an example and very basic. 4 1 Share this post Link to post Share on other sites
johnnyboy 3742 Posted July 27, 2021 If you want to add an audible indicator that player is struggling for breath, you can use the in-game heavy breathing/injured breathing sounds like this: Spoiler _volume = 1; _s = selectRandom [ "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Low_1.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Low_2.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Low_3.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Low_4.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Low_5.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Mid_1.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Mid_2.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Mid_3.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Mid_4.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Mid_5.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Max_1.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Max_2.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Max_3.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Max_4.wss", "A3\sounds_f\characters\human-sfx\P15\Soundbreathinjured_Max_5.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Low_1.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Low_2.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Low_3.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Low_4.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Low_5.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Mid_1.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Mid_2.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Mid_3.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Mid_4.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Mid_5.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Max_1.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Max_2.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Max_3.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Max_4.wss", "A3\sounds_f\characters\human-sfx\P16\Soundbreathinjured_Max_5.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Low_1.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Low_2.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Low_3.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Low_4.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Low_5.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Mid_1.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Mid_2.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Mid_3.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Mid_4.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Mid_5.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Max_1.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Max_2.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Max_3.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Max_4.wss", "A3\sounds_f\characters\human-sfx\P17\Soundbreathinjured_Max_5.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Low_1.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Low_2.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Low_3.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Low_4.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Low_5.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Mid_1.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Mid_2.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Mid_3.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Mid_4.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Mid_5.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Max_1.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Max_2.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Max_3.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Max_4.wss", "A3\sounds_f\characters\human-sfx\P18\Soundbreathinjured_Max_5.wss"]; playSound3D [_s,_unit, false, getPosASL _unit, _volume, pitch _unit, 0]; Start with the Low, progress to the Mid sounds, and end with the Max sounds when player near dying. You could also adjust the volume higher during progression. I think it would add nicely to immersion for your effect. 5 1 Share this post Link to post Share on other sites
reckazoid 4 Posted July 28, 2021 Wow! Thanks guys. Brilliant I look forward putting these scripts to work 1 Share this post Link to post Share on other sites