Jump to content

Can you not .Play() default sounds from a script..?


spacefiddle

Recommended Posts

I am attempting to call a vanilla, existing sound from a script:

alertSound = OBJTurretAlarmAlert.Play(Game.GetPlayer())

I've tried various permutations of things to source it on (playerRef, nearby objects, etc.) but that doesn't seem to be the issue. I keep getting "Cannot call on a None object," implying that it can't find the sound.

Can you only call Play on custom sounds you've added as a replacement file...? Or am I missing something?

I have:

Sound Property OBJTurretAlarmAlert auto
Int Property alertSound auto

alertSound = OBJTurretAlarmAlert.Play(Game.GetPlayer())
Sound.SetInstanceVolume(alertSound, 1)

which I thought would do it.

Link to comment
Share on other sites

You can play vanilla sounds too. Though some of them don`t play for me even in the CK so I`d check them in the CK first.

Have not experimenting with sounds much, but I have an activator that plays a vanilla bell sound on activate.

Sound Property MyBellSound Auto Const 

Event OnActivate(ObjectReference akActionRef)
MyBellSound.Play(Self) 
EndEvent
Edited by kitcat81
Link to comment
Share on other sites

Edit: HAHA YEAH HI, nice to meet you, I am Wile E. Coyote, super-geeeeeeeenyuss.

 

Thank you for your code snippet, it confirmed I'm not completely mad, and that's how it should look. However, when you've been messing with your script for an hour, it's super-helpful to go to the object the damn thing's attached to and make sure the properties are updated...

 

:pinch:

 

...half the things I run into are really obvious, and the other half are impossible. It's almost like being at work, but with more explosions!

Link to comment
Share on other sites

Edit: HAHA YEAH HI, nice to meet you, I am Wile E. Coyote, super-geeeeeeeenyuss.

 

Thank you for your code snippet, it confirmed I'm not completely mad, and that's how it should look. However, when you've been messing with your script for an hour, it's super-helpful to go to the object the damn thing's attached to and make sure the properties are updated...

 

:pinch:

 

...half the things I run into are really obvious, and the other half are impossible. It's almost like being at work, but with more explosions!

No Problem :D Glad to help

Link to comment
Share on other sites

  • Recently Browsing   0 members

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