Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Level Editor Help sounds
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#3
RE: sounds

In a manner that people can understand (no offense Dn), try using scripting instead of the sound objects in your Level Editor. Those are designed mostly for ambient sounds that loop in a certain location (for example fire, rain, critters etc).

You can play sounds easily using the script:
PHP Code: (Select All)
PlaySoundAtEntity(stringasSoundNamestringasSoundFilestringasEntityfloat afFadeTimebool abSaveSound); 

If you place it within your script file's OnStart function, it will play immediately, just like the sound object. If you want it to play at a certain event, you must call it when that event is executed.

Okay, so let's say you want it to happen when you enter a doorway. First, place a ScriptArea where you want to collide to call it, then add a collision callback in OnStart, like this:

PHP Code: (Select All)
AddEntityCollideCallback("Player""ScriptArea""PlaySound"true1); 

Player is the first entity, and ScriptArea is the second. Make that name match yours in the editor. The third string is the function name, which you can make whatever you want as long as it matches the name of the block you make:

PHP Code: (Select All)
void PlaySound(string &in asParentstring &in asChildint alState)
{
    
PlaySoundAtEntity("""SoundFileName.snt""EntityName"0false);


The first string is just the internal name for the sound object. You can leave it blank. The SoundFileName.snt is the file of the sound you want to play. Pick a sound from the sounds folder or make one yourself. EntityName is where you want to play this sound. You can use Player if you want, or asChild to play it at the area they collided with, or just name it any entity you have in the level.

(This post was last modified: 06-16-2014, 01:38 PM by Mudbill.)
06-16-2014, 01:36 PM
Find


Messages In This Thread
sounds - by G510s - 06-16-2014, 11:19 AM
RE: sounds - by DnALANGE - 06-16-2014, 11:51 AM
RE: sounds - by Mudbill - 06-16-2014, 01:36 PM



Users browsing this thread: 3 Guest(s)