Frictional Games Forum (read-only)
Question about script for sound and forced look - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Question about script for sound and forced look (/thread-6627.html)



Question about script for sound and forced look - Ge15t - 02-18-2011

This was in the recollection thread:

Code:
PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);

-Where string& asSoundName is name of a sound.(Can be left blank, unless you want it to loop, and later stop.
-string& asSoundFile is sound file; the file you want to be played.
-string& asEntity is entity you want it to be played.(For example "player" makes it play at player, but if you want the sound to be heard from elsewhere; let's say a piano called "piano1", you put that("piano1") there.
-float afFadeTime is time it should fade, for example 1.0f would put 1 second fade time.
-bool abSaveSound. I am not sure what this is Just set it to false.

And you can stop it by using:
Code:
StopSound(string& asSoundName, float afFadeTime);
-Where string& asSoundName is name of a sound(see above.)
-float afFadeTime; fade time, see above.


But how would I actually input this into my script? ATM im putting it in as this : PlaySoundAtEntity(ramble, CH01_DanielRamble_01, door_1, 0, false);

I know this isnt correct, but I followed the above instructions and tried different variations to this, but the game doesnt even start, just comes up with a fatal error. Can someone help a noob please? lol


RE: Question about script for sound and forced look - jens - 02-18-2011

You have to put strings (text) in "" so
PlaySoundAtEntity("ramble", "CH01_DanielRamble_01", "door_1", 0, false);

As it says on the wiki and a ton of other places, get some basic understanding of scripting/programming before trying to script with the game. I suggest googeling javascript tutorials, to get an easy way of reading and testing out a typical script language.


RE: Question about script for sound and forced look - Vradcly - 02-18-2011

PlaySoundAtEntity("ramble", "CH01_DanielRamble_01.ogg", "door_1", 0.0f, false);
this if the correct way (except some sounds can have more complicated pathways and in some cases there is a difference in .snt and .ogg files, I havent identified the pattern though..) So if this does not work try another sound file just to make sure that is not the error Smile.
Its always "text" in this kind of script things and the numbers 0.0f is usually a float variable (meaning its best to give it one decimal and the letter f after).


RE: Question about script for sound and forced look - Ge15t - 02-18-2011

Sorry I should have been more specific (need coffee).

I do understand scripting to some degree, I understand what it all means, just trying to get my head around the 'functionnamehere' part of it. Basically what I want to happen, is that when I attempt to open the locked door, it will play the CH01_DanielRamble_01. How would I set this one out? If i can nail this, i should be set for most other script functions lol.

So, is there a giant list of all functions? eg. "PlaySoundAtEntity"?

Thanks for the help


RE: Question about script for sound and forced look - Selyp - 02-18-2011

(02-18-2011, 09:43 AM)Ge15t Wrote: So, is there a giant list of all functions? eg. "PlaySoundAtEntity"?

Thanks for the help

Giant list of functions located here. http://wiki.frictionalgames.com/hpl2/amnesia/script_functions


RE: Question about script for sound and forced look - Ge15t - 02-19-2011

(02-18-2011, 10:35 AM)Selyp Wrote:
(02-18-2011, 09:43 AM)Ge15t Wrote: So, is there a giant list of all functions? eg. "PlaySoundAtEntity"?

Thanks for the help

Giant list of functions located here. http://wiki.frictionalgames.com/hpl2/amnesia/script_functions

OK thanks heaps for that, after looking through that list, I still cant quite get what I want to happen (attempt to open locked door resulting in playing of sound file). Sorry for the annoying questions


RE: Question about script for sound and forced look - Vradcly - 02-19-2011

if it is a leveldoor you can attach a locked sound in properties of the door, but i guess its a swingdoor so ill have to return when i have more to say...