colonel_klink 0 Posted April 27, 2003 I'm looking for a method of being able to play continous sounds when the player nears an object e.g. the sound of flies buzzing when the player nears a dead dog, horse (well they can be put in the game), or the sound of an electrical hum when the player nears an electrical substation or, opens a door and there is a contiuous sound inside. I also need a method of detecting the player when inside a building near an electrical motor etc. I've used useractions, but that means the player has to turn the motor on. Help me with this and I'll release the sub pens. Share this post Link to post Share on other sites
suma 8 Posted April 27, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Colonel_Klink @ 27 April 2003,10:50)</td></tr><tr><td id="QUOTE">I'm looking for a method of being able to play continous sounds when the player nears an object e.g. the sound of flies buzzing when the player nears a dead dog, horse (well they can be put in the game), or the sound of an electrical hum when the player nears an electrical substation or, opens a door and there is a contiuous sound inside.<span id='postcolor'> Check "Sounds: Environment" section of any trigger effects. You need to use two triggers: one to start the sound you want, and another one to stop it by setting "Sounds: Environment" to default again. You can define your own environmental sounds in description.ext. Note: environmental sounds are not positioned (you can hear them everywhere). If you need positioned sound, you need to define your own sound source in an addon using CfgSFX and corresponding sound source entity (see Owl and OwlSfx in official config). This way can be a little bit more difficult, but the result seems better to me for sounds that are always on (game engine will determine the volume of the sound source, and it will even determine if is is audible or not and turn it off as necessary, with less CPU impact than testing the same thing in the script / trigger). Share this post Link to post Share on other sites
colonel_klink 0 Posted April 28, 2003 Thanks Suma. Shall experiment with that. Share this post Link to post Share on other sites
colonel_klink 0 Posted April 28, 2003 Ok results of test with sound. My config.cpp entry entered after cfgmodels section. class cfgsfx { class enginehum { sounds[]={"Hum1"}; name="EngineHUm"; Hum1[]={"\cwksubpen\sounds\door1.ogg",0.003162,1,0.200000,0.000000,0.500000,1}; empty[]={"","","","",1,5,40}; } }; but I am uncertain if this is correct, and how it is activated from within an addon. One thing I have noticed that sound effects using the 'say' command used in conjunction with a useraction 'appear' to be localised. I have tried this but it means the player having to switch the sound on with the menu command. What I am trying to do is have the sound come on as the player nears the electrical panels. Useractions as far as I can make out, are merely switches relying on the user action (hence the name), and not activated by proximity. I have tried a script activated by the addon init=etc. etc... which activates the switch for the electrical panels and turns the sound on, but the sound is general emiting from the building center and is heard outside the building as well. Anyway here's a pic of what i am attempting to accomplish: Share this post Link to post Share on other sites
suma 8 Posted April 28, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Colonel_Klink @ 28 April 2003,09:13)</td></tr><tr><td id="QUOTE">Ok results of test with sound. My config.cpp entry entered after cfgmodels section. class cfgsfx { class enginehum { } }; but I am uncertain if this is correct, and how it is activated from within an addon.<span id='postcolor'> This is only one part of the solution (corresponds to OwlSfx). The second part needs to be done in CfgVehicles (check Owl in cfgVehicles.hpp to see how this is done): class CfgVehicles { class Owl : Sound { scope = public; sound = OwlSfx; displayName = $STR_DN_OWL; }; }; Sound sources created like this can be used in two ways: 1) as an empty sound object (always on) 2) In trigger Effect / Sounds/ Trigger section (on when the trigger is on) Note again: when using this, do not try to "optimize" sound by turning it off when being far from it. Game engine will do it more efficienlty than you would do it. Share this post Link to post Share on other sites
colonel_klink 0 Posted April 28, 2003 Ok so far I have: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">class cfgsfx { class EngineHumSFX { sounds[]={"Hum1"}; name="EngineHum"; Hum1[]={"\cwksubpen\sounds\door1.ogg",0.003162,1,0.200000,0.000000,0.500000,1}; empty[]={"","","","",1,5,40}; } };<span id='postcolor'> above cfgvehicles, then within cfgvehicles... class subpenaddon: house...I have: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class sound { scope=private; side = -1; vehicleClass = Sounds; icon = vlajka; mapSize = 10; }; class EngineHum : Sound { scope = public; sound = EngineHumsfx; displayName = "EngineHum"; }; <span id='postcolor'> but still no sound. Will this give me a general sound for the complete building or can i localise it to a point such as the electrical panels in the building, or do I create a new invisible object that emits the sound inside the building. I'm not confused, just learning and I find it a lot of fun. So thanks for your patience, Suma. Share this post Link to post Share on other sites
suma 8 Posted April 28, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">but still no sound. Will this give me a general sound for the complete building or can i localise it to a point such as the electrical panels in the building, or do I create a new invisible object that emits the sound inside the building. <span id='postcolor'> You need to create a new empty / Sound / EngineHum object and place ti where you want the sound to be located. Once you have this working, an alternative is to use trigger - which enables you to control if the sound is on or off (if wanted). Share this post Link to post Share on other sites
colonel_klink 0 Posted May 2, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Suma @ 28 April 2003,15:31)</td></tr><tr><td id="QUOTE"></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">but still no sound. Will this give me a general sound for the complete building or can i localise it to a point such as the electrical panels in the building, or do I create a new invisible object that emits the sound inside the building. <span id='postcolor'> You need to create a new empty / Sound / Â EngineHum object and place ti where you want the sound to be located. Once you have this working, an alternative is to use trigger - which enables you to control if the sound is on or off (if wanted).<span id='postcolor'> Hi Suma Have got the sound object working and can place it on the map in the editor. My next part of the problem is being able to have it located inside the building within the addon itself. I have even tried camcreating the sound object at the position of the building, and used createvehicle.. no luck so far. Cheers Share this post Link to post Share on other sites