Jump to content

Help with adding a soun to a script


Andyno

Recommended Posts

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

I added this line...

MySound.playandwait(DRSVertibirdFlightLoadOpen)

... and it failed during compilation. It's saying this:

 

variable MySound is undefined

variable DRSVertibirdFlightLoadOpen is undefined
none is not a known user-defined script type

 

Link to comment
Share on other sites

> ... 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

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 here

So 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 by Andyno
Link to comment
Share on other sites

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
EndEvent

Afterwards 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

  • 1 month later...

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

  • Recently Browsing   0 members

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