Frictional Games Forum (read-only)
[SPOILER] Error While adding music to area Please HELP - 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)
+--- Thread: [SPOILER] Error While adding music to area Please HELP (/thread-14870.html)



Error While adding music to area Please HELP - meneadeszz - 04-17-2012

Helllow

I'm Starting to make a Custom Story and I already got a couple of scripts in my HPS file.
But i realy want to add some music to a certain area.
I watched a couple of tutorials and every one was the same so i copied everything what the scripter of the video did.
I got everything the same as him.But when i start my custom story i get this error

I update the script a little here it is..

void OnStart()

{

GiveItemFromFile("lantern", "lantern.ent");
for(int i=0;i< 10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");

PlaySoundAtEntity("", "break_glass_bottle.snt", "Player", 0, false);
SetPlayerActive(false);
SetPlayerCrouching(true);
FadeOut(0);
FadeIn(3);
AddTimer("T1", 3, "Intro");
AddTimer("T2", 6, "Intro");
AddTimer("T3", 8, "Intro");
AddTimer("T4", 10, "Intro");
AddTimer("T5", 12, "Intro");
AddEntityCollideCallback("player", "musci_1", "StartMusic", "true", 1);
AddEntityCollideCallback("Player", "FlyingJesus_1", "HolyJesus", true, 1);
AddEntityCollideCallback("Jesus_1", "FlyingJesus_1", "Sound", true, 1);
AddUseItemCallback("", "crowbar_1", "mansion_1", "UsedCrowbarOnDoor", true);
AddCombineCallback("Player", "Music1", "StartMusic", "true", "0)";

}
void StartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic(01_paper_self, "true", "5", "0", "0", "true");
}
void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)


BUT NOW I GET THIS ERROR


[Image: error2yl.th.jpg]



RE: Error While adding music to area Please HELP - Greven - 04-17-2012

Try putting 01_paper_self in quotation marks like this:
PlayMusic("01_paper_self", true, 5, 0, 0, true);
Also at AddCombineCallback("Player", "Music1", "StartMusic", "true", "0)";
Remove the marks at the 0 like this:
AddCombineCallback("Player", "Music1", "StartMusic", "true", 0);


RE: Error While adding music to area Please HELP - meneadeszz - 04-17-2012

(04-17-2012, 04:12 PM)Greven Wrote: Try putting 01_paper_self in quotation marks like this:
PlayMusic("01_paper_self", true, 5, 0, 0, true);
Also at AddCombineCallback("Player", "Music1", "StartMusic", "true", "0)";
Remove the marks at the 0 like this:
AddCombineCallback("Player", "Music1", "StartMusic", "true", 0);
Thanks for helping me i think it work because i don't get the error about the lines.

Butt there is one problem now
I get an error which says unexpected end of line this is the ending of my script at line 126

void Intro(string &in asTimer)
{
string x = asTimer;
if (x == "T1")
{
PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);
FadeOut(4);
}
else if (x == "T2")
{
FadeIn(3);
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
StartPlayerLookAt("Intro1", 2, 2, "");
}
else if (x == "T3")
{
StopPlayerLookAt();
StartPlayerLookAt("Intro2, 2, 2, "");
}
else if (x == "T4")
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

StopPlayerLookAt();
}
else if (x == "T5")
{
SetPlayerCrouching(false);
SetPlayerActive(true);
StopPlayerLookAt();
}


}

////////////////////////////
// This runs when the player enters the map
void OnEnter()
{
}

////////////////////////////
// This runs when the player leaves the map
void OnLeave()
{
} THIS IS LINE 119 I GET THE ERRO FOR LINE 126



RE: Error While adding music to area Please HELP - Greven - 04-17-2012

Just because it says the error is on line 119 doesnt mean the Actual error is there. Basicly what it says right now is that a function is not properly closed. Can you give the whole script so I can see if anything is missing?



RE: Error While adding music to area Please HELP - meneadeszz - 04-17-2012

.posted a new reply below



RE: Error While adding music to area Please HELP - Greven - 04-17-2012

else if (x == "T3")

{

StopPlayerLookAt();

StartPlayerLookAt("Intro2, 2, 2, "");

}

StartPlayerLookAt("Intro2", 2, 2, "");

also remove this from the script

void HolyJesus(string &in asParent, string &in asChild, int alState)

{

SetEntityActive("Jesus_1", true);

AddPropForce("Jesus_1", 0, 0, -30000, "World");

}



void Sound(string &in asParent, string &in asChild, int alState)




{

PlaySoundAtEntity("", "24_iron_maiden.snt", "FlyingJesus_1", 0, false);


Everybody hates them....



RE: Error While adding music to area Please HELP - meneadeszz - 04-17-2012

(04-17-2012, 07:47 PM)Greven Wrote: else if (x == "T3")

{

StopPlayerLookAt();

StartPlayerLookAt("Intro2, 2, 2, "");

}

StartPlayerLookAt("Intro2", 2, 2, "");

also remove this from the script

void HolyJesus(string &in asParent, string &in asChild, int alState)

{

SetEntityActive("Jesus_1", true);

AddPropForce("Jesus_1", 0, 0, -30000, "World");

}



void Sound(string &in asParent, string &in asChild, int alState)




{

PlaySoundAtEntity("", "24_iron_maiden.snt", "FlyingJesus_1", 0, false);


Everybody hates them....
i alread deleted it but i don't know if people also hate this but.
i want a cabinet wheich contains oil and after u pick up example oil_1 the just spawn a pedobear or something random
One more question..
I would like to add music or a sound to a note when the player picks it up

this is what i sue right now,

SetEntityPlayerLookAtCallback("Letter_One", "letter1music", true);

}
void Letter_One(string &in Entity )
{
PlaySoundAtEntity("letter1music", "05_event_door_bang.ogg", "letter1music", 0, false);
}


i'ts not working could somebody help me