Jump to content

How to declare Sound Marker property in a script


Recommended Posts

Greetings,


I have created a sound descriptor FO4_ChurchBellsRinging and a sound marker FO4_ChurchBellsRingingMarker in the CK. The FO4_ChurchBellsRingingMarker is placed in the church steeple. I want to play the sound via a script but can’t seem to find a way to declare the FO4_ChurchBellsRingingMarker. The script itself is attached to a quest. Suggestions.




Scriptname WorkshopSummonedByChurchScript extends Quest

RefCollectionAlias Property Alias_WorkshopNPCs Auto Const

ReferenceAlias Property Alias_Workshop Auto Const

workshopparentscript Property WorkshopParent Auto Const

ActorValue Property WorkshopBellDistance Auto Const

ReferenceAlias Property Alias_Bell Auto Const

Sound Property FO4_ChurchBellsRinging const auto
{Sound Descriptor that this script will play}

???? Sound Marker Property FO4_ChurchBellsRingingMarker const auto
{Marker depicting the location from which the sound will play}

function Startup()
; debug.trace(self + " FO4_SummonCongregationQuest: Stage 10 The summon quest has begun")
FO4_ChurchBellsRinging.play(FO4_ChurchBellsRingingMarker)
ObjectReference[] workshopNPCs = WorkshopParent.GetWorkshopActors(Alias_Workshop.GetRef() as WorkshopScript)
; add them all to the collection
int i = 0
while i < workshopNPCs.Length
ObjectReference theNPC = workshopNPCs[i]
; what distance to travel (to randomize a bit)
int dieRoll = Utility.RandomInt(0, 2)
theNPC.SetValue(WorkshopBellDistance, dieRoll)
Alias_WorkshopNPCs.AddRef(theNPC)
i += 1
endWhile
; start timer
;StartTimerGameTime(5.5)
endFunction

; timer shuts down quest
;Event OnTimerGameTime(int aiTimerID)
;Stop()
;EndEvent




Link to comment
Share on other sites

 

Greetings,
I have created a sound descriptor FO4_ChurchBellsRinging and a sound marker FO4_ChurchBellsRingingMarker in the CK. The FO4_ChurchBellsRingingMarker is placed in the church steeple. I want to play the sound via a script but can’t seem to find a way to declare the FO4_ChurchBellsRingingMarker. The script itself is attached to a quest. Suggestions.
Scriptname WorkshopSummonedByChurchScript extends Quest

RefCollectionAlias Property Alias_WorkshopNPCs Auto Const

ReferenceAlias Property Alias_Workshop Auto Const

workshopparentscript Property WorkshopParent Auto Const

ActorValue Property WorkshopBellDistance Auto Const

ReferenceAlias Property Alias_Bell Auto Const

Sound Property FO4_ChurchBellsRinging const auto
{Sound Descriptor that this script will play}

???? Sound Marker Property FO4_ChurchBellsRingingMarker const auto
{Marker depicting the location from which the sound will play}

function Startup()
	; debug.trace(self + " FO4_SummonCongregationQuest: Stage 10 The summon quest has begun")
	FO4_ChurchBellsRinging.play(FO4_ChurchBellsRingingMarker)
	ObjectReference[] workshopNPCs = WorkshopParent.GetWorkshopActors(Alias_Workshop.GetRef() as WorkshopScript)
	; add them all to the collection
	int i = 0
	while i < workshopNPCs.Length
		ObjectReference theNPC = workshopNPCs[i]
		; what distance to travel (to randomize a bit)
		int dieRoll = Utility.RandomInt(0, 2)
		theNPC.SetValue(WorkshopBellDistance, dieRoll)
		Alias_WorkshopNPCs.AddRef(theNPC)
		i += 1
	endWhile
	; start timer
	;StartTimerGameTime(5.5)
endFunction

; timer shuts down quest
;Event OnTimerGameTime(int aiTimerID)
	;Stop()
;EndEvent

 

You can put the Sound Descriptor(s) in a "FormList" and declare it instead in your script.

Link to comment
Share on other sites

Resolved: So apparently, one cannot declare a Sound Marker as a property in the script. The workaround was to use an xmarker (FO4_ChurchBellsLocMarker).

 

ObjectReference Property FO4_ChurchBellsLocMarker const auto
{XMarker depicting the location from which the sound will play}
This worked okay; however, the sound was loud enough because of the distance. Reverted back to using the player as the ref.
Scriptname WorkshopSummonedByChurchScript extends Quest

; ╔═════════════════════════════════════════════════╗
; ║                   Properties                    ║
; ╚═════════════════════════════════════════════════╝

RefCollectionAlias Property Alias_WorkshopNPCs Auto Const

ReferenceAlias Property Alias_Workshop Auto Const

workshopparentscript Property WorkshopParent Auto Const

ActorValue Property WorkshopBellDistance Auto Const

ReferenceAlias Property Alias_Bell Auto Const

;Sound Property FO4_ChurchBellsRinging const auto
;{Sound Descriptor that this script will play}

ObjectReference Property FO4_ChurchBellsLocMarker const auto
{XMarker depicting the location from which the sound will play}

Actor Property pPlayerREF Auto Const Mandatory

function Startup()
	; debug.trace(self + " FO4_SummonCongregationQuest: Stage 10 The summon quest has begun")
	FO4_ChurchBellsRinging.play(pPlayerREF)
	ObjectReference[] workshopNPCs = WorkshopParent.GetWorkshopActors(Alias_Workshop.GetRef() as WorkshopScript)
	; add them all to the collection
	int i = 0
	while i < workshopNPCs.Length
		ObjectReference theNPC = workshopNPCs[i]
		; what distance to travel (to randomize a bit)
		int dieRoll = Utility.RandomInt(0, 2)
		theNPC.SetValue(WorkshopBellDistance, dieRoll)
		Alias_WorkshopNPCs.AddRef(theNPC)
		i += 1
	endWhile
	; start timer
	;StartTimerGameTime(5.5)
endFunction

function Shutdown()
	;start timer
	StartTimerGameTime(0.5)
	; timer shuts down quest
endFunction

Event OnTimerGameTime(int aiTimerID)
	Stop()
EndEvent
Link to comment
Share on other sites

There are two other common cases of non persistent workshop assigned actors with unloaded 3d that GetWorkshopActors will not find which are good to include for full QOL:

(pWorkshopParent as WorkshopParentScript).CaravanActorAliases

(pGenericGoHome as GenericGoHomeScript).GoHomeActors

 

Filter local workshop members with (thisActor as WorkshopNPCScript).GetWorkshopID() == iWorkshopID

Link to comment
Share on other sites

 

There are two other common cases of non persistent workshop assigned actors with unloaded 3d that GetWorkshopActors will not find which are good to include for full QOL:

(pWorkshopParent as WorkshopParentScript).CaravanActorAliases

(pGenericGoHome as GenericGoHomeScript).GoHomeActors

 

Filter local workshop members with (thisActor as WorkshopNPCScript).GetWorkshopID() == iWorkshopID

 

Good copy SKK50. I will file this away in my big book of knowledge that I'm collecting.

Link to comment
Share on other sites

Ah, I get it now.

Nope. You have to use Form for that, like SKK50 probably already pointed out.

 

Re the volume thing: To vary sound volume, you can create a new sound output model and adjust attenuation. But this will only ever lower volume, never increase it.

I think you could set up an effect chain to boost the volume. That, or simply edit a copy of the the base sound file with Audacity.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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