KappaMeister Posted October 14, 2018 Share Posted October 14, 2018 hey there, I've been using shademe's excellect M.U.T.E mod (which can be found here: https://www.nexusmods.com/oblivion/mods/26442/). Basically, it runs a script that lowers the voice volume to 0 while you're in a conversation with an NPC. However, I'm not a very big fan of how it mutes the dialogue during the service menus and the persuasion wheel. there isn't any option to enable the volume for that in the INI, so I've decided to edit the script myself to implement the change. This is the code for the main script for the mod: scn zzMuteCoreQS ; core script ; lord of the mumblers float fQuestDelayTime float fVoiceVolume array_var aINIFiles ref rFunctINIzer ref rSpeaker short sDoOnce short sNumOfINI short sStart begin gameMode if ( fQuestDelayTime != 0.001 ) set fQuestDelayTime to 0.001 endIf if ( sDoOnce == 0 ) set sDoOnce to 1 let aINIFiles := ar_Construct Array let aINIFiles[ 0 ] := "Data\MUTE.ini" let aINIFiles[ 1 ] := "Data\INI\MUTE.ini" let rFunctINIzer := zzMutezFunctINIzer endIf if ( getGameRestarted ) set sNumOfINI to call rFunctINIzer aINIFiles if ( sNumOfINI < 1 ) messageBox "Warning ! The MUTE INI file was not detected. MUTE will not run correctly. Ensure you have placed it in the correct location" elseIf ( sNumOfINI > 1 ) messageBox "Warning ! Multiple MUTE INI files have been detected. Place only one in one of the 2 possible locations, as listed in the readMe/INI file" endif endIf if ( sStart ) let sStart := 0 setVoiceVolume fVoiceVolume let rSpeaker := 0 endIf end begin menuMode if ( zzMuteVarsQ.sEnabled == 0 ) return endIf if ( getActiveMenuMode == 1009 ) && ( getActiveMenuRef != rSpeaker ) let rSpeaker := getActiveMenuRef if ( rSpeaker.getIsRace Argonian && zzMuteVarsQ.sRaceArgonian == 0 ) return elseIf ( rSpeaker.getIsRace DarkElf && zzMuteVarsQ.sRaceDarkElf == 0 ) return elseIf ( rSpeaker.getIsRace Breton && zzMuteVarsQ.sRaceBreton == 0 ) return elseIf ( rSpeaker.getIsRace HighElf && zzMuteVarsQ.sRaceHighElf == 0 ) return elseIf ( rSpeaker.getIsRace Imperial && zzMuteVarsQ.sRaceImperial == 0 ) return elseIf ( rSpeaker.getIsRace Khajiit && zzMuteVarsQ.sRaceKhajiit == 0 ) return elseIf ( rSpeaker.getIsRace Nord && zzMuteVarsQ.sRaceNord == 0 ) return elseIf ( rSpeaker.getIsRace Orc && zzMuteVarsQ.sRaceOrc == 0 ) return elseIf ( rSpeaker.getIsRace Redguard && zzMuteVarsQ.sRaceRedguard == 0 ) return elseIf ( rSpeaker.getIsRace WoodElf && zzMuteVarsQ.sRaceWoodElf == 0 ) return elseIf ( rSpeaker.isEssential && zzMuteVarsQ.sTalkWhenEssential == 1 ) return elseIf ( rSpeaker.getIsSex Male && zzMuteVarsQ.sMumblingMales == 0 ) || ( rSpeaker.getIsSex Female && zzMuteVarsQ.sMumblingFemales == 0 ) return endIf if ( sStart == 0 ) let fVoiceVolume := getNumericINISetting "fDefaultVoiceVolume:Audio" let sStart := 1 setVoiceVolume 0 endIf endIf end I want to edit this so the mod doesn't mute NPCs when I'm Bartering or Persuading with them, or to atleast set the voice volume to a normal setting when I'm doing said things with an NPC. What's the best and easiest way to that? Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted October 14, 2018 Share Posted October 14, 2018 Hmm, looks like the problem with this script is, it already mutes the NPC only when in dialogue (Menu Mode 1009), not in any of the other Menu Modes, but it doesn't return volume back to normal, before you return back to Game Mode. If I get that right, then the "getActiveMenuRef != rSpeaker" line makes it so the subsequent validity checks are only performed once, until the Active Menu Reference changes.So you should likely first split the "if" condition into 2 separate blocks: if ( getActiveMenuMode == 1009 ) if ( getActiveMenuRef != rSpeaker ) So the condition is technically the same, but you can add an "else"/"elseif" block for "getActiveMenuMode == 1009", so even while still in Menu Mode you can do different things in different Modes.In your case "else" would likely suffice, as you basically want volume to return back to normal in any other Mode but dialogue (1009). In which case you can just repeat the block from above: if ( sStart ) let sStart := 0 setVoiceVolume fVoiceVolume let rSpeaker := 0 endIf Oh, I just forgot something important. If you return back to dialogue, it must of course again set the volume to 0. So we need another "else" block for the "getActiveMenuRef != rSpeaker" condition, for when the MenuMode changed but not the Menu Ref. So, everything put together your MenuMode block would look similar to this: begin menuMode if ( zzMuteVarsQ.sEnabled == 0 ) return endIf if ( getActiveMenuMode == 1009 ) if ( getActiveMenuRef != rSpeaker ) let rSpeaker := getActiveMenuRef if ( rSpeaker.getIsRace Argonian && zzMuteVarsQ.sRaceArgonian == 0 ) return elseIf ( rSpeaker.getIsRace DarkElf && zzMuteVarsQ.sRaceDarkElf == 0 ) return elseIf ( rSpeaker.getIsRace Breton && zzMuteVarsQ.sRaceBreton == 0 ) return elseIf ( rSpeaker.getIsRace HighElf && zzMuteVarsQ.sRaceHighElf == 0 ) return elseIf ( rSpeaker.getIsRace Imperial && zzMuteVarsQ.sRaceImperial == 0 ) return elseIf ( rSpeaker.getIsRace Khajiit && zzMuteVarsQ.sRaceKhajiit == 0 ) return elseIf ( rSpeaker.getIsRace Nord && zzMuteVarsQ.sRaceNord == 0 ) return elseIf ( rSpeaker.getIsRace Orc && zzMuteVarsQ.sRaceOrc == 0 ) return elseIf ( rSpeaker.getIsRace Redguard && zzMuteVarsQ.sRaceRedguard == 0 ) return elseIf ( rSpeaker.getIsRace WoodElf && zzMuteVarsQ.sRaceWoodElf == 0 ) return elseIf ( rSpeaker.isEssential && zzMuteVarsQ.sTalkWhenEssential == 1 ) return elseIf ( rSpeaker.getIsSex Male && zzMuteVarsQ.sMumblingMales == 0 ) || ( rSpeaker.getIsSex Female && zzMuteVarsQ.sMumblingFemales == 0 ) return endIf if ( sStart == 0 ) let fVoiceVolume := getNumericINISetting "fDefaultVoiceVolume:Audio" let sStart := 1 setVoiceVolume 0 endIf ;else ; if ( sStart == 0 ) ; let fVoiceVolume := getNumericINISetting "fDefaultVoiceVolume:Audio" ; let sStart := 1 ; setVoiceVolume 0 ; endIf endIf else if ( sStart ) let sStart := 0 setVoiceVolume fVoiceVolume let rSpeaker := 0 endIf endif end If I'm not thoroughly mistaken, this should already do the trick... unless I missed something I'm not seeing, yet. Give it a try and let me know if it worked. edit: Hmm, I think the inner "else" block won't even be needed, as the Menu Mode can't change without "rSpeaker" getting reset to 0 also. That one's superfluous it seems. Link to comment Share on other sites More sharing options...
KappaMeister Posted October 16, 2018 Author Share Posted October 16, 2018 Hmm, looks like the problem with this script is, it already mutes the NPC only when in dialogue (Menu Mode 1009), not in any of the other Menu Modes, but it doesn't return volume back to normal, before you return back to Game Mode. If I get that right, then the "getActiveMenuRef != rSpeaker" line makes it so the subsequent validity checks are only performed once, until the Active Menu Reference changes.So you should likely first split the "if" condition into 2 separate blocks: if ( getActiveMenuMode == 1009 ) if ( getActiveMenuRef != rSpeaker ) So the condition is technically the same, but you can add an "else"/"elseif" block for "getActiveMenuMode == 1009", so even while still in Menu Mode you can do different things in different Modes.In your case "else" would likely suffice, as you basically want volume to return back to normal in any other Mode but dialogue (1009). In which case you can just repeat the block from above: if ( sStart ) let sStart := 0 setVoiceVolume fVoiceVolume let rSpeaker := 0 endIf Oh, I just forgot something important. If you return back to dialogue, it must of course again set the volume to 0. So we need another "else" block for the "getActiveMenuRef != rSpeaker" condition, for when the MenuMode changed but not the Menu Ref. So, everything put together your MenuMode block would look similar to this: begin menuMode if ( zzMuteVarsQ.sEnabled == 0 ) return endIf if ( getActiveMenuMode == 1009 ) if ( getActiveMenuRef != rSpeaker ) let rSpeaker := getActiveMenuRef if ( rSpeaker.getIsRace Argonian && zzMuteVarsQ.sRaceArgonian == 0 ) return elseIf ( rSpeaker.getIsRace DarkElf && zzMuteVarsQ.sRaceDarkElf == 0 ) return elseIf ( rSpeaker.getIsRace Breton && zzMuteVarsQ.sRaceBreton == 0 ) return elseIf ( rSpeaker.getIsRace HighElf && zzMuteVarsQ.sRaceHighElf == 0 ) return elseIf ( rSpeaker.getIsRace Imperial && zzMuteVarsQ.sRaceImperial == 0 ) return elseIf ( rSpeaker.getIsRace Khajiit && zzMuteVarsQ.sRaceKhajiit == 0 ) return elseIf ( rSpeaker.getIsRace Nord && zzMuteVarsQ.sRaceNord == 0 ) return elseIf ( rSpeaker.getIsRace Orc && zzMuteVarsQ.sRaceOrc == 0 ) return elseIf ( rSpeaker.getIsRace Redguard && zzMuteVarsQ.sRaceRedguard == 0 ) return elseIf ( rSpeaker.getIsRace WoodElf && zzMuteVarsQ.sRaceWoodElf == 0 ) return elseIf ( rSpeaker.isEssential && zzMuteVarsQ.sTalkWhenEssential == 1 ) return elseIf ( rSpeaker.getIsSex Male && zzMuteVarsQ.sMumblingMales == 0 ) || ( rSpeaker.getIsSex Female && zzMuteVarsQ.sMumblingFemales == 0 ) return endIf if ( sStart == 0 ) let fVoiceVolume := getNumericINISetting "fDefaultVoiceVolume:Audio" let sStart := 1 setVoiceVolume 0 endIf ;else ; if ( sStart == 0 ) ; let fVoiceVolume := getNumericINISetting "fDefaultVoiceVolume:Audio" ; let sStart := 1 ; setVoiceVolume 0 ; endIf endIf else if ( sStart ) let sStart := 0 setVoiceVolume fVoiceVolume let rSpeaker := 0 endIf endif end If I'm not thoroughly mistaken, this should already do the trick... unless I missed something I'm not seeing, yet. Give it a try and let me know if it worked. edit: Hmm, I think the inner "else" block won't even be needed, as the Menu Mode can't change without "rSpeaker" getting reset to 0 also. That one's superfluous it seems.thankIt worked perfectly! Thanks a ton :) Link to comment Share on other sites More sharing options...
DrakeTheDragon Posted October 17, 2018 Share Posted October 17, 2018 You're welcome! I'm glad it worked on first try. And again I learned something new, a neat little trick about changing dialogue volume on a per-actor basis in the middle of the game. Link to comment Share on other sites More sharing options...
Recommended Posts