Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Sound in scripting


Tonycubed2
 Share

Recommended Posts

Greetings,

Am I imagining things or is there zero tutorials out there on how to use sound with skyrim papyrus?? None of the 10 Bethesda tutorials cover it. No you tube videos explain it. Found nothing here, either.

I managed to copy a game example and placed a sound market to play spooky sounds at night. The premade cricket sound markers were great since they appear only t night. Seemed easy to place. But they play 24/7 though they should not.

Are they supposed to be hidden? Inhavebthem on the main road next to a graveyard. If I walk over them they activate no matter the time. Is that why some sound markers are inside walls?

And how to extend the range they can be heard.

We need a good tutorial on this.

Respectfully

Tony

Link to comment
Share on other sites

I don't think this is a scripting question but we can investigate it some.

The 'Sound Marker' objects when placed are a green speaker marker. They should play 24/7.

'Accoustic Spaces' can play a range of different sounds.

What sounds are you talking about? I don't see any cricket sounds.

I would like to look into which sound objects are based on the time of day.

Link to comment
Share on other sites

I don't think this is a scripting question but we can investigate it some.

The 'Sound Marker' objects when placed are a green speaker marker. They should play 24/7.

'Accoustic Spaces' can play a range of different sounds.

What sounds are you talking about? I don't see any cricket sounds.

I would like to look into which sound objects are based on the time of day.

Link to comment
Share on other sites

Ok, I am home for a few minutes. Here are screenshots showing the cricket Sound Descriptors, notice on the second picture the check box that says "conditions", if you check it off then you can get to the second tab with the same name and set time conditions (many many other conditions besides time too can be used in many ways). Picture three will show that. The green placeable sound markers use a reference that point back to this Sound Descriptors. A nice feature is that you can have many many related sounds in the descriptor and it will play them back randomly. Why there is gazillion of cricket sound descriptors all timed is a mystery to me. Another interesting thing: there is a script box as well that will accept scrips in teh palced greeen box. Makes it super flexible for other things .

Pic 1:

http://img196.imageshack.us/img196/5461/soundpic1.jpg

Pic 2:

http://img201.imageshack.us/img201/9481/soundpic2.jpg

Pic 3:

http://img804.imageshack.us/img804/3659/soundpic3.jpg

Just in case the links do not work as expected here is the link to my imageshack folder: http://my.imageshack.us/v_images.php

Link to comment
Share on other sites

I played some more with the new objects, and was able to place them near the area I wanted. How far they can be heard from ground zero is determined by which model you attach to them. But they are designed to play continously or in a single shot. Like a brook flowing. Not at random times. Can't have a zombie moaning 24/7.

Willisea, when you made your script, what did you attach it to? Where is the script firing from? Also, would it be possible to post a sample script that picks random sounds for plagiarism, I mean, leaning purposes?

Edited by Tonycubed2
Link to comment
Share on other sites

My script used the old Oblivion scripting language. I have not done one for the new, but I do have a script that you could plagerize copy and use. You just add the sound object properties you want, and play then using the random number generator.

You could also randomly generate a number to wait between sounds using the 'wait' command.

You will probably need to use a quest script to make it run all the time. I have not figured out how to do that yet.

This script, when activated, will drop a random number of gems and gold from one of 5 xmarkers.


{Button to summon treasure drop script}

ObjectReference Property LevDropMark1REF auto
ObjectReference Property LevDropMark2REF auto
ObjectReference Property LevDropMark3REF auto
ObjectReference Property LevDropMark4REF auto
ObjectReference Property LevDropMark5REF auto

MiscObject Property Gold001 Auto
MiscObject Property GemAmethyst Auto
MiscObject Property GemAmethystFlawless Auto
MiscObject Property GemDiamond Auto
MiscObject Property GemDiamondFlawless Auto
MiscObject Property GemEmerald Auto
MiscObject Property GemEmeraldFlawless Auto
MiscObject Property GemGarnet Auto
MiscObject Property GemGarnetFlawless Auto
MiscObject Property GemRuby Auto
MiscObject Property gemRubyFlawless Auto
MiscObject Property GemSapphire Auto
MiscObject Property GemSapphireFlawless Auto

Sound Property QSTAstrolabeButtonPressX Auto

int random1
int random2
int random3
int random4
int myNum
int myLoop

Event OnActivate(ObjectReference akActionRef)
If akActionRef == Game.GetPlayer()
PlayAnimation("Activate")
QSTAstrolabeButtonPressX.Play(Self)
random4 = Utility.RandomInt(1, 4)
myLoop = 0

while (myLoop < random4)
myLoop = (myLoop + 1)
random1 = Utility.RandomInt()
random2 = Utility.RandomInt()

if random1 < 25
random3 = Utility.RandomInt(0, 1)
if random2 < 20
LevDropMark1REF.PlaceAtMe(Gold001, random3)
LevDropMark1REF.PlaceAtMe(GemGarnet)
elseif random2 < 40
LevDropMark2REF.PlaceAtMe(Gold001, random3)
LevDropMark2REF.PlaceAtMe(GemEmerald)
elseif random2 < 60
LevDropMark3REF.PlaceAtMe(Gold001, random3)
LevDropMark3REF.PlaceAtMe(GemAmethyst)
elseif random2 < 80
LevDropMark4REF.PlaceAtMe(Gold001, random3)
LevDropMark4REF.PlaceAtMe(GemSapphire)
else
LevDropMark5REF.PlaceAtMe(Gold001, random3)
LevDropMark5REF.PlaceAtMe(GemRuby)
endif

elseif random1 < 45
random3 = Utility.RandomInt(0, 2)
if random2 < 20
LevDropMark1REF.PlaceAtMe(Gold001, random3)
LevDropMark1REF.PlaceAtMe(GemRuby)
elseif random2 < 40
LevDropMark2REF.PlaceAtMe(Gold001, random3)
LevDropMark2REF.PlaceAtMe(GemSapphire)
elseif random2 < 60
LevDropMark3REF.PlaceAtMe(Gold001, random3)
LevDropMark3REF.PlaceAtMe(GemEmerald)
elseif random2 < 80
LevDropMark4REF.PlaceAtMe(Gold001, random3)
LevDropMark4REF.PlaceAtMe(GemAmethyst)
else
LevDropMark5REF.PlaceAtMe(Gold001, random3)
LevDropMark5REF.PlaceAtMe(GemDiamond)
endif

elseif random1 < 65
random3 = Utility.RandomInt(0, 3)
if random2 < 20
LevDropMark1REF.PlaceAtMe(Gold001, random3)
LevDropMark1REF.PlaceAtMe(GemDiamondFlawless)
elseif random2 < 40
LevDropMark2REF.PlaceAtMe(Gold001, random3)
LevDropMark2REF.PlaceAtMe(GemEmeraldFlawless)
elseif random2 < 60
LevDropMark3REF.PlaceAtMe(Gold001, random3)
LevDropMark3REF.PlaceAtMe(gemRubyFlawless)
elseif random2 < 80
LevDropMark4REF.PlaceAtMe(Gold001, random3)
LevDropMark4REF.PlaceAtMe(GemSapphireFlawless)
else
LevDropMark5REF.PlaceAtMe(Gold001, random3)
LevDropMark5REF.PlaceAtMe(GemAmethystFlawless)
endif

elseif random1 < 75
random3 = Utility.RandomInt(0, 4)
if random2 < 20
LevDropMark1REF.PlaceAtMe(Gold001, random3)
LevDropMark1REF.PlaceAtMe(GemAmethystFlawless)
elseif random2 < 40
LevDropMark2REF.PlaceAtMe(Gold001, random3)
LevDropMark2REF.PlaceAtMe(GemRuby)
elseif random2 < 60
LevDropMark3REF.PlaceAtMe(Gold001, random3)
LevDropMark3REF.PlaceAtMe(GemGarnetFlawless)
elseif random2 < 80
LevDropMark4REF.PlaceAtMe(Gold001, random3)
LevDropMark4REF.PlaceAtMe(GemEmerald)
else
LevDropMark5REF.PlaceAtMe(Gold001, random3)
LevDropMark5REF.PlaceAtMe(GemDiamond)
endif

elseif random1 < 90
random3 = Utility.RandomInt(0, 5)
if random2 < 20
LevDropMark1REF.PlaceAtMe(Gold001, random3)
LevDropMark1REF.PlaceAtMe(GemEmerald)
elseif random2 < 40
LevDropMark2REF.PlaceAtMe(Gold001, random3)
LevDropMark2REF.PlaceAtMe(GemDiamond)
elseif random2 < 60
LevDropMark3REF.PlaceAtMe(Gold001, random3)
LevDropMark3REF.PlaceAtMe(GemRuby)
elseif random2 < 80
LevDropMark4REF.PlaceAtMe(Gold001, random3)
LevDropMark4REF.PlaceAtMe(GemAmethyst)
else
LevDropMark5REF.PlaceAtMe(Gold001, random3)
LevDropMark5REF.PlaceAtMe(GemSapphire)
endif

else
random3 = Utility.RandomInt(0, 6)
if random2 < 20
LevDropMark1REF.PlaceAtMe(Gold001, random3)
LevDropMark1REF.PlaceAtMe(GemEmeraldFlawless)
elseif random2 < 40
LevDropMark2REF.PlaceAtMe(Gold001, random3)
LevDropMark2REF.PlaceAtMe(GemDiamondFlawless)
elseif random2 < 60
LevDropMark3REF.PlaceAtMe(Gold001, random3)
LevDropMark3REF.PlaceAtMe(GemRubyFlawless)
elseif random2 < 80
LevDropMark4REF.PlaceAtMe(Gold001, random3)
LevDropMark4REF.PlaceAtMe(GemAmethystFlawless)
else
LevDropMark5REF.PlaceAtMe(Gold001, random3)
LevDropMark5REF.PlaceAtMe(GemSapphireFlawless)
endif

endif
EndWhile
EndIf
endEvent
Scriptname LevelersButton00DropScript extends ObjectReference  

Link to comment
Share on other sites

Indeed I am trying the trigger zone. Since I need it to run continuously I could not use ontriggerentermor ontriggerleave (syntax approximate). I am using just on trigger which will run continuously as long as the player is in the field. But I worry about CPU usage and how that may affect fps for the people using the mod. And I need a pause between the sound effects to make them appear random, which is another problem. The wait command halts the entire script, which is no good since the same script willbe spawning monsters randomly.

Link to comment
Share on other sites

Got the random monster sounds working, now I just need to add script to spawn undead and it will be all done. Script also makes sure the game time is between 10pm and 4am.


Scriptname TombsHaunted extends ObjectReference  


import sound

import game

import utility

GlobalVariable property GameHour auto

Float Property NoEarlierThan = 20.0 Auto  

Float Property NoLaterThan = 4.0 Auto  

int random

int random1 

int random2 

int random3 

int random4 

int myNum 

int myLoop 

int timer

int instanceID00

ObjectReference property mySoundOrigin auto





bool function IsTimeValid()

	Float TT = GameHour.GetValue()   

		if TT > 13

             		if TT >= NoEarlierThan

			return TRUE

		       endif

            elseif TT <=  NoLaterThan    

			return TRUE

		endif

	Return FALSE

endFunction



Event OnTrigger(ObjectReference akActionRef)

Debug.Notification("Triggered")

	if (akActionRef == Game.GetPlayer()) 

		if  IsTimeValid()

		Debug.Notification("Time is Valid")

Debug.Notification("timer is now: "+timer)

if timer < 1

timer = Utility.RandomInt(5, 25)

Debug.Notification("timer initialize: "+timer)

random = Utility.RandomInt(1, 100)

Debug.Notification("20 percent chance of moan: "+random)

if  random < 21

random1 = Utility.RandomInt(1, 100) 

Debug.Notification("random1: "+random1)

if random1 < 8 && random1 > 0

instanceID00 = Zombie1TT.Play(Self)

                         elseif random1 < 15 && random1 > 8 

instanceID00 = Zombie2TT.Play(Self)                              

                         elseif random1 < 20 && random1 > 15

instanceID00 = Zombie3TT.Play(Self)  				

                         elseif random1 < 30 && random1 > 20

instanceID00 = Zombie4TT.Play(Self)                                

                         elseif random1 < 40 && random1 > 30

instanceID00 = Zombie5TT.Play(Self)                               

                         elseif random1 < 50 && random1 > 40

instanceID00 = Zombie6TT.Play(Self)  

                         elseif random1 < 60 && random1 > 50 

instanceID00 = Zombie7TT.Play(Self) 				

                         elseif random1 < 70 && random1 > 60

instanceID00 = Zombie8TT.Play(Self)                                 

                         elseif random1 < 80 && random1 > 70

instanceID00 = Zombie9TT.Play(Self)                               

                         elseif random1 < 90 && random1 > 80

instanceID00 = Zombie10TT.Play(Self)

                         elseif random1 <101 && random1 > 90

instanceID00 = Zombie11TT.Play(Self)

                        endif 

endif

             	endif

	endif

endif

if timer >0

timer = timer - 1

Debug.Notification("timer minus 1: "+timer)

endif

EndEvent










Sound Property Zombie1TT  Auto  


Sound Property Zombie2TT  Auto  


Sound Property Zombie3TT  Auto  


Sound Property Zombie4TT  Auto  


Sound Property Zombie5TT  Auto  


Sound Property Zombie6TT  Auto  


Sound Property Zombie7TT  Auto  


Sound Property Zombie8TT  Auto  


Sound Property Zombie9TT  Auto  


Sound Property Zombie10TT  Auto  


Sound Property Zombie11TT  Auto  

Edited by Tonycubed2
Link to comment
Share on other sites

Done with this script. Posting it here in case it can help someone.

The script only runs at at night, from 8pm to 4am. The script will play 11 different spooky sounds at tandom times once player enters the area with the activator. And it will spawn a random number of undead with a slight chance of spawning a Dremora.


Scriptname TombsHaunted extends ObjectReference  


import sound

import game

import utility

GlobalVariable property GameHour auto

Float Property NoEarlierThan = 20.0 Auto  

Float Property NoLaterThan = 4.0 Auto  

int random

int random1 

int random2 

int random3 

int random4 

int random5

int random6

int myNum 

int myLoop 

int timer

int instanceID00

ObjectReference property mySoundOrigin auto

ObjectReference Property dhLoc  Auto  

ObjectReference Property dhLo2  Auto




bool function IsTimeValid()

	Float TT = GameHour.GetValue()   

		if TT > 13

             		if TT >= NoEarlierThan

			return TRUE

		       endif

            elseif TT <=  NoLaterThan    

			return TRUE

		endif

	Return FALSE

endFunction



Event OnTrigger(ObjectReference akActionRef)

	if (akActionRef == Game.GetPlayer()) 

		if  IsTimeValid()

random3 = Utility.RandomInt(1, 300)

random6 = Utility.RandomInt(2, 10)

if random3 < 2

random4 = Utility.RandomInt(1, 10)

if random4 > 5

dhLoc.PlaceAtMe  (LivingDead , random6)  

Debug.Notification("Ambush!")

instanceID00 = Zombie6TT.Play(Self) 

Else 

dhLo2.PlaceAtMe  (LivingDead , random6)

Debug.Notification("Undead!!") 

instanceID00 = Zombie6TT.Play(Self) 

endif

random5 = Utility.RandomInt(1, 10)

if random5 > 7

dhLoc.PlaceAtMe (Warlock, 1)

endif

endif 

if timer < 1

timer = Utility.RandomInt(5, 25)

random = Utility.RandomInt(1, 100)

if  random < 21

random1 = Utility.RandomInt(1, 100) 

if random1 < 8 && random1 > 0

instanceID00 = Zombie1TT.Play(Self)

                         elseif random1 < 15 && random1 > 8 

instanceID00 = Zombie2TT.Play(Self)                              

                         elseif random1 < 20 && random1 > 15

instanceID00 = Zombie3TT.Play(Self)  				

                         elseif random1 < 30 && random1 > 20

instanceID00 = Zombie4TT.Play(Self)                                

                         elseif random1 < 40 && random1 > 30

instanceID00 = Zombie5TT.Play(Self)                               

                         elseif random1 < 50 && random1 > 40

instanceID00 = Zombie6TT.Play(Self)  

                         elseif random1 < 60 && random1 > 50 

instanceID00 = Zombie7TT.Play(Self) 				

                         elseif random1 < 70 && random1 > 60

instanceID00 = Zombie8TT.Play(Self)                                 

                         elseif random1 < 80 && random1 > 70

instanceID00 = Zombie9TT.Play(Self)                               

                         elseif random1 < 90 && random1 > 80

instanceID00 = Zombie10TT.Play(Self)

                         elseif random1 <101 && random1 > 90

instanceID00 = Zombie11TT.Play(Self)

                    endif 

			endif

             		endif

                    endif

if timer >0

timer = timer - 1

			endif

			endif

EndEvent










Sound Property Zombie1TT  Auto  


Sound Property Zombie2TT  Auto  


Sound Property Zombie3TT  Auto  


Sound Property Zombie4TT  Auto  


Sound Property Zombie5TT  Auto  


Sound Property Zombie6TT  Auto  


Sound Property Zombie7TT  Auto  


Sound Property Zombie8TT  Auto  


Sound Property Zombie9TT  Auto  


Sound Property Zombie10TT  Auto  


Sound Property Zombie11TT  Auto  





ActorBase Property LivingDead  Auto  


Int Property random4  Auto  


ActorBase Property Warlock  Auto  


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...