johnnyboy 3797 Posted March 18, 2022 Miller over at the Prairie Fire Discord requested a script for units to make noise when moving thru elephant grass, so I threw this together. Maybe somebody else will find it useful. You can run this from the console to test it out. Volume of rustle sounds is adjusted based on unit's speed. TAG_elephantGrassRustle = { params["_unit"]; _n=[_unit] spawn { params["_unit"]; while {alive _unit} do { sleep .5; { private _speed = speed _unit; if (_speed > 1) then { private _s = selectRandom [ "a3\sounds_f\characters\movements\bush_001.wss", "a3\sounds_f\characters\movements\bush_002.wss", "a3\sounds_f\characters\movements\bush_003.wss", "a3\sounds_f\characters\movements\bush_004.wss", "a3\sounds_f\characters\movements\bush_005.wss", "a3\sounds_f\characters\movements\bush_006.wss", "a3\sounds_f\characters\movements\bush_007.wss", "a3\sounds_f\characters\movements\bush_008.wss", "a3\sounds_f\characters\movements\bush_009.wss", "a3\sounds_f\characters\movements\bush_010.wss", "a3\sounds_f\characters\movements\bush_011.wss", "a3\sounds_f\characters\movements\bush_012.wss" ]; private _volume = 1; switch (true) do { case (_speed < 3): {_volume = .5; systemChat "case 1";}; // slow crawl case (_speed < 5): {_volume = 1; systemChat "case 2";}; // fast crawl / slow walk case (_speed < 14): {_volume = 1.5; systemChat "case 3";}; default {_volume = 3; systemChat "case running";}; // running }; playSound3D [_s,_unit, false, getPosASL _unit, _volume, 1, 0]; }; } forEach (nearestTerrainObjects [getPos _unit, ["bush"], 3]) select {(getModelInfo _x # 1) find "vn_elephant_grass"> 0 }; }; }; }; { [_x] spawn TAG_elephantGrassRustle; } forEach units group player; 3 Share this post Link to post Share on other sites
Harzach 2517 Posted March 18, 2022 1 hour ago, johnnyboy said: TAG_elephantGrassRustle Hey, that's MY tag! Get yer own 😄 2 Share this post Link to post Share on other sites
LSValmont 789 Posted March 18, 2022 Nice! I wonder what would @Dedmen say about running nearestTerrainObjects every 0.5 seconds thou... (I believe he is currently optimizing that command!) 😏 Share this post Link to post Share on other sites
johnnyboy 3797 Posted March 18, 2022 1 hour ago, LSValmont said: Nice! I wonder what would @Dedmen say about running nearestTerrainObjects every 0.5 seconds thou... (I believe he is currently optimizing that command!) 😏 Good point. Its just something I threw together for Miller on the PF discord. We could probably tune it up by detecting elephant grass objects every 30 seconds within 200 meters and caching them in the array, and then check that cached array every 1/2 second. 1 Share this post Link to post Share on other sites