Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved StrartMusic Work But not Stop
Author Message
jessehmusic Offline
Senior Member

Posts: 423
Joined: Dec 2011
Reputation: 8
Post: #1
StrartMusic Work But not Stop
Hello all amnesia fans!
I got a problem with script and Lvl
I can't get stopmusic to work when you get back to the hallway Sad
Here is my hps:

(Cellarbase)


oid OnStart()
{
AddUseItemCallback("", "The Lost Key", "Lockeddoor_1", "KeyOnDoor", true);
AddUseItemCallback("", "Key", "ptest_cellar_wood01_4", "KeyOnDoor1", true);
AddEntityCollideCallback("Player", "MusicStart", "Music", true, 1);
AddEntityCollideCallback("Player", "DoorSlam", "DoorSlam", true, 1);
SetEntityPlayerInteractCallback("Note_Test1", "Sound", true);
}
void Sound(string &in asEntity)
{
PlaySoundAtEntity("", "15_prisoner_scream.snt", "Player", 0.0f, false);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Lockeddoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "Lockeddoor_1", 0, false);
RemoveItem("The Lost Key");
}
void KeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("ptest_cellar_wood01_4", false, true);
PlaySoundAtEntity("", "unlock_door", "ptest_cellar_wood01_4", 0, false);
RemoveItem("Key");
}

void DoorSlam(string &in asParent, string &in asChild, int alState)
{
CreateParticleSystemAtEntity("", "ps_break_wood_small.ps", "ps_hit", true);
PlaySoundAtEntity("", "break_wood.snt", "Player", 0.0f, false);
}
void Music(string &in asParent, string &in asChild, int alState)
{
PlayMusic("01_amb_darkness.ogg", true, 0.8f, 1, 0, true);
}

void OnEnter()

{

}

void OnLeave()

{

}



Hallway


void OnStart()
{
AddEntityCollideCallback("Player", "MusicStop", "StopMusic", true, 1);
}


void StopMusic(string &in asParent, string &in asChild, int alState)
{
StopMusic(1 , 1);
}


when i enter the StopMusic Area it dosnt work ;(

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
(This post was last modified: 02-28-2012 12:27 AM by jessehmusic.)
02-27-2012 06:59 PM
Visit this user's website Find all posts by this user Quote this message in a reply
SilentStriker Offline
Posting Freak

Posts: 939
Joined: Jul 2011
Reputation: 39
Post: #2
RE: StrartMusic Work But not Stop
If you start the music on one map then you need to have StopMusic OnLeave on the map you started the music

And the music is on Prio 0 then you need to have Prio 0 on StopMusic too

(This post was last modified: 02-27-2012 07:09 PM by SilentStriker.)
02-27-2012 07:07 PM
Find all posts by this user Quote this message in a reply
jessehmusic Offline
Senior Member

Posts: 423
Joined: Dec 2011
Reputation: 8
Post: #3
RE: StrartMusic Work But not Stop
(02-27-2012 07:07 PM)SilentStriker Wrote:  If you start the music on one map then you need to have StopMusic OnLeave on the map you started the music

And the music is on Prio 0 then you need to have Prio 0 on StopMusic too
So like this


void OnStart()
{
AddEntityCollideCallback("Player", "MusicStop", "StopMusic", true, 1);
}


void StopMusic(string &in asParent, string &in asChild, int alState)
{
StopMusic(1 , 0);
}

void OnLeave()
{
}

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
02-27-2012 07:14 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Obliviator27 Offline
Posting Freak

Posts: 801
Joined: Jul 2011
Reputation: 65
Post: #4
RE: StrartMusic Work But not Stop
Yes. Your issue is you were attempting to stop music with a priority of 1, when the music you wanted to stop had a priority of 0.

02-27-2012 07:22 PM
Find all posts by this user Quote this message in a reply
jessehmusic Offline
Senior Member

Posts: 423
Joined: Dec 2011
Reputation: 8
Post: #5
RE: StrartMusic Work But not Stop
(02-27-2012 07:22 PM)Obliviator27 Wrote:  Yes. Your issue is you were attempting to stop music with a priority of 1, when the music you wanted to stop had a priority of 0.
I don't even know what
"
priority" is Sad


(02-27-2012 07:22 PM)Obliviator27 Wrote:  Yes. Your issue is you were attempting to stop music with a priority of 1, when the music you wanted to stop had a priority of 0.
And it still dosnt work :'(

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
(This post was last modified: 02-27-2012 07:36 PM by jessehmusic.)
02-27-2012 07:33 PM
Visit this user's website Find all posts by this user Quote this message in a reply
SilentStriker Offline
Posting Freak

Posts: 939
Joined: Jul 2011
Reputation: 39
Post: #6
RE: StrartMusic Work But not Stop
in the code where it says alPrio is the priority. Put that as 0 on both stopmusic and Playmusic

And try StopMusic inside OnLeave

02-27-2012 07:45 PM
Find all posts by this user Quote this message in a reply
jessehmusic Offline
Senior Member

Posts: 423
Joined: Dec 2011
Reputation: 8
Post: #7
RE: StrartMusic Work But not Stop
(02-27-2012 07:45 PM)SilentStriker Wrote:  in the code where it says alPrio is the priority. Put that as 0 on both stopmusic and Playmusic

And try StopMusic inside OnLeave
I did for 5 mins ago still dosnt work Confused

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
02-27-2012 07:55 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Obliviator27 Offline
Posting Freak

Posts: 801
Joined: Jul 2011
Reputation: 65
Post: #8
RE: StrartMusic Work But not Stop
Assuming you've set up developer mode, use debug messages to make sure that your collide works. If not, add something like PlaySoundAtEntity to make sure that the function to call StopMusic is actually being called.

02-27-2012 08:02 PM
Find all posts by this user Quote this message in a reply
jessehmusic Offline
Senior Member

Posts: 423
Joined: Dec 2011
Reputation: 8
Post: #9
RE: StrartMusic Work But not Stop
Anyone that can give me the full script for the StopMusic

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
02-28-2012 12:04 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Mackiiboy Offline
Member

Posts: 101
Joined: Jan 2012
Reputation: 11
Post: #10
RE: StrartMusic Work But not Stop
void PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);

Plays music.

asMusicFile - the music to play + extension .ogg
abLoop - determines whether a music track should loop
afVolume - volume of the music
afFadeTime - time in seconds until music reaches full volume
alPrio - priority of the music. Note that only the music with the highest priority can be heard! 0 - lowest, >0 - higher

void StopMusic(float afFadeTime, int alPrio);

Stops music.

afFadeTime - time in seconds until music stops
alPrio - the priority of the music that should stop

So, all the pink stuff needs to be the same if you want to stop the music. I would either put StopMusic in OnLeave() in the current map, or in OnEnter() in the next map.

PlayMusic("Music_file_name.ogg", true, 1.0f, 0, 0, true);
StopMusic(0, 0);
02-28-2012 06:44 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)