MrCrazyDude115 132 Posted July 10, 2016 So I've been working on a small PvP gamemode to play with my friends. Pretty much everything is done except for one thing. Basically I'm trying to make it so that when a sector is captured, a sound will play for whichever side captured it, while a different sound will play for all other sides and so on... Any ideas? Sorta like it is in games like CoD domination mode. Thanks in advance! Share this post Link to post Share on other sites
revide 33 Posted July 10, 2016 If all players have a trigger when the area is captured and by whom, just add a playSound, using fadeSound etc. If only the server got the trigger, one would need to send to all units (allPlayers) a variable which contains the sound to be played depending on which side the player is on. The player has a addVaraibleEventHandler for that PV and plays the sound when changed. Share this post Link to post Share on other sites
MrCrazyDude115 132 Posted July 10, 2016 Hmmm.... I think I have a basic idea of what I might do, but I'm extremely lost here. Share this post Link to post Share on other sites
beno_83au 1369 Posted July 10, 2016 If you're using a custom sound, you'll need to declare that sound in the description.ext. Then, whatever you've got going for when your sector is captured (I'll assume a trigger for now), in it's On Activation field put: [_soundName] remoteExec ["playSound",0]; playSound & remoteExec Where _soundName is the name you give your sound in the description.ext. Be aware though, you'll need to convert your sound file into a .ogg file, which IIRC Audacity can do. But read through those links and have a play around, see what you come up with. If you want to use stock ArmA sounds, go into the editor, then click Tools -> Config Viewer, and make your way down to CfgSounds. All the ArmA sounds are in there. Share this post Link to post Share on other sites
nebulazerz 18 Posted July 10, 2016 On 7/10/2016 at 9:56 AM, MrCrazyDude115 said: So I've been working on a small PvP gamemode to play with my friends. Pretty much everything is done except for one thing. Basically I'm trying to make it so that when a sector is captured, a sound will play for whichever side captured it, while a different sound will play for all other sides and so on... Any ideas? Sorta like it is in games like CoD domination mode. Thanks in advance! put this function in your initServer.sqf and remoteExec it from the expression in the sector control. fnc_soundWithSector = { params [ "_module", "_owner" ]; //make sure the PV change has happened waitUntil{ _module getVariable [ "owner", sideUnknown ] isEqualTo _owner }; sleep 0.5; //While the sector still belongs to the players side if { ( _module getVariable [ "owner", sideUnknown ] ) isEqualTo playerSide } then { playSound "Sounds\mysound"; }; }; I use this slightly different, but the way i rewrote it here should work havn't tested it like this though, I use a while to make mine loop with a sleep for sector rewards. Share this post Link to post Share on other sites
MrCrazyDude115 132 Posted July 10, 2016 Alright thank you! I'll try and get it to work. Share this post Link to post Share on other sites
Larrow 2827 Posted July 10, 2016 Quote put this function in your initServer.sqf and remoteExec it from the expression in the sector control.The function needs to be in the initPlayerLocal.sqf, otherwise your calling a function from the server on the server. //initServer.sqf //Wait for everything to finish initialising waitUntil{ !isNil "bis_fnc_init" }; //For every sector { //Add owner changed event [ _x, "ownerChanged", { //when owner changes call fnc on all clients _this remoteExec [ "fnc_playSectorSound", 0 ]; }] call BIS_fnc_addScriptedEventHandler; }forEach ( true call BIS_fnc_moduleSector ); //initPlayerLocal.sqf fnc_playSectorSound = { //Passed variables from sector owner changed event params[ "_module", "_owner", "_oldOwner" ]; switch( true ) do { //Sector no longer belongs to players side case ( _owner isEqualTo playerSide ) : { //play captured sound }; //Sector did belong to players side case ( _oldOwner isEqualTo playerSide ) : { //play lost sound }; }; };Hopefully comments are descriptive enough. 1 Share this post Link to post Share on other sites
MrCrazyDude115 132 Posted July 11, 2016 It works! Thank you so much guys! Share this post Link to post Share on other sites