Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about script for sound and forced look
Author Message
Ge15t Offline
Junior Member

Posts: 48
Joined: Feb 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
jens Offline
Frictional Games

Posts: 3,107
Joined: Apr 2006
Reputation: 103
Post: #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
Visit this user's website Find all posts by this user Quote this message in a reply
Vradcly Offline
Member

Posts: 100
Joined: Jan 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Ge15t Offline
Junior Member

Posts: 48
Joined: Feb 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Selyp Offline
Member

Posts: 210
Joined: Feb 2011
Reputation: 7
Post: #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 all posts by this user Quote this message in a reply
Ge15t Offline
Junior Member

Posts: 48
Joined: Feb 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Vradcly Offline
Member

Posts: 100
Joined: Jan 2011
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)