Frictional Games Forum (read-only)

Full Version: callback and scripting issues! :(
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i am a beginner at scripting and i have a few questions...i am using the call back script to change my music in a game but the music wont change...and its not saying theres anything wrong with the script...wjat do i do???HELP PLEASE!

.....
Post the script you used for the callback. Smile
oid OnStart()
{
PlayMusic("10_amb", true, 4.3, 7, 2, true);


AddUseItemCallback("", "Key_01", "Door_01", "DoorUnlock", true);


AddEntityCollideCallback("Player", "Script", "Music", true, 1);
}

void DoorUnlock(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "Unlock_Door.snt", asEntity, 0, false);
RemoveItem(asItem);
}

void Music(string &in asParent, string &in asChild, int alState)
{
PlayMusic("dan_Brute", true, 3.2, 8, 1, true);
}




void OnEnter()
{

}







void OnLeave()
{

}

void OnStart()
{
PlayMusic("10_amb", true, 4.3, 7, 2, true);


AddUseItemCallback("", "Key_01", "Door_01", "DoorUnlock", true);


AddEntityCollideCallback("Player", "Script", "Music", true, 1);
}

void DoorUnlock(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "Unlock_Door.snt", asEntity, 0, false);
RemoveItem(asItem);
}

void Music(string &in asParent, string &in asChild, int alState)
{
PlayMusic("dan_Brute", true, 3.2, 8, 1, true);
}




void OnEnter()
{

}







void OnLeave()
{

}




-------------------------------------
srry i messed up i forgot to highlight the "V" on void on start.
Your regular musics priority is higher than the brute music.

PlayMusic("10_amb", true, 4.3, 7, "2", true); - That is higher than the brutes music. (the one surrounded with "")
PlayMusic("dan_Brute", true, 3.2, 8, "1", true);

So change them to this below:

PlayMusic("10_amb", true, 4.3, 7, 0, true);
PlayMusic("dan_Brute", true, 3.2, 8, 10, true);
It might be important to name the dan_brute track correctly with case as well. The original sound file is named dan_brute with a lower B.