Frictional Games Forum (read-only)
[SCRIPT] How do I import my own music? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] How do I import my own music? (/thread-14109.html)



How do I import my own music? - Mojake - 03-19-2012

I am trying to make music play when I enter an area, however it doesn't play at all and I have no idea why. Here's my .hps file:


////////////////////////////
// Run first time starting map

void OnStart()

{
FadeOut(0);
FadeIn(20);
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(100, 4);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220);
FadeRadialBlurTo(0.15, 2);
SetPlayerCrouching(true);
AddTimer("trig1", 9.0f, "beginStory");

AddUseItemCallback("", "Crowbar", "mansion_1", "Break", true);
AddUseItemCallback("", "HallwayKey", "mansion_2", "OpenHallwayDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "mansion_1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "StartMusic_1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_3", "StatueAppear", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_4", "StatueShock", true, -1);
AddEntityCollideCallback("Player", "ScriptArea_5", "Falling", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_6", "ChefSpawn", true, 1);
AddEntityCollideCallback("TheChef", "ScriptArea_7", "ChefLoop", false, 1);
AddEntityCollideCallback("Player", "ScriptArea_8", "StartMusic_2", true, 1);
}


void beginStory(string &in asTimer)
{
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 20, 20);
FadeRadialBlurTo(0.01, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
PlayMusic("react_sigh3.ogg", false, 1.0, 2, 0, true);
}

////////Chef////////

void ChefSpawn(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("TheChef", true);
AddEnemyPatrolNode("TheChef", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("TheChef", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("TheChef", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("TheChef", "PathNodeArea_4", 2, "");
PlaySoundAtEntity("", "react_scare4.ogg", "Player", 0, false);
GiveSanityDamage(30.0f, true);
SetPlayerActive(false);
StartPlayerLookAt("map_05_winecellar_1", 2.0f, 5.0f, "");
AddTimer("timer01", 4.0f, "StopLookChef");
}

void StopLookChef(string &in asTimer)
{
StopPlayerLookAt();
SetPlayerActive(true);
}

////////ShelfDrop////////

void Falling(string &in asParent, string &in asChild, int alState)
{
AddPropForce("pot_plant_small01_1", -1000.0f, 0.0f, 0.0f, "world");
}

////////Openmansion_1////////

void Break(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("Crowbar");
}

////////Openmansion_2////////

void OpenHallwayDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_2", 0, false);
RemoveItem("HallwayKey");
}

////////DoorSlam////////

void mansion_1(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(10.0f, true);
SetPlayerActive(false);
StartPlayerLookAt("mansion_1", 3.0f, 5.0f, "");
AddTimer("timer01", 1.5f, "StopLook");
}

void StopLook(string &in asTimer)
{
StopPlayerLookAt();
SetPlayerActive(true);
}

////////Music////////

void StartMusic_1(string &in asParent, string &in asChild, int alState)
{
PlayMusic("ambience_swoop_myst.ogg", true, 0.2, 2, 1, true);
}


void StartMusic_2(string &in asParent, string &in asChild, int alState)
{
PlayMusic("Requiem.ogg", false, 1.0f, 3.0f, 0, true);
}

////////StatueAppear////////

void StatueAppear(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("deformedman", true);
}

void StatueShock(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
StartPlayerLookAt("deformedman", 3.0f, 5.0f, "");
AddTimer("timer01", 1.5f, "StopLookStatue");
GiveSanityDamage(20.0f, true);
PlaySoundAtEntity("", "scare_male_terrified3.ogg", "Player", 0, false);
PlaySoundAtEntity("", "react_breath_slow1.ogg", "Player", 0, false);
}

void StopLookStatue(string &in asTimer)
{
StopPlayerLookAt();
SetPlayerActive(true);
}

I can't see a problem with it? Undecided


RE: How do I import my own music? - Prelauncher - 03-19-2012

Have you created a .snt file that you´ve connected to your music?


RE: How do I import my own music? - Mojake - 03-19-2012

(03-19-2012, 07:33 PM)Prelauncher Wrote: Have you created a .snt file that you´ve connected to your music?
I tried, I don't know if it's in the right folder or the right content:


<SOUNDENTITY>
<SOUNDS>
<Main>
<Sound File="Requiem.ogg" />
</Main>
</SOUNDS>
<PROPERTIES Volume="1" MinDistance="12" MaxDistance="50" Random="1" Interval="0" FadeEnd="False" FadeStart="False" Stream="False" Loop="False" Use3D="True" Blockable="False" BlockVolumeMul="0.7" Priority="0" />
</SOUNDENTITY>

It's in the same folder as the .ogg


RE: How do I import my own music? - Xanthos - 03-20-2012

(03-19-2012, 07:41 PM)Mojake Wrote:
(03-19-2012, 07:33 PM)Prelauncher Wrote: Have you created a .snt file that you´ve connected to your music?
I tried, I don't know if it's in the right folder or the right content:









</properties>

It's in the same folder as the .ogg



If you convert it to a .snt then why not use

PlayGuiSound
Instead of
PlayMusic
?


RE: How do I import my own music? - Your Computer - 03-20-2012

There's no need to create a .snt file for music. Check the hpl.log file for insight on the issue of the OGG file.