Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting
physcostealth Offline
Junior Member

Posts: 25
Threads: 12
Joined: Mar 2014
Reputation: 0
#1
Scripting

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);
}
03-12-2014, 05:52 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: Scripting

PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
PHP Code: (Select All)
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: (Select All)
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.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 03-12-2014, 06:32 AM by Romulator.)
03-12-2014, 06:29 AM
Find
physcostealth Offline
Junior Member

Posts: 25
Threads: 12
Joined: Mar 2014
Reputation: 0
#3
RE: Scripting

(03-12-2014, 06:29 AM)Romulator Wrote:
PlayMusic(string& asMusicFile, bool abLoop, float afVolume, float afFadeTime, int alPrio, bool abResume);
PHP Code: (Select All)
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: (Select All)
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.
03-12-2014, 06:35 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
RE: Scripting

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)?

Discord: Romulator#0001
[Image: 3f6f01a904.png]
03-12-2014, 07:27 AM
Find
physcostealth Offline
Junior Member

Posts: 25
Threads: 12
Joined: Mar 2014
Reputation: 0
#5
RE: Scripting

(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.
03-12-2014, 07:54 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#6
RE: Scripting

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?

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 03-12-2014, 08:05 AM by Romulator.)
03-12-2014, 08:04 AM
Find
physcostealth Offline
Junior Member

Posts: 25
Threads: 12
Joined: Mar 2014
Reputation: 0
#7
RE: Scripting

(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!
03-12-2014, 08:05 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#8
RE: Scripting

Ahh yes, the .map_cache file Tongue Glad you got it fixed Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
03-12-2014, 08:05 AM
Find




Users browsing this thread: 2 Guest(s)