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
An eager newcomer who wants to learn...
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#12
RE: An eager newcomer who wants to learn...

question 1:
there are three ways to make a sound play, two of those can be activated when entering an area.

- way 1: place a sound entity in Level Editor. These cannot be manipulated, only good for sounds which will be constantly there (like rain patter or fire sound)

- way 2: PlayGuiSound("soundfile.snt" , 1.0f); - this can be activated when entering an area, and creates the sound at the player. however, the sound cannot be stopped with stopsound. this is useful for gasps and sighs by the player.

- way 3: PlaySoundAtEntity("" , "soundfile.snt" , "entity" , 0.0f , false); - this is the way which you would probably like to use and can also be enabled when collidind with an area, it creates a sound at an entity (this can be a door, a script area, an enemy, or even you - "Player")

now to create the sound when you touch an area. in your void OnStart() use
AddEntityCollideCallback("ParentEntity" , "ChildEntity" , "FunctionName" , true , 1);
in this case ParentEntity == "Player"
ChildEntity == "NameofScriptArea"
FunctionName == "Whatever you want"
then create a function for your callback.

void FunctionName(string &in asParent , string &in asChild , int alState)
{
// here use the playsoundatentity i described earlier
}

"(string &in asParent , string &in asChild , int alState)" is something specific to AddEntityCollideCallback. Every AddEntityCollideCallback will link to a function with these 'parameters' (sorry if thats wrong word to use).

Question 2 -

this is a lot easier. in void OnEnter() add

PlayMusic("musicfile.ogg" , true , 1.0f , 10.0f , 1 , true);

the music files can be found in Amnesia - the dark descent>Redist>Music browse to the one you like, then put it in the script!

(This post was last modified: 08-11-2011, 11:37 PM by DRedshot.)
08-11-2011, 11:31 PM
Find


Messages In This Thread
RE: An eager newcomer who wants to learn... - by DRedshot - 08-11-2011, 11:31 PM



Users browsing this thread: 1 Guest(s)