Sounds and messages - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: Sounds and messages (/thread-19370.html) |
Sounds and messages - giacomo9 - 11-27-2012 I've got a script: void Scared_9(string &in asParent, string &in asChild, int alState) { SetEntityActive("DeadFour_9", true); SetEntityActive("DeadFour_10", true); GiveSanityDamage(99, true); PlaySoundAtEntity("", "24_iron_maiden.snt", "Scary_9", 0, false); } After activation this script, I would like to: 1) The player saw the message on the screen (for example, "RUN!") 2) Two seconds after activation of the script there was a sound (different than in script above) How to do it? I'm sorry if somewhere there is a spelling mistake, charms of use google translator xD RE: Sounds and messages - GoranGaming - 11-27-2012 Jumpscares... I'll help you anyway: void Scared_9(string &in asParent, string &in asChild, int alState) { SetEntityActive("DeadFour_9", true); SetEntityActive("DeadFour_10", true); GiveSanityDamage(99, true); PlaySoundAtEntity("", "24_iron_maiden.snt", "Scary_9", 0, false); AddTimer("", 0, "Scared_9Timer"); AddTimer("", 2, "Scared_9SoundAfter"); } void Scared_9Timer(string &in asTimer) { SetMessage("Category", "Entry", 5); } void Scared_9SoundAfter(string &in asTimer) { PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound); Creates a sound on an entity. asSoundName - internal name asSoundFile - the sound to use + extension .snt asEntity - the entity to create the sound at, can be “Player” afFadeTime - time in seconds the sound needs to fade. Avoids enemies hearing the sound if afFadeTime is at least 0.1f abSaveSound - if true, a looping sound will “remember” its playback state (currently playing/stopped), and that state will be restored the next time the level is entered. If true, the sound is never attached to the entity! Note that saving should only be used on looping sounds! OR PlayGuiSound(string& asSoundFile, float afVolume); Plays a sound, not using 3D. asSoundFile - the sound to play (extension is .snt) afVolume - the volume of the sound } RE: Sounds and messages - giacomo9 - 11-27-2012 What I must put in "Category" and "Entry"? RE: Sounds and messages - GoranGaming - 11-27-2012 In your lang file, you should have a category and an entry. <CATEGORY Name="CATEGORY_NAME_IT_WHATEVER_YOU_WANT"> <Entry Name="ENTRY_NAME_IT_WHATEVER_YOU_WANT">RUN!</Entry> </CATEGORY> RE: Sounds and messages - giacomo9 - 11-27-2012 Thank You, it's working I have another question about sounds: I make custom sound file: duration is 1-2 sec, but game still repeats this sound, and I want to play it once. What should I do? This is script ("girl_laugh.snt" is my custom sound): void Scared_9SoundAfter(string &in asTimer) { PlaySoundAtEntity("", "girl_laugh.snt", "Scary_8", 0, false); } RE: Sounds and messages - FlawlessHappiness - 11-27-2012 You have to edit the .snt file. There must be an attribute saying: Loop: true You need to change it to false RE: Sounds and messages - giacomo9 - 11-27-2012 Thanks You for help, now everything is working |