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
Script Help Custom Music.
Shylia Offline
Junior Member

Posts: 14
Threads: 3
Joined: Jan 2015
Reputation: 0
#1
Music  Custom Music.

So I am trying, just a test to see if I can make a custom sound/music work in the game. Now I followed a guide which told me what to do, where to put the files and stuff. But when I'm done scripting I have no idea why it doesn't work.

Could anyone look into it? And give me some tips?

Thanks!

Here is my script.
VVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Spoiler below!
void OnStart()
{
AddEntityCollideCallback("Player", "Ambience", "Ambience1", true, 1);
}

void Ambience1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "CustomTest.snt", "Player", 0.0f, false);
}

I should also mention this one too.

Spoiler below!
<SOUNDENTITY>
<SOUNDS>
<Main>
<Sound File="CustomTest.ogg" />
</Main>
</SOUNDS>
<PROPERTIES Volume="5" MinDistance="1" MaxDistance="50" Random="0" Interval="0" FadeEnd="False" FadeStart="False" Stream="False" Loop="False" Use3D="false" Blockable="False" BlockVolumeMul="0.7" Priority="5" />
</SOUNDENTITY>

ALSO!

If I try to play the OGG file in Windows Mediaplayer I can hear the sound play, but if I try to place the sound in the world in the editor I can't hear it when I try to preview it with the play button, or if I place it in the world and load the map I can't hear the sound play.
(This post was last modified: 01-07-2015, 10:10 AM by Shylia.)
01-07-2015, 10:07 AM
Find
goodcap Offline
Member

Posts: 193
Threads: 112
Joined: Jun 2012
Reputation: 3
#2
RE: Custom Music.

(01-07-2015, 10:07 AM)Shylia Wrote: So I am trying, just a test to see if I can make a custom sound/music work in the game. Now I followed a guide which told me what to do, where to put the files and stuff. But when I'm done scripting I have no idea why it doesn't work.

Could anyone look into it? And give me some tips?

Thanks!

Here is my script.
VVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Spoiler below!
void OnStart()
{
AddEntityCollideCallback("Player", "Ambience", "Ambience1", true, 1);
}

void Ambience1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "CustomTest.snt", "Player", 0.0f, false);
}

I should also mention this one too.

Spoiler below!
<SOUNDENTITY>
<SOUNDS>
<Main>
<Sound File="CustomTest.ogg" />
</Main>
</SOUNDS>
<PROPERTIES Volume="5" MinDistance="1" MaxDistance="50" Random="0" Interval="0" FadeEnd="False" FadeStart="False" Stream="False" Loop="False" Use3D="false" Blockable="False" BlockVolumeMul="0.7" Priority="5" />
</SOUNDENTITY>

ALSO!

If I try to play the OGG file in Windows Mediaplayer I can hear the sound play, but if I try to place the sound in the world in the editor I can't hear it when I try to preview it with the play button, or if I place it in the world and load the map I can't hear the sound play.

Try changing CustomTest.snt to CustomTest.ogg and see if that works. Like this:

PlaySoundAtEntity("", "CustomTest.ogg", "Player", 0.0f, false);
01-07-2015, 10:47 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#3
RE: Custom Music.

I would suggest trying PlayGuiSound to see if it works. That one is simpler and more noticeable.

PHP Code: (Select All)
PlayGuiSound("file.snt"1); 

I believe you can use both SNT and OGG in this script.

Now, make sure you've placed your files correctly. Are they in your custom story directory? If so, I suggest you open the resources.cfg file in the Amnesia root folder and add the "custom_stories" directory to that file if it isn't there already. This will allow the game to search this folder for assets, which might be the reason it's not working.

01-07-2015, 10:52 AM
Find
Shylia Offline
Junior Member

Posts: 14
Threads: 3
Joined: Jan 2015
Reputation: 0
#4
RE: Custom Music.

(01-07-2015, 10:52 AM)Mudbill Wrote: I would suggest trying PlayGuiSound to see if it works. That one is simpler and more noticeable.

PHP Code: (Select All)
PlayGuiSound("file.snt"1); 

I believe you can use both SNT and OGG in this script.

Now, make sure you've placed your files correctly. Are they in your custom story directory? If so, I suggest you open the resources.cfg file in the Amnesia root folder and add the "custom_stories" directory to that file if it isn't there already. This will allow the game to search this folder for assets, which might be the reason it's not working.

How do I go about adding the resources line?
01-07-2015, 11:24 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#5
RE: Custom Music.

Add this line:

<Directory Path="/custom_stories" AddSubDirs="true" />

to the end of your Resources.cfg file in the directory stated in Mudbill's post above.

Just make sure to put it before the </Resources> line. Smile

Discord: Romulator#0001
[Image: 3f6f01a904.png]
01-07-2015, 11:29 AM
Find
Shylia Offline
Junior Member

Posts: 14
Threads: 3
Joined: Jan 2015
Reputation: 0
#6
RE: Custom Music.

(01-07-2015, 11:29 AM)Romulator Wrote: Add this line:

<Directory Path="/custom_stories" AddSubDirs="true" />

to the end of your Resources.cfg file in the directory stated in Mudbill's post above.

Just make sure to put it before the </Resources> line. Smile

Thanks alot, now it works!
01-07-2015, 11:33 AM
Find




Users browsing this thread: 3 Guest(s)