tpw 2315 Posted January 25, 2012 Hey guys! I was kicking around making something like this for one of my missions and I decided to go for it. This script adds breath condensation to all units. The particles are created locally on each client so there is very little network traffic. I've included a version that has ACRE functionality so you can see condensation when people are talking. Should be 100% JIP, respawn compatible (also dead people don't breath ;) Although I didn't test it with respawn). I think I'll throw in ACE stamina at some point when I feel like it but it shouldn't be too hard to add if your up for it. Major props to Nou for some help with the per frame event handler. You can change the drop interval ( _fog setDropInterval (0.01-random(0.005)); ) and particle color ( [[1,1,1, (.01+random(.03))], [1,1,1, 0.01], [1,1,1, 0]], ) to get the effect you want To run add something like this to the init.sqf if (!isDedicated) then { [] execVM "scripts\breath.sqf"; }; ACRE Version: //Adds Condensation to Units (ACRE) //By Falcon (Original by tpw) //Last Updated 23.01.2012 private ["_unit","_int","_nextTime", "_source", "_mylogic", "_fog"]; sleep 5; my_breath_func = { { _unit = _x; if(alive _unit) then { _nextTime = _unit getVariable ["myNextBreathTime", -1]; if(_nextTime == -1) then { _unit setVariable ["myNextBreathTime", diag_tickTime + (1+random(3))]; _source = "logic" createVehicleLocal (getpos _unit); _unit setVariable ["myBreathingParticleLogic", _source]; if(_unit == player) then {_source attachto [_unit,[0,0.1,.04], "neck"];} else {_source attachto [_unit,[0,0.05,-0.08], "pilot"];}; _unit setVariable ["myBreathingParticleSource", nil]; }; _myParticleSource = _unit getVariable ["myBreathingParticleSource", nil]; if(diag_tickTime >= _nextTime || (([_unit] call acre_api_fnc_isSpeaking) && isNil "_myParticleSource")) then { if (isNil "_myParticleSource") then { _unit setVariable ["myNextBreathTime", diag_tickTime + 0.5]; _mylogic = _unit getVariable "myBreathingParticleLogic"; _fog = "#particlesource" createVehicleLocal (getpos _mylogic); _fog setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 12, 13,0], "", "Billboard", 0.5, 0.5, [0,0,0], [0, 0.0, -0.3], 1, 1.275, 1, 0.2, [0, 0.2,0], [[1,1,1, (.01+random(.03))], [1,1,1, 0.01], [1,1,1, 0]], //Change (.01+random(.03)) for different effect 0 (less) 1 (more) [1000], 1, 0.04, "", "", _mylogic]; _fog setParticleRandom [2, [0, 0, 0], [0.25, 0.25, 0.25], 0, 0.5, [0, 0, 0, 0.1], 0, 0, 10]; _fog setDropInterval (0.01-random(0.005)); //change drop interval for particle density 0.001 (most dense) -> .999 (least dense) _unit setVariable ["myBreathingParticleSource", _fog]; } else { if(!([_unit] call acre_api_fnc_isSpeaking)) then { _unit setVariable ["myNextBreathTime", diag_tickTime + (2+random(3))]; deletevehicle (_unit getVariable "myBreathingParticleSource"); _unit setVariable ["myBreathingParticleSource", nil]; }; }; }; } else { _unit setVariable ["myNextBreathTime", -1]; deletevehicle (_unit getVariable "myBreathingParticleLogic"); deletevehicle (_unit getVariable "myBreathingParticleSource"); }; } forEach allUnits; }; [my_breath_func, 0.1] call cba_fnc_addPerFrameHandler; Non-ACRE Version: //Adds Condensation to Units (Non-ACRE) //By Falcon (Original by tpw) //Last Updated 23.01.2012 private ["_unit","_int","_nextTime", "_source", "_mylogic", "_fog"]; sleep 5; my_breath_func = { { _unit = _x; if(alive _unit) then { _nextTime = _unit getVariable ["myNextBreathTime", -1]; if(_nextTime == -1) then { _unit setVariable ["myNextBreathTime", diag_tickTime + (1+random(3))]; _source = "logic" createVehicleLocal (getpos _unit); _unit setVariable ["myBreathingParticleLogic", _source]; if(_unit == player) then {_source attachto [_unit,[0,0.1,.04], "neck"];} else {_source attachto [_unit,[0,0.05,-0.08], "pilot"];}; _unit setVariable ["myBreathingParticleSource", nil]; }; _myParticleSource = _unit getVariable ["myBreathingParticleSource", nil]; if(diag_tickTime >= _nextTime) then { if (isNil "_myParticleSource") then { _unit setVariable ["myNextBreathTime", diag_tickTime + 0.5]; _mylogic = _unit getVariable "myBreathingParticleLogic"; _fog = "#particlesource" createVehicleLocal (getpos _mylogic); _fog setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 12, 13,0], "", "Billboard", 0.5, 0.5, [0,0,0], [0, 0.0, -0.3], 1, 1.275, 1, 0.2, [0, 0.2,0], [[1,1,1, (.01+random(.03))], [1,1,1, 0.01], [1,1,1, 0]], //Change (.01+random(.03)) for different effect 0 (less) 1 (more) [1000], 1, 0.04, "", "", _mylogic]; _fog setParticleRandom [2, [0, 0, 0], [0.25, 0.25, 0.25], 0, 0.5, [0, 0, 0, 0.1], 0, 0, 10]; _fog setDropInterval (0.01-random(0.005)); //change drop interval for particle density 0.001 (most dense) -> .999 (least dense) _unit setVariable ["myBreathingParticleSource", _fog]; } else { _unit setVariable ["myNextBreathTime", diag_tickTime + (2+random(3))]; deletevehicle (_unit getVariable "myBreathingParticleSource"); _unit setVariable ["myBreathingParticleSource", nil]; }; }; } else { _unit setVariable ["myNextBreathTime", -1]; deletevehicle (_unit getVariable "myBreathingParticleLogic"); deletevehicle (_unit getVariable "myBreathingParticleSource"); }; } forEach allUnits; }; [my_breath_func, 0.1] call cba_fnc_addPerFrameHandler; -Falcon Great work! I'm glad that other people are getting some use out of this! Share this post Link to post Share on other sites
Angus S 10 Posted January 25, 2012 I would like to see an auto-initialized version of this that kicks in at night and stops at day Share this post Link to post Share on other sites
AZCoder 921 Posted January 25, 2012 This is fantastic. Set to 0.1 intensity, it works great with the cigarette mod :D As far as day and night, I would suggest that it's actually cold air that makes foggy breath, and if someone wanted to get fancy they could take into account latitude (which is shown in CarlGustaffa's script), weather (cold rain front), and time of the year. I live in the desert and it's very unusual to see someone's breath even at night here in the Winter, but when I lived up north around 45 deg latitude it was common even in the daytime during the colder months. Share this post Link to post Share on other sites
tpw 2315 Posted January 25, 2012 I would like to see an auto-initialized version of this that kicks in at night and stops at day Here's how I do it (reposted from page 2): // Determine the angle of the sun (ie is it dark or not), adapted from CarlGustaffa [] spawn {while {alive player} do { private ["_lat", "_day", "_hour", "_angle", "_isday"]; //Not 100% correct to BIS own code, but it does the trick. _lat = -1 * getNumber(configFile >> "CfgWorlds" >> worldName >> "latitude"); //Arma latitude is negated for some odd reason. _day = 360 * (dateToNumber date); //Convert current day to 360 for trigonometric calculations. _hour = (daytime / 24) * 360; //Convert current hours to 360 for trigonometric calculations. sunangle = ((12 * cos(_day) - 78) * cos(_lat) * cos(_hour)) - (24 * sin(_lat) * cos(_day)); //update every 5 minutes sleep 300; }; }; private ["_unit"]; _unit = _this select 0; _int = _this select 1; //intensity of fog (0 to 1) while {alive _unit} do { if (sunangle < 0) then { // only fog breath if sun is below horizon sleep (2 + random 2); // random time between breaths _source = "logic" createVehicleLocal (getpos _unit); _fog = "#particlesource" createVehicleLocal getpos _source; _fog setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 12, 13,0], "", "Billboard", 0.5, 0.5, [0,0,0], [0, 0.2, -0.2], 1, 1.275, 1, 0.2, [0, 0.2,0], [[1,1,1, _int], [1,1,1, 0.01], [1,1,1, 0]], [1000], 1, 0.04, "", "", _source]; _fog setParticleRandom [2, [0, 0, 0], [0.25, 0.25, 0.25], 0, 0.5, [0, 0, 0, 0.1], 0, 0, 10]; _fog setDropInterval 0.001; _source attachto [_unit,[0,0.15,0], "neck"]; // get fog to come out of player mouth sleep 0.5; // 1/2 second exhalation deletevehicle _source; }} Share this post Link to post Share on other sites
Angus S 10 Posted January 25, 2012 Here's how I do it (reposted from page 2) but I mean as an auto initialized pbo Share this post Link to post Share on other sites
tpw 2315 Posted January 25, 2012 but I mean as an auto initialized pbo Ah, I see. The problem is, which units to automatically deploy the breath script to. Just player? Just player's squad? Just BLUFOR? Every unit and civ? As it stands, you can deploy it to the units of your choosing. I'll have a think and see if I can come up with something. Share this post Link to post Share on other sites
Angus S 10 Posted January 25, 2012 I think every unit, or would that affect performance too much? How about making it as a module you can place in editor? Share this post Link to post Share on other sites
tpw 2315 Posted January 25, 2012 Every unit would (does, I've tried it) kill performance. I don't know how to make modules, but I could make it so that you can use a config file to choose between different modes of operation. Share this post Link to post Share on other sites
Angus S 10 Posted January 25, 2012 That sounds great, I'll keep on eye on this thread for progress Share this post Link to post Share on other sites
falcon_565 11 Posted January 26, 2012 @AZCoder Unfortunately there's no easy way to pull the tempature from the world files where it is stored. I'm just running it on a per mission basis (i.e. adding it on missions were it should be cold and then modifying the effect so there's less during the day etc.) @Tpw & Angus I init it on all units which covers all units (not vehicles, animals etc). If you use my per frame event handler script it runs everything on the clients which is a very very minimal performance issue. I'm also going to add a screen to world function so it's only drawn if your looking at the unit. Share this post Link to post Share on other sites
tpw 2315 Posted January 27, 2012 @AZCoder Unfortunately there's no easy way to pull the tempature from the world files where it is stored. I'm just running it on a per mission basis (i.e. adding it on missions were it should be cold and then modifying the effect so there's less during the day etc.) @Tpw & Angus I init it on all units which covers all units (not vehicles, animals etc). If you use my per frame event handler script it runs everything on the clients which is a very very minimal performance issue. I'm also going to add a screen to world function so it's only drawn if your looking at the unit. Sounds like you're the man for the job Falcon_565! Pbo please :) With regard to when to fog breath. It's related to the dew point http://en.wikipedia.org/wiki/Dew_point, which is itself a combination of temperature and humidity. Not sure how we'd go about extracting this info from the Arma world. So I just settle for fog at night! Share this post Link to post Share on other sites
AZCoder 921 Posted January 27, 2012 @Falcon_565 - Certainly day/night works fine, I was just thinking how cool a complex script could be as I like to think big :) I was looking in the Effects module FSM for ideas, and BIS more or less uses day/night to determine when to spawn mist. @tpw - Dew Point would explain the lack of foggy breath in Arizona, we have no humidity in the desert valley. Share this post Link to post Share on other sites
tpw 2315 Posted January 27, 2012 @tpw - Dew Point would explain the lack of foggy breath in Arizona, we have no humidity in the desert valley. Explains why my breath can fog outside during the day when it's 25C and it has been pouring torrential summer rain every day for week! Share this post Link to post Share on other sites
domokun 515 Posted February 20, 2012 @AZCoder Unfortunately there's no easy way to pull the tempature from the world files where it is stored. I'm just running it on a per mission basis (i.e. adding it on missions were it should be cold and then modifying the effect so there's less during the day etc.) I think that problem may be solved. Now we have to get this script integrated with that mod... Share this post Link to post Share on other sites
Doolittle 0 Posted April 21, 2012 (edited) Sorry to dig up an old thread, but I'm lovin' I44 and they use this script, which brought me to this post. Problem is breath goes away when someone respawns, new people come in, etc. So I re-wrote the script. I also figured out you don't need a logic as particles can attach automatically. I tried to make the script not be too computation intense. It scans around the player and then if it finds someone, they start doing the cold breath. Have the player run this once when they log in: // Thanks to tpw for the particle params! doobreath = { private ["_pos", "_ps"]; sleep random 2; _pos = _this selectionposition "neck"; while {_this distance player < 800 and alive _this and vehicle _this == _this and _pos select 2 != 0} do { _pos = _this selectionposition "neck"; _ps = "#particlesource" createvehiclelocal getpos _this; _ps setparticleparams [["\ca\data\particleeffects\universal\universal.p3d", 16, 12, 13, 0], "", "Billboard", 0.5, 0.5, [_pos select 0, (_pos select 1) + 0.15, _pos select 2], [0, 0.2, -0.2], 1, 1.275, 1, 0.2, [0, 0.2, 0], [[1, 1, 1, 0.01], [1, 1, 1, 0.01], [1, 1, 1, 0]], [1000], 1, 0.04, "", "", _this]; _ps setparticlerandom [2, [0, 0, 0], [0.25, 0.25, 0.25], 0, 0.5, [0, 0, 0, 0.1], 0, 0, 10]; _ps setdropinterval 0.001; _this setvariable ["runningbreath", floor time + 5]; sleep 0.5; deletevehicle _ps; sleep 2 + random 2; }; }; [] spawn { while {true} do { sleep 5; _near = nearestobjects [player, ["Man"], 500]; { if (alive _x and vehicle _x == _x and _x getvariable ["runningbreath", -1] < time) then { _x setvariable ["runningbreath", floor time + 5]; _x spawn doobreath; }; } foreach _near; }; }; Edited April 21, 2012 by Doolittle Share this post Link to post Share on other sites
tpw 2315 Posted April 21, 2012 Sorry to dig up an old thread, but I'm lovin' I44 and they use this script, which brought me to this post. Problem is breath goes away when someone respawns, new people come in, etc. So I re-wrote the script. I also figured out you don't need a logic as particles can attach automatically.I tried to make the script not be too computation intense. It scans around the player and then if it finds someone, they start doing the cold breath. Have the player run this once when they log in: // Thanks to tpw for the particle params! doobreath = { private ["_pos", "_ps"]; sleep random 2; _pos = _this selectionposition "neck"; while {_this distance player < 800 and alive _this and vehicle _this == _this and _pos select 2 != 0} do { _pos = _this selectionposition "neck"; _ps = "#particlesource" createvehiclelocal getpos _this; _ps setparticleparams [["\ca\data\particleeffects\universal\universal.p3d", 16, 12, 13, 0], "", "Billboard", 0.5, 0.5, [_pos select 0, (_pos select 1) + 0.15, _pos select 2], [0, 0.2, -0.2], 1, 1.275, 1, 0.2, [0, 0.2, 0], [[1, 1, 1, 0.01], [1, 1, 1, 0.01], [1, 1, 1, 0]], [1000], 1, 0.04, "", "", _this]; _ps setparticlerandom [2, [0, 0, 0], [0.25, 0.25, 0.25], 0, 0.5, [0, 0, 0, 0.1], 0, 0, 10]; _ps setdropinterval 0.001; _this setvariable ["runningbreath", floor time + 5]; sleep 0.5; deletevehicle _ps; sleep 2 + random 2; }; }; [] spawn { while {true} do { sleep 5; _near = nearestobjects [player, ["Man"], 500]; { if (alive _x and vehicle _x == _x and _x getvariable ["runningbreath", -1] < time) then { _x setvariable ["runningbreath", floor time + 5]; _x spawn doobreath; }; } foreach _near; }; }; Good stuff doolittle! I thought about something like this but am a) too lazy, b) too incompetent and c) i just play sinlge player editor mission with no respawning. Share this post Link to post Share on other sites
ChineseSF 1 Posted April 21, 2012 Oh~It looks nice!~ Let me have a try,hope it can give me surprise. Share this post Link to post Share on other sites
tpw 2315 Posted May 21, 2012 I know I've been a bit slack considering I started this thread, but I recently decided to try out Falcon_565's implementation and it is bloody fantastic. It's just amazing walking into a village on a cold day and seeing breath steaming out of civilians and even ambient life (I've got an ambient dog script, and they have foggy breath too!). The question is, how do you know when it's cold? Well, for those of you using Rube's incredible weather module http://forums.bistudio.com/showthread.php?131298-RUBE-Weather-Module, all you need to do is drop a couple of extra lines into Falcon's scripts and you can have the breath fog only come on when it's cold. Just replace _unit = _x; if(alive _unit) then { with _unit = _x; _temp = (RUBE_weatherEngine getFSMVariable "_temperature"); if((alive _unit) and (_temp < 5 )) then { In this case, if the temperature drops below 5degC, the fog will kick in. Thanks again Falcon_565! Hey guys! I was kicking around making something like this for one of my missions and I decided to go for it. This script adds breath condensation to all units. The particles are created locally on each client so there is very little network traffic. I've included a version that has ACRE functionality so you can see condensation when people are talking. Should be 100% JIP, respawn compatible (also dead people don't breath ;) Although I didn't test it with respawn). I think I'll throw in ACE stamina at some point when I feel like it but it shouldn't be too hard to add if your up for it. Major props to Nou for some help with the per frame event handler. You can change the drop interval ( _fog setDropInterval (0.01-random(0.005)); ) and particle color ( [[1,1,1, (.01+random(.03))], [1,1,1, 0.01], [1,1,1, 0]], ) to get the effect you want To run add something like this to the init.sqf if (!isDedicated) then { [] execVM "scripts\breath.sqf"; }; ACRE Version: //Adds Condensation to Units (ACRE) //By Falcon (Original by tpw) //Last Updated 23.01.2012 private ["_unit","_int","_nextTime", "_source", "_mylogic", "_fog"]; sleep 5; my_breath_func = { { _unit = _x; if(alive _unit) then { _nextTime = _unit getVariable ["myNextBreathTime", -1]; if(_nextTime == -1) then { _unit setVariable ["myNextBreathTime", diag_tickTime + (1+random(3))]; _source = "logic" createVehicleLocal (getpos _unit); _unit setVariable ["myBreathingParticleLogic", _source]; if(_unit == player) then {_source attachto [_unit,[0,0.1,.04], "neck"];} else {_source attachto [_unit,[0,0.05,-0.08], "pilot"];}; _unit setVariable ["myBreathingParticleSource", nil]; }; _myParticleSource = _unit getVariable ["myBreathingParticleSource", nil]; if(diag_tickTime >= _nextTime || (([_unit] call acre_api_fnc_isSpeaking) && isNil "_myParticleSource")) then { if (isNil "_myParticleSource") then { _unit setVariable ["myNextBreathTime", diag_tickTime + 0.5]; _mylogic = _unit getVariable "myBreathingParticleLogic"; _fog = "#particlesource" createVehicleLocal (getpos _mylogic); _fog setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 12, 13,0], "", "Billboard", 0.5, 0.5, [0,0,0], [0, 0.0, -0.3], 1, 1.275, 1, 0.2, [0, 0.2,0], [[1,1,1, (.01+random(.03))], [1,1,1, 0.01], [1,1,1, 0]], //Change (.01+random(.03)) for different effect 0 (less) 1 (more) [1000], 1, 0.04, "", "", _mylogic]; _fog setParticleRandom [2, [0, 0, 0], [0.25, 0.25, 0.25], 0, 0.5, [0, 0, 0, 0.1], 0, 0, 10]; _fog setDropInterval (0.01-random(0.005)); //change drop interval for particle density 0.001 (most dense) -> .999 (least dense) _unit setVariable ["myBreathingParticleSource", _fog]; } else { if(!([_unit] call acre_api_fnc_isSpeaking)) then { _unit setVariable ["myNextBreathTime", diag_tickTime + (2+random(3))]; deletevehicle (_unit getVariable "myBreathingParticleSource"); _unit setVariable ["myBreathingParticleSource", nil]; }; }; }; } else { _unit setVariable ["myNextBreathTime", -1]; deletevehicle (_unit getVariable "myBreathingParticleLogic"); deletevehicle (_unit getVariable "myBreathingParticleSource"); }; } forEach allUnits; }; [my_breath_func, 0.1] call cba_fnc_addPerFrameHandler; Non-ACRE Version: //Adds Condensation to Units (Non-ACRE) //By Falcon (Original by tpw) //Last Updated 23.01.2012 private ["_unit","_int","_nextTime", "_source", "_mylogic", "_fog"]; sleep 5; my_breath_func = { { _unit = _x; if(alive _unit) then { _nextTime = _unit getVariable ["myNextBreathTime", -1]; if(_nextTime == -1) then { _unit setVariable ["myNextBreathTime", diag_tickTime + (1+random(3))]; _source = "logic" createVehicleLocal (getpos _unit); _unit setVariable ["myBreathingParticleLogic", _source]; if(_unit == player) then {_source attachto [_unit,[0,0.1,.04], "neck"];} else {_source attachto [_unit,[0,0.05,-0.08], "pilot"];}; _unit setVariable ["myBreathingParticleSource", nil]; }; _myParticleSource = _unit getVariable ["myBreathingParticleSource", nil]; if(diag_tickTime >= _nextTime) then { if (isNil "_myParticleSource") then { _unit setVariable ["myNextBreathTime", diag_tickTime + 0.5]; _mylogic = _unit getVariable "myBreathingParticleLogic"; _fog = "#particlesource" createVehicleLocal (getpos _mylogic); _fog setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 12, 13,0], "", "Billboard", 0.5, 0.5, [0,0,0], [0, 0.0, -0.3], 1, 1.275, 1, 0.2, [0, 0.2,0], [[1,1,1, (.01+random(.03))], [1,1,1, 0.01], [1,1,1, 0]], //Change (.01+random(.03)) for different effect 0 (less) 1 (more) [1000], 1, 0.04, "", "", _mylogic]; _fog setParticleRandom [2, [0, 0, 0], [0.25, 0.25, 0.25], 0, 0.5, [0, 0, 0, 0.1], 0, 0, 10]; _fog setDropInterval (0.01-random(0.005)); //change drop interval for particle density 0.001 (most dense) -> .999 (least dense) _unit setVariable ["myBreathingParticleSource", _fog]; } else { _unit setVariable ["myNextBreathTime", diag_tickTime + (2+random(3))]; deletevehicle (_unit getVariable "myBreathingParticleSource"); _unit setVariable ["myBreathingParticleSource", nil]; }; }; } else { _unit setVariable ["myNextBreathTime", -1]; deletevehicle (_unit getVariable "myBreathingParticleLogic"); deletevehicle (_unit getVariable "myBreathingParticleSource"); }; } forEach allUnits; }; [my_breath_func, 0.1] call cba_fnc_addPerFrameHandler; -Falcon Share this post Link to post Share on other sites
xezon 0 Posted May 24, 2012 Hi. I loaded Falcon_565's script via init.sqf and checked the execution with a hint "a" but I cannot see new brathing ingame on my men. What could be the reason? Share this post Link to post Share on other sites
tpw 2315 Posted May 24, 2012 Strange, I'm running the non-acre version from my init.sqf and it's easy to see the breath fog, every 3-5 seconds or so. Are you using the acre or non-acre version? I don't MP so don't use acre. Share this post Link to post Share on other sites
xezon 0 Posted May 24, 2012 I used the non acre. I put it in a folder "scripts_3rdparty" and called it from init.sqf for SP mission. hint "a" shows it gets called. Share this post Link to post Share on other sites
Baraka 10 Posted May 24, 2012 @xezon: Here is an mission with copy+pasted Code from tpw :http://www.fileuploadx.de/615413 Big THX to tpw for the script! Those little eyecatchers always enhance the whole Gameworld. Share this post Link to post Share on other sites
McLupo 118 Posted June 16, 2012 (edited) Hello to all! I used the uploaded mission from tpw and it works great, but you have to make sure that you run the CBA, too. - [my_breath_func, 0.1] call cba_fnc_addPerFrameHandler; - See the last line in the script Have a look: In my opinion, as also mentioned by Baraka, it is an awesome "little extra" for creating an atmosphere. Very good job tpw, thx alot for such another great idea! Cheers McLupo Edited June 17, 2012 by McLupo Add a vid Share this post Link to post Share on other sites
Rydygier 1309 Posted October 2, 2012 Implemented this, as usual great stuff, with some modifications in this, maybe these quick enhancements, or at least concepts, will prove useful for someone (particle params are changed for some reasons, but this is not about them. Tried to add breath frequency and params dependent on fatigue (measured by monitoring speed/velocity changes, not sure, what happens when unit is in vehicle, but if any problems occur here, should be sufficient additional condition for that in waitUntil)). It is set to be active only at 150 or less meters distance to save my weak CPU resources for other tasks. To launch: fogB = compile preprocessfile "FoggyB.sqf"; { [_x,0.03] spawn fogB } foreach Allunits; FoggyB.sqf: // Foggy breath 20110122 private ["_unit"]; _unit = _this select 0; _int0 = _this select 1; //intensity of fog (0 to 1) while {alive _unit} do { _ls = _unit getVariable "LastSpeed"; _spd = abs (speed _unit); if (isNil "_ls") then {_ls = 0}; _mpl = 1 + (_spd/10); if (_mpl > 1.2) then {_mpl = 1.2}; _int = _int0 * _mpl; if (_int > 1) then {_int = 1}; if ((_ls > _spd) or (_spd < 1)) then {_ls = _ls - (0.25 + (random 0.15))} else {_ls = _ls + (0.35 + (random 0.15))}; if (_ls > 22) then {_ls = 22}; if (_ls < 0) then {_ls = 0}; _unit setVariable ["LastSpeed",_ls]; waitUntil { sleep ((2 + (random 2))/(0.6 + (_ls/5))); // random time between breaths ((_unit distance player) < 150) }; _vl = velocity _unit; _source = "logic" createVehicleLocal (getpos _unit); _fog = "#particlesource" createVehicleLocal getpos _source; _fog setParticleParams [["\Ca\Data\ParticleEffects\Universal\Universal", 16, 12, 13,0], "", "Billboard", 0.5, (0.3 + (_int/2)), [0,0,0], [_vl select 0,(_vl select 1) + 0.2,(_vl select 2) - 0.2], 1,1.25,1,0.75, [0, (0.4 + (_int/5))], [[1,1,1, _int], [1,1,1, 0.01], [1,1,1, 0]], [1000], 1, 0.04, "", "", _source]; _fog setParticleRandom [1, [0.01, 0.01, 0.01], [0.25, 0.25, 0.25], 0, 0.5, [0, 0, 0, 0.1], 0, 0, 10]; _fog setDropInterval 0.01; _source attachto [_unit,[0,0.15,0], "neck"]; // get fog to come out of player mouth sleep 0.5; // 1/2 second exhalation deletevehicle _source; } Frequency should gradually and with some randomness increase when unit is moving quick enough, and slowly decrease, if unit is slows or is moving slow. Still not synchronized with breath sound. Share this post Link to post Share on other sites
tpw 2315 Posted October 4, 2012 Nice work mate, I will check it out ASAP. Share this post Link to post Share on other sites