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


Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help - Play Music when I touch an object
iLucian Offline
Junior Member

Posts: 22
Threads: 8
Joined: Jun 2013
Reputation: 0
#11
RE: Help - Play Music when I touch an object

(07-11-2013, 07:32 PM)The chaser Wrote: Then you are using the wrong code. The violin isn't an item, is an entity. To make that work, simply put this anywhere in your script, but not in void OnStart(). Put this:

void Touch(string &in asEntity)
{
PlayMusic("music.ogg", false, 1, 1, 1, false);
}



Now, select the violin and go to the entity panel. Go down, where it says "PlayerInteractCallback" and put "Touch". Now it should work.

that worked, but the song is only 7 seconds long, and i want the music that was originally playing to start playing again, cuz the song that plays when i touch the violin loops and i dont want it to, even though i put false.

(07-11-2013, 07:32 PM)The chaser Wrote: Then you are using the wrong code. The violin isn't an item, is an entity. To make that work, simply put this anywhere in your script, but not in void OnStart(). Put this:

void Touch(string &in asEntity)
{
PlayMusic("music.ogg", false, 1, 1, 1, false);
}



Now, select the violin and go to the entity panel. Go down, where it says "PlayerInteractCallback" and put "Touch". Now it should work.

that worked, but the song is only 7 seconds long, and i want the music that was originally playing to start playing again, cuz the song that plays when i touch the violin loops and i dont want it to, even though i put false.

Wherever there is Light, Darkness has already gotten there first.
(This post was last modified: 07-11-2013, 09:20 PM by iLucian.)
07-11-2013, 09:17 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#12
RE: Help - Play Music when I touch an object

Use this one instead:



void Touch(string &in asEntity)

{

PlayMusic("music.ogg", true, 1, 0.1, 1, false);

}

That'll make the song loop Wink

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
07-11-2013, 10:55 PM
Find
iLucian Offline
Junior Member

Posts: 22
Threads: 8
Joined: Jun 2013
Reputation: 0
#13
RE: Help - Play Music when I touch an object

(07-11-2013, 10:55 PM)The chaser Wrote: Use this one instead:



void Touch(string &in asEntity)

{

PlayMusic("music.ogg", true, 1, 0.1, 1, false);

}

That'll make the song loop Wink

No, i don't want it to loop, when you touch the violin i want the song to play once and then i want the music that was playing before you touched it to begin playing again. My problem is that the music when you touch the violin is looping even though i put false on the loop.

Wherever there is Light, Darkness has already gotten there first.
(This post was last modified: 07-12-2013, 02:47 AM by iLucian.)
07-12-2013, 02:44 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#14
RE: Help - Play Music when I touch an object

Oh, I see. Then, do this:

void Touch(string &in asEntity)



{

PlayMusic("music.ogg", false, 1, 0.1, 1, false);

AddTimer("", 7, "Replay");

}

void Replay (string &in asTimer)
{
PlayMusic("yourlevelmusic.ogg", true, 1, 1, 1, true);
}

That will make the music play, and, in 7 seconds, it will resume your level song. I think this should fix you error now Wink

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
07-12-2013, 12:45 PM
Find
iLucian Offline
Junior Member

Posts: 22
Threads: 8
Joined: Jun 2013
Reputation: 0
#15
RE: Help - Play Music when I touch an object

(07-12-2013, 12:45 PM)The chaser Wrote: Oh, I see. Then, do this:

void Touch(string &in asEntity)



{

PlayMusic("music.ogg", false, 1, 0.1, 1, false);

AddTimer("", 7, "Replay");

}

void Replay (string &in asTimer)
{
PlayMusic("yourlevelmusic.ogg", true, 1, 1, 1, true);
}

That will make the music play, and, in 7 seconds, it will resume your level song. I think this should fix you error now Wink

thanks for your help! Everything works fine now! thank you Big Grin

Wherever there is Light, Darkness has already gotten there first.
07-13-2013, 04:01 PM
Find




Users browsing this thread: 1 Guest(s)