Just Scripting - 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: Just Scripting (/thread-28408.html) |
Just Scripting - ThePhrygian - 12-25-2014 How do I trigger a sound to play when I collect an item? RE: Just Scripting - PutraenusAlivius - 12-25-2014 Okay... But I am a bit confused. Where do you want the sound to be played? At an object or at the player? Screw it, I'll give you both. SOUND PLAYS AT PLAYER Spoiler below!
SOUND PLAYS AT AN OBJECT Spoiler below!
RE: Just Scripting - ThePhrygian - 12-25-2014 So there's no code for collecting the item or adding it to your inventory? RE: Just Scripting - Mudbill - 12-25-2014 You trigger the sound with the SetEntityCallbackFunc. If the entity can be picked up, the type of this callback will be PickUp. It then runs the PlaySound function which runs the PlaySoundAtEntity function. Basically, the sound plays when you pick up the desired item. If you wish to play the sound at the player itself, I prefer using PlayGuiSound. Look it up at the engine scripts page. https://wiki.frictionalgames.com/doku.php?id=hpl2/amnesia/script_functions Edit: Also, what are you trying to pick up? If it's an item, you can just click it. If it's a custom one, you'll need to do more work. There is a script called GiveItem that can give you an inventory item. RE: Just Scripting - Traggey - 12-25-2014 This thread belongs in development support, moved! |