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
Question about script for sound and forced look
Ge15t Offline
Junior Member

Posts: 48
Threads: 8
Joined: Feb 2011
Reputation: 0
#1
Question about script for sound and forced look

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
02-18-2011, 08:59 AM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#2
RE: Question about script for sound and forced look

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.
02-18-2011, 09:24 AM
Website Find
Vradcly Offline
Member

Posts: 100
Threads: 6
Joined: Jan 2011
Reputation: 0
#3
RE: Question about script for sound and forced look

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).
02-18-2011, 09:28 AM
Find
Ge15t Offline
Junior Member

Posts: 48
Threads: 8
Joined: Feb 2011
Reputation: 0
#4
RE: Question about script for sound and forced look

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
02-18-2011, 09:43 AM
Find
Selyp Offline
Member

Posts: 210
Threads: 19
Joined: Feb 2011
Reputation: 7
#5
RE: Question about script for sound and forced look

(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/amn..._functions
02-18-2011, 10:35 AM
Find
Ge15t Offline
Junior Member

Posts: 48
Threads: 8
Joined: Feb 2011
Reputation: 0
#6
RE: Question about script for sound and forced look

(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/amn..._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
02-19-2011, 02:12 AM
Find
Vradcly Offline
Member

Posts: 100
Threads: 6
Joined: Jan 2011
Reputation: 0
#7
RE: Question about script for sound and forced look

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...

02-19-2011, 02:42 PM
Find




Users browsing this thread: 1 Guest(s)