Frictional Games Forum (read-only)
(SOLVED) StartCredits script confusion. - 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: (SOLVED) StartCredits script confusion. (/thread-29010.html)



(SOLVED) StartCredits script confusion. - G510s - 01-04-2015

StartCredits(string& asMusic, bool abLoopMusic, string& asTextCat, string& asTextEntry, int alEndNum);

is the code im suppose to use to end a story without any fancy functions. but how do i use it. that is the part that is stopping me. can someone tell me exactly what im suppose to do with this code to make it work?


RE: StartCredits script confusion. - Romulator - 01-04-2015

The Wiki Wrote:asMusic - the music to play (including .ogg)
abLoopMusic - determines whether the music should loop
asTextCat - the category to be used in the .lang file
asTextEntry - the entry in the .lang file
alEndNum - Amnesia has 3 different endings and displays a code at the bottom. Determines which code is displayed. 0-2 will display codes, any other integer will not.

asMusic is the music you want to hear during the end credits. It can be anything as long as it is in a .ogg format and is somewhere, but it helps enormously to be inside your custom stories folder.

abLoopMusic is whether you want the music to loop. True = Yes. False = No.

asTextCat is a <Category Name="CATEGORY"> reference to the extra_english.lang file. Since it is a reference, the Category Name (whatever is in quotation marks) should go here.

asTextEntry is a <Entry Name="ENTRY"> reference to the extra_english.lang file. This is the entry or text within the category. This should be where your credits are.

alEndNum, just make it 3.

So code would be:
Spoiler below!
PHP Code:
void OnLeave()     //Click on a Level Door to execute
{
StartCredits("music_file.ogg"true"Category""Entry"3);



And that would work greatly if the extra_english.lang file looked like:
Code:
<LANGUAGE>
<CATEGORY Name="Category">
<Entry Name="Entry">Thanks for playing my demo![br][br]Credits.[br]</Entry>
</CATEGORY>
</LANGUAGE>

You may have to change the above code to suit your extra_english.lang in terms of the Category and Entry.

Edit: Also, I remember seeing your code a while ago. You do not need StartDemoEnd();. That was more for Frictional Games rather than a Custom Story. You can try working with it, but it is not needed.


RE: StartCredits script confusion. - G510s - 01-04-2015

am i suppose to do anything special with the level door?

i leave the map to end the demo and when i click on the level door to leave it gives me an error and leaves the game. could it be cause i don't have a 5th level or something?


RE: StartCredits script confusion. - Romulator - 01-04-2015

Not really. If the StartCredits is in your OnLeave(), it should be okay.

If you end up with an error, just set a map for your Level Door to send the Player to.


RE: StartCredits script confusion. - DnALANGE - 01-04-2015

OR.. Just add a timer..
Fadeout 3 seconds then after 3.5 seconds orso add a timr called
EndCredits for example and execute the script there?
I Always do it like that ..


RE: StartCredits script confusion. - G510s - 01-05-2015

(01-04-2015, 07:06 PM)DnALANGE Wrote: OR.. Just add a timer..
Fadeout 3 seconds then after 3.5 seconds orso add a timr called
EndCredits for example and execute the script there?
I Always do it like that ..


what am i suppose to do with the door cause everytime i enter the level door it gives me an error, of course i have made no hps file for the level door that ends my demo. and i don't have a map made for for the level door cause i tried that once and it just loads me into the the 5th level.

this is very frustrating for me and weid cause i have never made an end nor have i used startcredits or demoend.



void OnStart()
{

AddEntityCollideCallback("Player", "Sutior_1", "AreaCollide", true, 1);

PlayMusic("18_amb", true, 5, 2.0, 4, true);

AddEntityCollideCallback("Player", "Script_1", "ActivateStatue", true, 1);

AddEntityCollideCallback("Player", "PlaySound", "Sound", true, 1);

AddUseItemCallback("", "Storage", "StorageDoor", "UseKey", true);

AddEntityCollideCallback("Player", "ActivateDoor", "DoorAppear", true, 1);

}




void EndDemo(string &in asTimer)
{
FadeOut(3.2);

StartCredits("ending_daniel", true, "Levels", "EndDemoCreits", 3);

}




void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("StorageDoor", false, true);

PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);

RemoveItem("Storage");
}




void DoorAppear(string &in asParent, string &in asChild, int alState)
{

SetEntityActive("StorageDoor", true);

}




void ActivateStatue(string &in asParent, string &in asChild, int alState)
{

SetEntityActive("CreepyStatue", true);

PlaySoundAtEntity("", "24_iron_maiden.snt", "Player", 0.0, false);

}




void AreaCollide(string &in asParent, string &in asChild, int alState)
{

SetEntityActive("Sutior", true);


AddEnemyPatrolNode("Sutior", "Node_1", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_5", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_6", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_8", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_10", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_16", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_20", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_26", 0.001, "");

}







void OnEnter()
{



}





void OnLeave()
{

AddTimer("", 3, "EndDemo");

}


RE: (SOLVED) StartCredits script confusion. - PutraenusAlivius - 01-05-2015

Try using an InteractCallback to initiate the credits rather than using OnLeave.


RE: (SOLVED) StartCredits script confusion. - G510s - 01-05-2015

(01-05-2015, 10:02 AM)Julius Caesar Wrote: Try using an InteractCallback to initiate the credits rather than using OnLeave.


void OnStart()
{

AddEntityCollideCallback("Player", "Sutior_1", "AreaCollide", true, 1);

PlayMusic("18_amb", true, 5, 2.0, 4, true);

AddEntityCollideCallback("Player", "Script_1", "ActivateStatue", true, 1);

AddEntityCollideCallback("Player", "PlaySound", "Sound", true, 1);

AddUseItemCallback("", "Storage", "StorageDoor", "UseKey", true);

AddEntityCollideCallback("Player", "ActivateDoor", "DoorAppear", true, 1);

AddEntityCollideCallback("Player", "QuestArea", "AddQuest", true, 1);

}




void AddQuest(string &in asParent, string &in asChild, int alState)
{

AddQuest("QuestArea", "Add");

}




void Move(string &in asEntity, int alState)
{
if (GetLocalVarInt("check") == 0)
{
if (alState == 1)
{
SetMoveObjectState("ShelfRotate_1", 1.0f);

PlaySoundAtEntity("", "quest_completed.snt", "ShelfRotate_1", 0, false);

PlayMusic("01_puzzle_passage", false, 3, 0, 10, false);

SetLocalVarInt("check", 1);

GiveSanityBoost();

return;
}
}
}




void DemoEnd(string &in asEntity)
{

AddTimer("Credits", 3, "EndDemo");

FadeOut(5.2);

StartCredits("ending_daniel", true, "Levels", "EndDemoCreits", 3);

}




void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("StorageDoor", false, true);

PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);

RemoveItem("Storage");
}




void DoorAppear(string &in asParent, string &in asChild, int alState)
{

SetEntityActive("StorageDoor", true);

}




void ActivateStatue(string &in asParent, string &in asChild, int alState)
{

SetEntityActive("CreepyStatue", true);

PlaySoundAtEntity("", "24_iron_maiden.snt", "Player", 0.0, false);

}




void AreaCollide(string &in asParent, string &in asChild, int alState)
{

SetEntityActive("Sutior", true);


AddEnemyPatrolNode("Sutior", "Node_1", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_5", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_6", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_8", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_10", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_16", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_20", 0.001, "");
AddEnemyPatrolNode("Sutior", "Node_26", 0.001, "");

}








void OnEnter()
{



}





void OnLeave()
{



}


------------------------------------------------------------------------------------------------------
This is my fixed script/hps file.