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
G510s Offline
Banned

Posts: 58
Threads: 32
Joined: Jun 2014
#1
sounds

when i put in a sound into the game it playes the sound as soon i spawn into the map or level...there are 2 circles around the sound icon but idk if tht has anything to do with it.

PLEASE HELP!
06-16-2014, 11:19 AM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#2
RE: sounds

You should try to script it..
Add a timer on OnStart.
""Dont know .. but you might want to use a collide function to activate the sound?""
Then add a scriptarea where you want that sound and that should do the trick.
That function is called : PlaySoundAtEntity("", YOURSOUNDFILEHERE.snt", "THE_NAME_OF_THE_SCRIPTAREA_FOR_YOUR_SOUND_HERE", 1.0f, false);
(This post was last modified: 06-16-2014, 11:53 AM by DnALANGE.)
06-16-2014, 11:51 AM
Find
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




Users browsing this thread: 1 Guest(s)