(02-01-2015, 10:39 PM)Neelke Wrote: [ -> ]Maybe you need to add another collide function? (Another area to collide with). Or just put the music script in one of the functions.
Code:
void start(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "general_piano01.snt", "Player", 1, false);
PlayMusic("02_amb_safe.ogg", true, 1.0f, 0, 0, true);
}
Or a new function:
Code:
void OnStart()
{
AddEntityCollideCallback("Player", "AreaStartMusic", "CollideStartMusic", true, 1);
}
void CollideStartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("02_amb_safe.ogg", true, 1.0f, 0, 0, true);
}
I honestly have no idea how to apply that to the existing script. Where would i put it? Thanks
Ok i will fix that, thank you.
Ok, got it working. Thanks guys!
Code:
void OnStart()
{
AddEntityCollideCallback("Player", "Musik", "CollideStartMusic", true, 1);
AddEntityCollideCallback("Player", "Flaska", "PlaySound", true, 1);
AddEntityCollideCallback("Player", "Ljud", "start", true, 1);
AddUseItemCallback("", "Key", "Door", "UseKeyOnDoor", true);
AddUseItemCallback("", "Nyckel", "Rumpa", "UseKeyOnDoor", true);
AddUseItemCallback("", "Tillskap", "Skap", "UseKeyOnDoor", true);
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "Unlock_door.snt", asEntity, 10, false);
RemoveItem(asItem);
}
void start(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "general_piano01.snt", "Player", 1, false);
}
void PlaySound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "21_intro_scream.snt", "Player", 1, false);
}
void CollideStartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("02_amb_safe.ogg", false, 1.0f, 0, 0, true);
}