Jump to content

Add a looped breathing effect when wearing gasmasks.


Recommended Posts

Hello fellow nexus modders!

 

I haven't been making any mods as of yet, only some weapons for Skyrim that I didn't finish into the game yet, thus I will ask you. What would the general idea of the process in making an edgy breathing sound when you wear a gasmask in Fallout 4? I'm pretty sure I haven't heard one, so I'm 99% sure there aren't any such things implemented. Do I have to put a sound effect on the item itself, add a new script or is it possible at all? Is this forum thread stupid?

 

Thanks in advance for any suggestions and tips.

Link to comment
Share on other sites

I don't think you can add an idle sound to an armor. If you can, that should be simple, just make a new sound descriptor with the proper keywords and add those keywords to the mask.

 

If not, you could make a script that runs while the player has the mask equipped that plays the sound but, A constantly running and looping script could cause issues (of which I'm uncertain, but some dirty edits to have looping scripts could cause issues). I'd check the Skyrim CK papyrus section and the dangerous mods list(s) to see what to do and don't.

Link to comment
Share on other sites

Scriptname PlaySoundRandomLoop extends ObjectReference
{Used playing a random sound}

Import Utility
Import Debug

Sound Property SoundDescriptorMale const auto
{Sound Descriptor that this script will play for females}

Sound Property SoundDescriptorFemale const auto
{Sound Descriptor that this script will play for females}

float property delayMin = 1.0 const auto
float property delayMax = 5.0 const auto
float property talkingTimer = 0.2 const auto 

Bool bRunning = False
Bool firstTime = True
Actor ttActor

voicetype property vt = none const auto 
keyword property at = none const auto


int iPlaySoundTimerID = 1 const
int iCheckTalkingID = 2 const 

EVENT OnInit()
	bRunning = isEnabled()
	if (bRunning)
		StartTimer(GetWaitTime(), iPlaySoundTimerID)
	    ;StartTimer(talkingTimer, iCheckTalkingID)
	endIf

EndEvent 

EVENT OnEquipped(Actor akActor)
	;akActor.ChangeAnimFaceArchetype(at)
	akActor.SetOverrideVoiceType(vt)
  
	
	ttActor = akActor 
	bRunning = true 
	if (bRunning)
		StartTimer(GetWaitTime(), iPlaySoundTimerID)
	endIf
EndEvent

Event OnUnEquipped(Actor akActor)
	akActor.SetOverrideVoiceType(None)
	akActor.ChangeAnimFaceArchetype()
	bRunning = false
	CancelTimer(iPlaySoundTimerID)
	;debug.trace("Audio Debug: turning loop off "+self)
EndEvent

Event OnTimer(int aiTimerID)
	if (aiTimerID == iPlaySoundTimerID)
		;Debug.Notification("Play Sound")
		int sleepState = ttActor.GetSleepState()
		bool isDead = ttActor.IsDead() 
		if sleepState != 3 && !isDead ; play when not sleeping or dead.  
			if(ttActor.GetActorBase().GetSex() == 0)
				SoundDescriptorMale.Play(ttActor)
			else
				SoundDescriptorFemale.Play(ttActor)
			endIf
		endif
		
		if (bRunning && isEnabled())
			if ttActor.IsTalking()
				StartTimer(talkingTimer, iCheckTalkingID)
			else
				StartTimer(GetWaitTime(), iPlaySoundTimerID)
			endIf
		endIf
	endIf
	
	if(aiTimerID == iCheckTalkingID)
		if(ttActor.isTalking())
		;	Debug.Notification("Is Talking")
			if(ttActor.GetActorBase().GetSex() == 0)
				SoundDescriptorMale.PlayAndWait(ttActor)
			else
				SoundDescriptorFemale.PlayAndWait(ttActor)
			endIf
			
			if(bRunning && isEnabled())
				if ttActor.IsTalking()
					StartTimer(talkingTimer, iCheckTalkingID)
				else
					StartTimer(GetWaitTime(), iPlaySoundTimerID)
				endIf
			endIf
		endIf
	endIf 
	
EndEvent

float Function GetWaitTime()
	return RandomFloat (DelayMin,DelayMax)
EndFunction

Here is a script I use for one of the mods I'm working on that plays a set of sound effects. This is probably not the best way to do it and is quite inefficient, but it works.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...