Coldfront15 11 Posted May 26, 2021 Hello, I am trying to play a certain sound upon opening a container i'm importing into the game. However, I don't really know how to do this. Currently I am doing the following but to no avail: config.cpp Quote class CfgSounds { sounds[] = {bagopen, bagclose}; class bagopen { name = "BagOpen"; sound[] = {\simc_obj_44\sounds\open_bag.ogg, db+1, 1.0}; titles[] = {0, ""}; }; class bagclose { name = "BagClose"; sound[] = {\simc_obj_44\sounds\close_bag.ogg, db+1, 1.0}; titles[] = {0, ""}; }; }; class CfgFunctions { class bagsounds_tag { class bagsounds_category { class bagsounds_function { file = "\simc_obj_44\bagsounds.sqf"; preInit = 1; postInit = 1; preStart = 1; recompile = 1; ext = ".sqf"; headerType = -1; }; }; }; }; bagsounds.sqf Quote player addEventHandler ["ContainerOpened", { params ["simc_a5_container"]; playSound "bagopen"; }]; player addEventHandler ["ContainerClosed", { params ["simc_a5_container"]; playSound "bagclose"; }]; Everything else about my object works as it should and acts as a proper container: I just cannot figure out how to play these sounds to the player locally upon opening or closing the bag. Any help is appreciated. Share this post Link to post Share on other sites
pierremgi 4743 Posted May 27, 2021 That's rather a subject for this section. anyway, your params is wrong. params needs local variables, not the stringed object itself. params ["_cont"]; if (_cont == simc_a5_container) then {playSound "bagopen"}; (i supposed simc_a5_container is an object, not a class) Share this post Link to post Share on other sites