I've been away from Custom Story'ing a while and just got back to it. I would like music to play in my map when i enter an area. Music that's in the "music" folder in amnesia. I've tried scripting it several times but it's not working. I've allso looked around for a solution but without success. If any of you would please take a look at my script and see were the music code should be put it would be very appreciated! Scripting is hard for the lesser talented...
So this is my script:
void OnStart()
{
AddEntityCollideCallback("Player", "Rabarber", "PlaySound", true, 1);
AddEntityCollideCallback("Player", "Stopp", "PlaySound", true, 1);
AddEntityCollideCallback("Player", "Ljud", "start", true, 1);
AddUseItemCallback("", "Key", "Door", "UseKeyOnDoor", true);
AddUseItemCallback("", "Nyckel", "Rumpa", "UseKeyOnDoor", true);
AddUseItemCallback("", "Tillskåp", "Skåp", "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", 0.0f, false);
}
void PlaySound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "21_intro_scream.snt", "Player", 1, false);
}
All i know is that "void PlaySoundAtEntity(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound);" is to be placed in there in order to work, but i can't figure it out.
![Sad Sad](https://www.frictionalgames.com/forum/images/smilies/sad.gif)
Anyone care to give some pointers?