Playsound at SetEntityPlayerlookatCallback? - 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: Playsound at SetEntityPlayerlookatCallback? (/thread-20145.html) Pages:
1
2
|
Playsound at SetEntityPlayerlookatCallback? - Tiger - 02-02-2013 So, There's a part where I want the player to look at a decal and they'll hear a sound and get sanity damage(No, it's not a jumpscare, trust me). I've tried coding this script kinda from scratch, but also used this. I've checked the wiki, youtube and tried googling it but I can't find anything about it. Here's my script right now: Spoiler below!
the "blodsplat_1" is an entity-decal and I've changed it's "playerlookatcallback"-box to "screamtrigger". I've tried solving this for over an hour now and I'm starting to get frustrated I would really appreciate help. RE: Playsound at SetEntityPlayerlookatCallback? - GoranGaming - 02-02-2013 You could create an area at the decal, and if the player looks at the area the event happens. void OnStart() { SetEntityPlayerLookAtCallback("ScriptArea_1", "ScreamTrigger", true); } void ScreamTrigger(string &in asEntity, int alState) { PlaySoundAtEntity("", "21_scream.snt", "stove_1", 0.8f, false); GiveSanityDamage(10, false); } Hej btw RE: Playsound at SetEntityPlayerlookatCallback? - Tiger - 02-02-2013 still doesn't work :/ Spoiler below!
hej på dig också. RE: Playsound at SetEntityPlayerlookatCallback? - GoranGaming - 02-02-2013 ehm... the onstart function is wrong. it should be: void OnStart() { blablabla } and what does the outside thing mean? RE: Playsound at SetEntityPlayerlookatCallback? - Tiger - 02-02-2013 (02-02-2013, 10:51 PM)GoranGaming Wrote: ehm... the onstart function is wrong. it should be: I know, but I have a lot of other stuff in the script that I don't have to show and I guess I just wanted to show that it was in the "OnStart()"'s {} I guess I could just call it "OnStart()" though... What I meant with "(outside)" is that it's not in OnStart(), OnEnter() or OnLeave. I've edited for clarity now though. RE: Playsound at SetEntityPlayerlookatCallback? - GoranGaming - 02-02-2013 Do you get an error? Is the script area named "ScriptArea_1" in the editor? Do you use the debug menu? If so, try to add a DebugMessage: void ScreamTrigger(string &in asEntity, int alState) { PlaySoundAtEntity("", "21_scream5.snt", "stove_1", 0.8f, false); GiveSanityDamage(10, false); AddDebugMessage("This is to see if the function works. Maybe you just can't hear the sound.", false); } RE: Playsound at SetEntityPlayerlookatCallback? - Tiger - 02-02-2013 Everythings working fine and dandy and the debug message shows up, but it doesn't play the sound. Here's my sound file: Code: <SOUNDENTITY> RE: Playsound at SetEntityPlayerlookatCallback? - NaxEla - 02-03-2013 (02-02-2013, 11:53 PM)Tigerwaw Wrote: Everythings working fine and dandy and the debug message shows up, but it doesn't play the sound. Try changing Code: <Sound File="TestStory/sounds/21_scream5.ogg"/> Code: <Sound File="21_scream5.ogg"/> RE: Playsound at SetEntityPlayerlookatCallback? - Tiger - 02-03-2013 (02-03-2013, 12:05 AM)NaxEla Wrote: Try changing I've already tried that. doesn't work :c RE: Playsound at SetEntityPlayerlookatCallback? - NaxEla - 02-03-2013 Are you sure that stove_1 is close enough to the player so he can actually hear it? I'm not really sure why else it wouldn't be working. |