playing music while reading note? - 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: playing music while reading note? (/thread-20864.html) |
playing music while reading note? - User01 - 02-27-2013 Hello How to play music when player opens a note? Just like here! If the video doenst jump to the position, go to 01:18 RE: playing music while reading note? - The chaser - 02-27-2013 Make a callback for the note (in the entity tab, there should be something like CallbackFunc in it). There, put the callback type (preferabily OnPickup) and then add this somewhere in your .hps, but NOT in void OnStart(), OnEnter and OnLeave. void OnPickup (string &in asEntity, string &in asType) { //Your music } RE: playing music while reading note? - User01 - 02-27-2013 void OnPickup (string &in asEntity, string &in asType) { //song.ogg } what do I need to typpe for callback? RE: playing music while reading note? - NaxEla - 02-28-2013 You can name the callback anything you want. For example, if you name the callback function StartMusic, and you want to play 01_amb_darkness.ogg, you would add this in your script: PHP Code: void StartMusic(string &in asEntity, string &in asType) RE: playing music while reading note? - User01 - 02-28-2013 So i wrote in the note in PlayerInteractCallback "NoteMusic1" void NoteMusic1(string &in asEntity, string &in asType) { PlayMusic("01_amb_darkness.ogg", true, 1, 0, 1, false); } No music is playing, when opening note. RE: playing music while reading note? - NaxEla - 02-28-2013 Change the line Code: void NoteMusic1(string &in asEntity, string &in asType) Code: void NoteMusic1(string &in asEntity) You can write NoteMusic1 in either the PlayerInteractCallback, or the CallbackFunc. Depending on which callback you use, the arguments (such as string &in asEntity and string &in asType) change. The reason it didn't work is because we were saying to put it in the CallbackFunc, which is why we told you to write string &in asEntity, string &in asType. Using PlayerInteractCallback will work the same (it's probably the better choice to use for this situation) as long as you change that one line. Edit: Forgot to add this: The difference between CallbackFunc and PlayerInteractCallback, is that the function written for the CallbackFunc is used for several events (such as the player picking it up, it breaking, igniting). If you want to use this instead of PlayerInteractCallback, you would need your script to look like this: PHP Code: void StartMusic(string &in asEntity, string &in asType) The function written for PlayerInteractCallback will only be used when the player picks the item up. RE: playing music while reading note? - User01 - 02-28-2013 thank you works now But is it possible to make so that the music will stop after reading? If yes, how? RE: playing music while reading note? - OriginalUsername - 02-28-2013 StopMusic should do it |