Andyno Posted November 23, 2020 Share Posted November 23, 2020 I got this script (by Zorkaz and dylbill)... Scriptname TZStartVertibirdScript extends ObjectReference Message Property TZStartVertibirdMessage Auto ObjectReference Property TZStartVertibirdMarkerRef Auto Actor Property PlayerRef auto Event OnActivate(ObjectReference refAction) ObjectReference refPlayer = Game.GetPlayer() Int Button = TZStartVertibirdMessage.Show() If Button == 0 PlayerRef.MoveTo(TZStartVertibirdMarkerRef) Endif EndEvent ... and I'd like to add some sound effect (DRSVertibirdFlightLoadOpen) for better immersion/realism. Can someone help me out with this, please? Link to comment Share on other sites More sharing options...
Zorkaz Posted November 23, 2020 Share Posted November 23, 2020 Sounds are usally written like this MySound.play(PlayerRef)orMySound.playandwait(PlayerRef) "(...)" contains the sound source to play it from it doesn't have to be "PlayerRef" it can be "Self" too https://www.creationkit.com/index.php?title=Sound_Script Link to comment Share on other sites More sharing options...
Andyno Posted November 24, 2020 Author Share Posted November 24, 2020 I added this line... MySound.playandwait(DRSVertibirdFlightLoadOpen)... and it failed during compilation. It's saying this: variable MySound is undefinedvariable DRSVertibirdFlightLoadOpen is undefinednone is not a known user-defined script type Link to comment Share on other sites More sharing options...
thousande Posted November 24, 2020 Share Posted November 24, 2020 > ... and it failed during compilation. It's saying this Because MySound and DRSVertibirdFlightLoadOpen properties are not defined.Define them with the correct types in your properties in the beginning of the script. Also, > MySound.playandwait(DRSVertibirdFlightLoadOpen) as Zorkaz said, the parameter in the Play() and PlayAndWait() methods is the source of the sound / where the sound is coming from, not the sound as currently defined in your script here. Link to comment Share on other sites More sharing options...
Zorkaz Posted November 24, 2020 Share Posted November 24, 2020 If you have the script attached to the vertibird as an actor or door the source should be "Self" Link to comment Share on other sites More sharing options...
Andyno Posted November 24, 2020 Author Share Posted November 24, 2020 (edited) Thanks, guys, I think I'm slowly getting somewhere... Define them with the correct types in your properties in the beginning of the script.In the link Zorkaz provided there's written "Properties: None", so I thought the Property is not needed. So, how exaclty this property should look like? as Zorkaz said, the parameter in the Play() and PlayAndWait() methods is the source of the sound / where the sound is coming from, not the sound as currently defined in your script hereSo in my script should be this line: "MySound.PlayAndWait(Self)". But where I can actually define what sound will be played? In previous GECKs I should simply add "PlaySound DRSVertibirdFlightLoadOpen", but in this case it seems to be more complicated... If you have the script attached to the vertibird as an actor or door the source should be "Self"Not sure what you mean by "actor", but probably you thought "activator"...? If so, then yes, the vertibird is an activator. Edited November 24, 2020 by Andyno Link to comment Share on other sites More sharing options...
Zorkaz Posted November 24, 2020 Share Posted November 24, 2020 Scriptname TZStartVertibirdScript extends ObjectReference Message Property TZStartVertibirdMessage Auto ObjectReference Property TZStartVertibirdMarkerRef Auto Actor Property PlayerRef auto Sound Property MySound Auto Event OnActivate(ObjectReference refAction) ObjectReference refPlayer = Game.GetPlayer() Int Button = TZStartVertibirdMessage.Show() If Button == 0 MySound.playandwait(Self) PlayerRef.MoveTo(TZStartVertibirdMarkerRef) Endif EndEventAfterwards you close the script, click on "Properties" on your activator and choose your sound And yes I meant "Activator" Link to comment Share on other sites More sharing options...
Andyno Posted November 25, 2020 Author Share Posted November 25, 2020 It works, but the teleportation starts only after the sound stops playing. I guess that's what "PlayAndWait" stands for...So I changed it to "MySound.Play(PlayerRef)", and now it works as it should! Thanks again, guys! :thumbsup: Link to comment Share on other sites More sharing options...
Andyno Posted December 28, 2020 Author Share Posted December 28, 2020 I'd like to improve this script once more, hopefully for the last time...Well, this time I'd like to add to a script a command that disables the vertibird after teleportation. It has to be after for the best immersion experience.Can someone help me what line(s) should I add? Link to comment Share on other sites More sharing options...
Recommended Posts