Game Development Community

Sound in TGEA 1.7.0

by Geovanne Ramundo Binda · in Technical Issues · 11/24/2008 (6:42 am) · 1 replies

Hy, I'm using TGEA 1.7.0 and I need a sound for a door when it opens, but I don't know how to do it. I already looked in a few tutorials, but none of them worked, like a trigger or in the script. Does someone know how to create it? Thanks for the help.

About the author

Recent Threads

  • Constructor Urgent Help

  • #1
    11/24/2008 (7:14 am)
    Take a look at how Play3d works.
    ServerPlay3D(%SoundID, %position()

    You need a source location (position) and a predefined sound. I'm assuming you know how to create SFXDescriptions and SFXProfiles.

    What I would do would be to create a field in your door's datablock called OpenSnd. You can also have a CloseSnd or even a LockSnd. I would do it that way in order to have differing sounds per door. Or you could just play a generic door sound instead of creating the new field(s) - it's all up to you. In your code that makes the door open, whether it is a trigger, a collision event, or a "use" method, simply have it switch between to action states: opening and closing - these would be dynamic variables set and altered in code. Something like this would work for playing the sound:
    // upon a door opening event play a sound
    if (%door.opening)
        ServerPlay3D(%door.OpenSnd, %door.getTransform());
    In this case %door would be your object you want the sound asigned to - a door object. If the door is opening then play the door opening sound at the door's position. Carry that logic a bit further and you can play a closing sound when the door is closing.