Frictional Games Forum (read-only)

Full Version: Scripting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I'm very new with the Amnesia custom story level editor and since I watched a lot of videos on scripting, I decided I'd give it a try with a simple function.

All I want to do is have the character walk through an area and then music starts, but no matter what I tried nothing happened. I'm not sure if I did something wrong in the script or whether my sound or text files are in the wrong place. Please help!

Here's the script:

void OnStart()
{
AddEntityCollideCallback("Player", "SoundArea", "crossarea", true, 1);
}

void crossarea(string &in asParent, string &in asChild, int alState)
{
PlayMusic("The_Patronus_Light.ogg", true, 0.0, 0, 1, false);
}
Code:
PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
PHP Code:
PlayMusic("The_Patronus_Light.ogg"true0.001false); 
Yeah, your PlayMusic volume is set to 0. That's why you cant hear it.

Use this instead;
PHP Code:
PlayMusic("The_Patronus_Light.ogg"true1.001false); 

Edit: Please use the Development Support forum in future when dealing with Custom Story scripts Smile http://www.frictionalgames.com/forum/forum-39.html
A moderator will move this thread eventually.
(03-12-2014, 06:29 AM)Romulator Wrote: [ -> ]
Code:
PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
PHP Code:
PlayMusic("The_Patronus_Light.ogg"true0.001false); 
Yeah, your PlayMusic volume is set to 0. That's why you cant hear it.

Use this instead;
PHP Code:
PlayMusic("The_Patronus_Light.ogg"true1.001false); 

Edit: Please use the Development Support forum in future when dealing with Custom Story scripts Smile http://www.frictionalgames.com/forum/forum-39.html
A moderator will move this thread eventually.

Before the thread is moved, I reset the volume to 1.0. Nothing. Then to 5.0. Nothing. 20.0... still nothing.

I literally have no clue what's going on here. All the names are matching and the files are all correct.
1.0 is the maximum for volume, just letting you know.

Are you sure that your ScriptArea or what you're passing in the Level Editor is in fact called SoundArea? Or is your sound file included somewhere which is also known to the resources.cfg file (located in the redist, or steam folder, depending on version)?
(03-12-2014, 07:27 AM)Romulator Wrote: [ -> ]1.0 is the maximum for volume, just letting you know.

Are you sure that your ScriptArea or what you're passing in the Level Editor is in fact called SoundArea? Or is your sound file included somewhere which is also known to the resources.cfg file (located in the redist, or steam folder, depending on version)?

I was able to properly export the .hps file into the maps folder and it has the exact name as my map. Now when I open the custom story in Amnesia, it crashes at the loading screen. I renamed the text file so it would be different from the .map file and it didn't crash, so the problem is definitely in the scripting.

The name of the area is called SoundArea for sure. I tried moving the music file a bunch of places (like the music folder in Amnesia, a custom Sound folder I put in the custom story/My Custom Story folder and just by itself) and none of it worked.
Could you recreate the issue (the crash) and then post the hpl.log file, located in C:\Users\Lachlan\Documents\Amnesia\Main\

Could you also post your whole .hps file, if there is more than just the above?
(03-12-2014, 07:54 AM)physcostealth Wrote: [ -> ]
(03-12-2014, 07:27 AM)Romulator Wrote: [ -> ]1.0 is the maximum for volume, just letting you know.

Are you sure that your ScriptArea or what you're passing in the Level Editor is in fact called SoundArea? Or is your sound file included somewhere which is also known to the resources.cfg file (located in the redist, or steam folder, depending on version)?

I was able to properly export the .hps file into the maps folder and it has the exact name as my map. Now when I open the custom story in Amnesia, it crashes at the loading screen. I renamed the text file so it would be different from the .map file and it didn't crash, so the problem is definitely in the scripting.

The name of the area is called SoundArea for sure. I tried moving the music file a bunch of places (like the music folder in Amnesia, a custom Sound folder I put in the custom story/My Custom Story folder and just by itself) and none of it worked.

OKAY I'M NOT EVEN SURE HOW I DID THIS BUT I GOT IT TO WORK

I think I deleted a cached filed of the map I was using and that got it to work. Thanks for your guys' help!
Ahh yes, the .map_cache file Tongue Glad you got it fixed Smile