Modme Forums

Add a kvp that plays a sound when a door is activated or purchased?

Game Asset Reversing | Releases


bubba443:

How does one do this?


FinalKillGaming:

Write a simple script with a function to wait until the player triggers the door, then make a sound alias and make sure it's a 3D sound, then call PlaySound("your_alias_name") on the door trigger.

//put this anywhere in your zm_usermapname.gsc and call it for each trigger with the trigger targetname KVP below zm_usermap::init();
//ex. thread doorSound("radiant_door_trigger_targetname", "your_sound_alias_name");
function doorSound(doorTrigName, sound){
doorTrig = GetEnt(doorTrigName, "targetname");
if(!isdefined(doorTrig)) return;
level endon("intermission");
while(1){
doorTrig waittill("door_opened");
doorTrig PlaySound(sound);
}

}


D-2-K:

with the trigger just add a kvp "script_sound" then "alias_name" (plays a sound once triggerd) no need for FinalKillGamings script

Check here detailed instructions on how to do everything regarding doors and debris