Boo 1 Posted March 8, 2013 (edited) Hey guys, i was just wondering is there any kind of script where i could add depth gauge to my screen when diving, this would be really great so i could know wich depth am i on. This would add also a littlebit of realism also into the game, as reallife divers has depth gauge. Ohh and also. Can i run out of oxygen while diving? Edited March 8, 2013 by Boo Wanted to add some one thing more. Share this post Link to post Share on other sites
freakjoe 3 Posted March 8, 2013 For your main question, you could probably use this command here to get the height - in your case depth - above/below the water level. And then have it display somewhere. For your second question : If you don't have a rebreather you can run out of Oxygen. Share this post Link to post Share on other sites
Boo 1 Posted March 8, 2013 For your main question, you could probably use this command here to get the height - in your case depth - above/below the water level. And then have it display somewhere. For your second question : If you don't have a rebreather you can run out of Oxygen. How can i make it display it? Sry im newbie in scripting so i dont know how to make it display somewhere, so if you can give me the whole script (pos = getPosASLW diver;) and then how to display it Share this post Link to post Share on other sites
ProfTournesol 956 Posted March 8, 2013 Ok, copy and paste the following in the init line of the diver : code = [] spawn {sleep 1;while {true} do {sleep 2;hint format["position under sea level: %1",(getPosASL player) select 2];};}; Share this post Link to post Share on other sites
Boo 1 Posted March 8, 2013 For your main question, you could probably use this command here to get the height - in your case depth - above/below the water level. And then have it display somewhere. For your second question : If you don't have a rebreather you can run out of Oxygen. Ok, copy and paste the following in the init line of the diver : code = [] spawn {sleep 1;while {true} do {sleep 2;hint format["position under sea level: %1",(getPosASL player) select 2];};}; I love you guys! Thx so much! Share this post Link to post Share on other sites
seadog 1 Posted March 9, 2013 How would I be able to expand on this to have a trigger that will if the diver goes below 30 meters an alarm sounds, and then if they don't take corrective action the health starts to deteriorate for every meter the get deeper Share this post Link to post Share on other sites
cobra4v320 27 Posted March 9, 2013 (edited) _nul = [this,-30] execVM "depth.sqf" _unit = _this select 0; _maxdepth = _this select 1; while {(getPosASL _unit) select 2 < -1} do { sleep 1; hint format ["Current Depth: %1", (getPosASL _unit) select 2]; sleep 1; if ((getPosASL _unit) select 2 < _maxdepth) then {hintsilent parseText format ["<t color='#ff0000'>TOO DEEP, SURFACE.</t>"]}; }; hint ""; Now when you exit the water it wont show your height anymore and if you go below your max depth it will tell you. You can use sethit or setdamage commands to add damage when the diver goes below -30. Edited March 9, 2013 by cobra4v320 Share this post Link to post Share on other sites
seadog 1 Posted March 9, 2013 @Cobra4v320 Mate your are the best! Many thanks for this, how would I add the set damage as I want to be able to simulate the bends @ 32 meters and then if they dive down further then they loose vision and die (based on time) and if they stay at constant 32 meters they will black out (possible to add first aid ?) Share this post Link to post Share on other sites
cobra4v320 27 Posted March 10, 2013 (edited) Here you go :D /* Script: depthgauge.sqf Author: Cobra4v320 Description: Will tell you your exact depth, if you go below -30 it could be fatal. Parameter(s): _this select 0: this is the diver) _this select 1: this is the max depth the diver can go. Example(s): null = [this,-30] execVM "depth.sqf" */ if !(isServer) exitWith {}; waitUntil {!isNull player}; _unit = _this select 0; _maxdepth = if (count _this > 1) then {_this select 1} else {-30}; while {(getPosASLW _unit) select 2 < -1} do { sleep 1; hintsilent format ["Current Depth: %1", (getPosASLW _unit) select 2]; if ((getPosASLW _unit) select 2 < _maxdepth) then { while {(getPosASLW _unit) select 2 < _maxdepth} do { sleep 1; hintsilent parseText format ["<t color='#ff0000'>TOO DEEP, SURFACE.</t>"]; _unit setDamage (damage _unit) + 0.1; }; }; }; hint ""; if (true) exitWith {}; Edited March 10, 2013 by cobra4v320 Share this post Link to post Share on other sites
cobra4v320 27 Posted March 12, 2013 (edited) With this script you can get your depth and current oxygen level (kind of pointless right now with a re-breather), if you go below 30 meters you start to get the bends and your diver will slowly become damaged over time. One thing I would like to add is the sound effects and the screen blacking out like when a non-diver is underwater and starts to lose oxygen, does anyone know how to do this or can point me in the right direction? /* Script: depthGauge.sqf Author: Cobra4v320 Description: Will tell you your depth and oxygen level, if you go below -30 meters it could be fatal. Parameter(s): _this select 0: this is the diver _this select 1: this is the max depth the diver can go. Example(s): null = [this,-30] execVM "depthGauge.sqf" null = [this] execVM "depthGauge.sqf" */ if !(isServer) exitWith {}; waitUntil {!isNull player && isPlayer player}; _diver = _this select 0; _maxdepth = if (count _this > 1) then {_this select 1} else {-30}; if (!surfaceIsWater position _diver) then { waitUntil {sleep 1; surfaceIsWater position _diver}; }; while {surfaceIsWater position _diver} do { sleep 1; hintsilent format ["Current Depth: %1 \n Oxygen Remaining: %2", (getPosASLW _diver) select 2, getOxygenRemaining _diver]; if ((getPosASLW _diver) select 2 < _maxdepth) then { while {(getPosASLW _diver) select 2 < _maxdepth} do { sleep 1; hintsilent parseText format ["<t color='#ff0000'>TOO DEEP, SURFACE to 30 Meters.</t>"]; _diver setDamage (damage _diver) + 0.01; }; }; if (!surfaceIsWater position _diver) then { hintsilent ""; waitUntil {sleep 1; surfaceIsWater position _diver}; }; }; hintsilent ""; if (true) exithWith {}; Edited March 12, 2013 by cobra4v320 Share this post Link to post Share on other sites
Tajin 349 Posted March 12, 2013 I'd suggest using http://community.bistudio.com/wiki/setAperture to gradually make him blackout depending on the depth. That would probably give a better feel than an instant blackout. Share this post Link to post Share on other sites
cobra4v320 27 Posted March 12, 2013 (edited) Thanks Tajin, played with that a little bit, I will have to experiment some more. Made some changes, the hints will only show for the diver using the script and not every player, also added a heartbeat sound. /* Script: depthGauge.sqf Author: Cobra4v320 Description: Will tell you your depth and oxygen level, if you go below -30 meters it could be fatal. Parameter(s): _this select 0: this is the diver _this select 1: this is the max depth the diver can go. Example(s): null = [this,-30] execVM "depthGauge.sqf" null = [this] execVM "depthGauge.sqf" */ if !(isServer) exitWith {}; waitUntil {!isNull player && isPlayer player}; _diver = _this select 0; _maxdepth = if (count _this > 1) then {_this select 1} else {-30}; if (!surfaceIsWater position _diver) then { waitUntil {sleep 1; surfaceIsWater position _diver}; }; while {surfaceIsWater position _diver} do { sleep 1; if (player == _diver) then {hintsilent format ["Current Depth: %1 \n Oxygen Remaining: %2", (getPosASLW _diver) select 2, getOxygenRemaining _diver]}; if ((getPosASLW _diver) select 2 < _maxdepth) then { while {(getPosASLW _diver) select 2 < _maxdepth} do { if (player == _diver) then { hintsilent parseText format ["<t color='#ff0000'>Too Deep, Surface to 30 Meters.</t>"]; _diver setDamage (damage _diver) + 0.05; playSound "heartbeat"; sleep 7; //allows sound to play through without repeating over itself }; }; }; if (!surfaceIsWater position _diver) then { hintsilent ""; waitUntil {sleep 1; surfaceIsWater position _diver}; }; }; hintsilent ""; if (true) exitWith {}; Edited March 12, 2013 by cobra4v320 Share this post Link to post Share on other sites
seadog 1 Posted March 12, 2013 @cobra4v320 Mate I hope BIS take this on board ! Cant thank you enough this, Hopefully BIS will expand on the whole rebreather / diving thing to include the old school open ciruit system as well as mixed gases etc Share this post Link to post Share on other sites
cobra4v320 27 Posted March 12, 2013 You will just need to get a heartbeat sound and edit your description.ext file to make it work. Share this post Link to post Share on other sites
tonic-_- 53 Posted March 13, 2013 (edited) Like this? http://oi50.tinypic.com/1411j0p.jpg (1465 kB) Something I was working on. Planning to change the - to an actual 'positive' depth and add a fancy icon with oxygen levels and add pressure effects :D *RAGE* Why won't my images show on these forums?! Edited March 13, 2013 by Tonic-_- Share this post Link to post Share on other sites
cobra4v320 27 Posted March 13, 2013 Thats pretty cool and I was thinking about doing the same thing. I was going to use an Oris Dive watch. Cant wait to try this out when you release it. ---------- Post added at 01:42 ---------- Previous post was at 01:31 ---------- How about this one? Navy Dive Watch http://ep.yimg.com/ca/I/yhst-13255692613510_2249_204613160 Share this post Link to post Share on other sites
tonic-_- 53 Posted March 13, 2013 Thats pretty cool and I was thinking about doing the same thing. I was going to use an Oris Dive watch. Cant wait to try this out when you release it.---------- Post added at 01:42 ---------- Previous post was at 01:31 ---------- How about this one? Navy Dive Watch http://ep.yimg.com/ca/I/yhst-13255692613510_2249_204613160 o.O I'm no diving expert and I am already completely lost by all the numbers -_- Share this post Link to post Share on other sites
cobra4v320 27 Posted March 13, 2013 Large numbers are depth. Mouse over the night view at the link below. I dont know why BI just doesnt replace the old watch with this one. http://www.luminox.com/watches/sea/+/watch/A.3051/ Share this post Link to post Share on other sites