A function called PlaysoundByName() <-- Huh?

Post » Sat Nov 24, 2012 5:30 pm

So I stumbled over a function I have not seen before and I could not find a page for (using the keyword search) in the Wiki:

playSoundByName()

it was in several Skyrim scripts including DA02Script

Anyone know anything about it?

I am thinking it is probably a user defined function, but I do not see it defined in the script.
So it must be globaly defined in another script and then used here?
But I do not see that in the properties either.

I know I must be missing something obvious, please point it out to me. :blush:

See below the Bethesda script, it has a small spoiler, so it is in the spoiler tag but it is not indented because the spoiler tag will not indent.


Spoiler


Scriptname DA02Script extends Quest  Conditional;&--#60;patch 1.4&--#62;int property stage auto conditional;&--#60;/patch 1.4&--#62;int Property ReasonGiven auto Conditional Hidden ;used in dialogue when Boethiah asks the player why he slayed someone at the shrineObjectReference Property DA02BoethiahShrineMapMarker AutoWeapon Property DA02Dagger AutoBook Property DA02Book AutoQuest Property DA02KillObj autoQuest Property DA02Post AutoScene Property DA02FightScene2 AutoScene Property DA02BoethiahScene1 AutoScene Property DA02BoethiahScene2 AutoScene Property DA02BoethiahArmorWornScene AutoScene Property DA02BoethiahElisifScene AutoScene Property DA02PillarTrapScene AutoFaction Property DA02CultistsAreEnemies AutoFaction Property DA02CulistsPlayerEnemy AutoReferenceAlias Property Fighter1 AutoReferenceAlias Property Fighter2 AutoReferenceAlias Property BoethiahsConduit AutoReferenceAlias Property Champion AutoReferenceAlias Property Cultist1 AutoReferenceAlias Property Cultist2 AutoReferenceAlias Property Cultist3 AutoReferenceAlias Property Cultist4 AutoReferenceAlias Property Cultist5 Autoint conduitAggression ;so i can set it back... shouldn't matter at all since he's dead... but just in case.int conduitAssistance ;so i can set it back... shouldn't matter at all since he's dead... but just in case.;ReferenceAlias Property Contender1 Auto;ReferenceAlias Property Contender2 Auto;ReferenceAlias Property Contender3 AutoInt Property FriendPresent Auto Hidden ;0 not set, 1 = friend is here, -1 = friend has left -- see DA02FriendCheckTriggerScriptint Property countCultists = 5 auto Hidden  ;see incrementCountCultists() and decrementCountCultists() functions;bool Property Contender1AwareOfPlayer Auto Hidden conditional  ;set in OnUpdate() below, and used by packages on Aliases;bool Property Contender2AwareOfPlayer Auto Hidden conditional;bool Property Contender3AwareOfPlayer Auto Hidden conditionalint Property countContenders = 3 auto HiddenArmor Property DA02Cuirass Autoint Property foundMail Auto hidden conditionalint Property championDead Auto hidden conditionalint Property warnedChampion Auto Hidden Conditional  ;set in stage 21 - OBSOLETEFaction Property WINoBodyCleanupFaction AutoReferenceAlias Property DeadFriend AutoObjectReference Property ShrineOfBoethiahRef AutoObjectReference Property DA02PillarRef AutoObjectReference Property FXShrineofBoethiaOrbRef Autoint Property PillarTrappedVictim Auto Conditional ;used as condition on packagesVisualEffect Property DA02SummonValorTargetFX AutoImageSpaceModifier Property DA02ResurrectBlur AutoImageSpaceModifier Property DA02ResurrectBlurAnimated Autobool KilledFriend  ;a "doOnce";BLUE PALACE section: OBSOLETEint Property GuardForcegreet auto hidden Conditional  ;0 = unset, 1 = forcegreeted. set in dialogue.Location Property SolitudeBluePalaceLocation AutoReferenceAlias Property GuardA autoReferenceAlias Property GuardB autoReferenceAlias Property GuardC autoReferenceAlias Property GuardD autoLocationRefType Property DA02PalaceAttackTrigger AutoLocationRefType Property DA02PalaceFollowTrigger AutoLocationRefType Property DA02PalaceWarnTrigger Autoint Property InOfflimitsArea auto hidden conditional  ; &--#62;0 == true, set by processPalaceTrigger which is called by the PalaceXXXTrigger aliases scriptint Property InWarnArea auto hidden conditional   ; &--#62;0 == true, set by processPalaceTrigger which is called by the PalaceXXXTrigger aliases scriptint Property InFollowArea auto hidden conditional   ; &--#62;0 == true, set by processPalaceTrigger which is called by the PalaceXXXTrigger aliases scriptbool PlayerKnownToBeInFollowArea  ;at some point a guard has detected the player in an area he should be escorted. If no guard can detect hime before he's detected in an area he's allowed in alone, they send the alarmint GuardDetectionPollingFrequency = 1 ;used by TestGuardDetection() as the parameter for a RegisterForSingleUpdate()int secondsWithoutDetection	;how long the player has gone undetected while in a secure areaint secondsWithoutDetectionAllowed = 10 ;how many seconds the player can go without being detected while in a secure area before the guards freak outScene Property DA02GuardALostDetectionScene Auto  ;the scene that plays when the player shakes his guard escortScene Property DA02SoundAlarmScene Auto ;scene that starts the guards attacking the playerFaction Property DA02GuardsPlayerEnemy Autoint stageToStopPollingForDetection = 70 ;at this stage or higher stop polling for detection (ie the player has already caused the alarm to go off, or has completed the missionQuest Property DA02GuardWarn Auto  ;makes the closest gaurd say the private area is offlimits, see TestGuardDetection()ReferenceAlias Property FriendEscort Autoint friendEscortDistance = 300  ;how far can the player be away from his friend who is escorting him before the guards freak outint Property NearEscort auto Hidden Conditional  ;used by guard packagesscene Property DA02FriendEscortScene Auto  ;scene where friend gets elisif to open the door for youKey Property SolitudeBluePalaceServantsKey AutoFaction Property DA02ElisifAfraidOfPlayer AutoEvent OnUpdate()if Game.GetPlayer().GetCurrentLocation() == SolitudeBluePalaceLocation;   debug.trace("DA02Script OnUpdate() player is in SolitudeBluePalaceLocation so test for guards detecting him.")  TestGuardDetection()EndIfEndEventFunction PillarTrap(ObjectReference akActionRef);  debug.trace("DA02Script PillarTrap() start")(akActionRef as Actor).setRestrained(true)ShrineOfBoethiahRef.playAnimation("playanim01") ;swirlFXShrineofBoethiaOrbRef.playAnimation("playanim02") ;bubble on - turned off in stage 12(DA02PillarRef as DefaultSoundControlScript).playSoundByName("BubbleActivate") ;oneshot, does not need to be stopped;DA02PillarRef.playAnimation("playanim01") - happens automatically now from callback from furniture .animationDeadFriend.ForceRefTo(akActionRef)PillarTrappedVictim = 1DA02PillarTrapScene.start()  ;this is just to prevent the player from activating the Actor, and make him scared looking; int waitedFor; while DA02PillarTrapScene.isPlaying() == False;  Utility.wait(1);  waitedFor += 1; ;  debug.trace("DA02Script PillarTrap() waiting for scene for " + waitedFor); EndWhile;; (akActionRef as actor).SetDoingFavor(false);  debug.trace("DA02Script PillarTrap() end")EndFunctionFunction PillarKill(Actor Victim)if KilledFriend == false  killedFriend = true;   debug.trace("DA02Script PillarKill() start")  Victim.kill(Game.GetPlayer())  Victim.AddToFaction(WINoBodyCleanupFaction)  DA02PillarRef.playAnimation("playanim02")  (DA02PillarRef as DefaultSoundControlScript).playSoundByName("ShrineSurge")  ShrineOfBoethiahRef.playAnimation("playanim04") ;particals and letters  utility.wait(3)  ;*** KillPreviousConduit() - added 9/10 jduvall, fixes #68068  killPreviousConduit()  BoethiahsConduit.ForceRefTo(Victim)  ShrineOfBoethiahRef.playAnimation("playanim05") ;stop particals, keep letters  SetStage(11);   debug.trace("DA02Script PillarKill() end")endifEndFunctionFunction PillarStop() ; called in stage 20;  debug.trace("DA02Script PillarStop() start")ShrineOfBoethiahRef.playAnimation("playanim03")DA02PillarRef.playAnimation("playanim03")FXShrineofBoethiaOrbRef.playAnimation("playanim01") ;bubble off(DA02PillarRef as DefaultSoundControlScript).stopSoundByName("ShrineSurge");  debug.trace("DA02Script PillarStop() end")EndFunctionfunction killPreviousConduit()Actor Conduit = BoethiahsConduit.GetActorReference()if Conduit  Conduit.SetGhost(false)  Conduit.kill(Game.GetPlayer())EndIfEndFunctionfunction resurrectCounduit(ReferenceAlias AliasToMakeConduit = None){Sets up the conduit as ghost and so it won't try to kill the player when resurrected}actor Conduitif AliasToMakeConduit  BoethiahsConduit.ForceRefTo(AliasToMakeConduit.GetActorReference())EndIfConduit = BoethiahsConduit.GetActorReference()Conduit.SetGhost()Conduit.StopCombat()Conduit.StopCombatAlarm()ConduitAggression = Conduit.GetAv("Aggression") as intConduitAssistance = Conduit.GetAv("Assistance") as intConduit.SetAv("Aggression", 0)Conduit.SetAv("Assistance", 0);DA02ResurrectBlur.ApplyCrossFade(5)DA02ResurrectBlurAnimated.Apply();as a failsafe if something bad happened and the Conduit is really far away, move him to the playerif Conduit.GetDistance(Game.GetPlayer()) &--#62; 1000	Conduit.MoveTo(Game.GetPlayer())endifutility.wait(1)DA02SummonValorTargetFX.play(conduit, 10)utility.wait(0.5)conduit.Resurrect(); ImageSpaceModifier.RemoveCrossFade(1)(BoethiahsConduit as DA02BoethiahsConduitScript).startIMODs()EndFunctionfunction releaseConduit(){Unpacifies, unghosts the conduit, and kills it.}actor Conduit = BoethiahsConduit.GetActorReference()Conduit.SetGhost(false)Conduit.kill(Game.GetPlayer())Conduit.SetAv("Aggression", ConduitAggression)Conduit.SetAv("Assistance", ConduitAssistance)(BoethiahsConduit as DA02BoethiahsConduitScript).stopIMODs(CompletelyStop = True)EndFunctionFunction decrementCountCultists(ReferenceAlias DeadCultistAlias)countCultists -= 1checkDeadAndSetStage(DeadCultistAlias)EndFunctionFunction checkDeadAndSetStage(ReferenceAlias DeadCultistAlias)  ;also called from DA02FighterScript;  debug.trace("DA02Script checkDeadAndSetStage(" + DeadCultistAlias + "): countCultists ==" + countCultists)if countCultists == 0  ;make sure the fighter aliases are all dead or not present -- NOTE: the reason they fighters have don't have the same cultist scripts that decrement the value is because there was more to them in earlier implementation  if (Fighter1.GetActorReference().IsDead() || Fighter1.GetActorReference().GetDistance(Game.GetPlayer()) &--#62; 5000) && (Fighter2.GetActorReference().IsDead() || Fighter2.GetActorReference().GetDistance(Game.GetPlayer()) &--#62; 5000);	debug.trace("DA02Script checkDeadAndSetStage(): countCultists == 0 and Fighter1 and Fighter2 are both dead or far away. Setting Stage 500")     ;*** KillPreviousConduit() - added 9/10 jduvall, fixes #68068   killPreviousConduit()   BoethiahsConduit.ForceRefTo(DeadCultistAlias.GetReference())     setStage(17)  EndIfEndIfEndFunctionFunction MakeCultistsAggressive();  debug.trace("DA02Script MakeCultistsAggressive()")DA02FightScene2.stop()SetStage(6) ;unghosts and vulnerables the fightersFighter1.GetActorReference().AddToFaction(DA02CulistsPlayerEnemy)Fighter2.GetActorReference().AddToFaction(DA02CulistsPlayerEnemy)Cultist1.GetActorReference().AddToFaction(DA02CulistsPlayerEnemy)Cultist2.GetActorReference().AddToFaction(DA02CulistsPlayerEnemy)Cultist3.GetActorReference().AddToFaction(DA02CulistsPlayerEnemy)Cultist4.GetActorReference().AddToFaction(DA02CulistsPlayerEnemy)Cultist5.GetActorReference().AddToFaction(DA02CulistsPlayerEnemy)EndFunctionfunction processPalaceTrigger(ObjectReference TriggerRef, Bool IsEntering);No matter which ref type, the player should be followedif IsEntering  InFollowArea += 1Else  InFollowArea -= 1EndIfif TriggerRef.HasRefType(DA02PalaceWarnTrigger)  if IsEntering   InWarnArea += 1  Else   InWarnArea -= 1  EndIfEndIf  if TriggerRef.HasRefType(DA02PalaceAttackTrigger)  if IsEntering   InOfflimitsArea += 1  Else   InOfflimitsArea -= 1  EndIfEndIf;DEBUG; string debugString = "DA02Script: Player should be ";; if InFollowArea &--#62; 0;  debugString += "FOLLOWED"; Else;  debugString += "NOT FOLLOWED"; EndIf;; if InWarnArea &--#62; 0;  debugString += ", WARNED"; Else;  debugString += ", NOT WARNED"; EndIf;; if InOfflimitsArea &--#62; 0;  debugString += ", ATTACKED"; Else;  debugString += ", NOT ATTACKED"; EndIf; ; debug.trace(debugString);test for detection by the guardsTestGuardDetection()EndFunctionfunction TestGuardDetection()if GetStage() &--#62;= stageToStopPollingForDetection;   debug.trace("DA02Script: TestGuardDetection() quest stage(" + GetStage() + ") &--#62;= stageToStopPollingForDetection(" + stageToStopPollingForDetection + "). Returning early without processing detection.")  ReturnEndIfActor GuardActorA = GuardA.GetActorReference()Actor GuardActorB = GuardB.GetActorReference()Actor GuardActorC = GuardC.GetActorReference()Actor GuardActorD = GuardD.GetActorReference()Actor PlayerActor = Game.GetPlayer() as ActorActor FriendEscortActor = FriendEscort.GetActorReference();*** TO DO: EDIT THIS TO NOT CARE IF THE PLAYER IS CURRENTLY BEING ESCORTED BY A FRIEND WHO BELONGS IN THE PALACEif FriendEscortActor != None && PlayerActor.getDistance(FriendEscortActor) &--#60;= friendEscortDistance  NearEscort = 1;   debug.trace("DA02Script: TestGuardDetection() player is nearby his friend escort, so the guards don't care.")else  NearEscort = 0  if PlayerActor.IsDetectedBy(GuardActorA) || PlayerActor.IsDetectedBy(GuardActorB) || PlayerActor.IsDetectedBy(GuardActorC) || PlayerActor.IsDetectedBy(GuardActorD)     secondsWithoutDetection = 0     if InFollowArea  ;player is in an area where he needs an escort	PlayerKnownToBeInFollowArea = true;	 debug.trace("DA02Script: TestGuardDetection() one of the guards detects the player after he has ENTERED a trigger box.")     Else ;player not in follow area	PlayerKnownToBeInFollowArea = False;	 debug.trace("DA02Script: TestGuardDetection() one of the guards detects the player after he has LEFT a trigger box.")     EndIf     if InWarnArea  ;player is in an area where he needs an escort;	 debug.trace("DA02Script: TestGuardDetection() one of the guards detects the player after he has ENTERED a warn area trigger box, starting DA02GuardWarn quest scene.")	DA02GuardWarn.start()     EndIf     if InOfflimitsArea  ;player is in an area where he isn't allowed;	 debug.trace("DA02Script: TestGuardDetection() player is detected and InOfflimitsArea, SOUND THE ALARM!")	DA02SoundAlarmScene.start()     EndIf      Elseif PlayerKnownToBeInFollowArea  ;then it means he has escaped notice of someone that was keeping an eye on him, sound the alarm   secondsWithoutDetection += 1  ;	debug.trace("DA02Script: TestGuardDetection() secondsWithoutDetection ==" + secondsWithoutDetection)	   if secondsWithoutDetection &--#62; secondsWithoutDetectionAllowed;	 debug.trace("DA02Script: TestGuardDetection() secondsWithoutDetection(" + secondsWithoutDetection + ") &--#62; secondsWithoutDetectionAllowed(" + secondsWithoutDetectionAllowed +") SOUND THE ALARM!")	DA02SoundAlarmScene.start()     Else	if DA02GuardALostDetectionScene.IsPlaying() == False	 DA02GuardALostDetectionScene.start()	EndIf   EndIf    EndIfEndIfGuardActorA.EvaluatePackage()GuardActorB.EvaluatePackage()GuardActorC.EvaluatePackage()GuardActorD.EvaluatePackage()RegisterForSingleUpdate(GuardDetectionPollingFrequency)EndFunctionfunction promoteToFriendEscort(Actor FriendActor)FriendEscort.ForceRefTo(FriendActor)EndFunctionfunction soundAlarm(ObjectReference ObjectAtWhichToCreateDetectionEvent)GuardA.GetActorReference().AddToFaction(DA02GuardsPlayerEnemy)GuardB.GetActorReference().AddToFaction(DA02GuardsPlayerEnemy)GuardC.GetActorReference().AddToFaction(DA02GuardsPlayerEnemy)GuardD.GetActorReference().AddToFaction(DA02GuardsPlayerEnemy)ObjectAtWhichToCreateDetectionEvent.CreateDetectionEvent(Game.GetPlayer() as actor, 100)EndFunctionfunction givePlayerServantsKey(Actor ActorGivingKey)ActorGivingKey.RemoveItem(SolitudeBluePalaceServantsKey)Game.GetPlayer().AddItem(SolitudeBluePalaceServantsKey)EndFunction
User avatar
alyssa ALYSSA
 
Posts: 3382
Joined: Mon Sep 25, 2006 8:36 pm

Post » Sat Nov 24, 2012 7:46 pm

Can't be of much help except to say that if you nest CODE tags inside the spoiler tag it can be indented with spaces.
User avatar
butterfly
 
Posts: 3467
Joined: Wed Aug 16, 2006 8:20 pm

Post » Sat Nov 24, 2012 4:24 pm

DONE.... THANKS! :thumbsup:

Can't be of much help except to say that if you nest CODE tags inside the spoiler tag it can be indented with spaces.
User avatar
courtnay
 
Posts: 3412
Joined: Sun Nov 05, 2006 8:49 pm

Post » Sat Nov 24, 2012 4:25 pm

It's a custom (non-native) function defined in DefaultSoundControlScript...
function playSoundByName(string soundName, ObjectReference ObjectToPlayAt = None)	HandleSoundByName(soundName, true, ObjectToPlayAt)EndFunction
...thus not found on the Wiki.
User avatar
Jessica Nash
 
Posts: 3424
Joined: Tue Dec 19, 2006 10:18 pm


Return to V - Skyrim