Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
playing music while reading note?
User01 Offline
Member

Posts: 97
Threads: 30
Joined: Feb 2013
Reputation: 0
#1
playing music while reading note?

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
(This post was last modified: 03-23-2013, 02:06 AM by plutomaniac.)
02-27-2013, 02:20 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#2
RE: playing music while reading note?

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
}

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
02-27-2013, 10:02 PM
Find
User01 Offline
Member

Posts: 97
Threads: 30
Joined: Feb 2013
Reputation: 0
#3
RE: playing music while reading note?

void OnPickup (string &in asEntity, string &in asType)
{
//song.ogg
}

what do I need to typpe for callback?
(This post was last modified: 02-27-2013, 11:14 PM by User01.)
02-27-2013, 10:52 PM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#4
RE: playing music while reading note?

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: (Select All)
void StartMusic(string &in asEntitystring &in asType)
{
    
PlayMusic("01_amb_darkness.ogg"true101false);


In Ruins [WIP]
02-28-2013, 12:38 AM
Find
User01 Offline
Member

Posts: 97
Threads: 30
Joined: Feb 2013
Reputation: 0
#5
RE: playing music while reading note?

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.
(This post was last modified: 02-28-2013, 02:28 AM by User01.)
02-28-2013, 02:28 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#6
RE: playing music while reading note?

Change the line
void NoteMusic1(string &in asEntity, string &in asType)
to
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: (Select All)
void StartMusic(string &in asEntitystring &in asType)
{
    if(
asType == "OnPickup") {
        
PlayMusic("01_amb_darkness.ogg"true101false); // will only play music if the player picks up the entity.
    
}


The function written for PlayerInteractCallback will only be used when the player picks the item up.

In Ruins [WIP]
(This post was last modified: 02-28-2013, 02:51 AM by NaxEla.)
02-28-2013, 02:44 AM
Find
User01 Offline
Member

Posts: 97
Threads: 30
Joined: Feb 2013
Reputation: 0
#7
RE: playing music while reading note?

thank you works now Heart
But is it possible to make so that the music will stop after reading? If yes, how?
02-28-2013, 02:47 AM
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#8
RE: playing music while reading note?

StopMusic should do it
02-28-2013, 08:51 AM
Find




Users browsing this thread: 1 Guest(s)