Frictional Games Forum (read-only)
Ending A custom story - 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: Ending A custom story (/thread-53647.html)



Ending A custom story - XeOnTricks - 04-06-2017

so i just finished making the demo for my custom story but i cant seen to finure out how to end the demo. Can someone give me the entire script the i need to do this? and can you put in an example? might help me a bit more.


RE: Ending A custom story - Romulator - 04-06-2017

Well, how are you trying to end it? Is it with a credits screen? Is it triggered by a collide callback or..? Smile


RE: Ending A custom story - XeOnTricks - 04-06-2017

(04-06-2017, 12:23 PM)Romulator Wrote: Well, how are you trying to end it? Is it with a credits screen? Is it triggered by a collide callback or..? Smile

I'm trying to end it with start credits but it gave me an error when i put it on leave


RE: Ending A custom story - Mudbill - 04-06-2017

What's the crash? What's the script? We may be script wizards but we can't do magic. You gotta give us something to go on if we are to help you. Help us help you, you know?


RE: Ending A custom story - XeOnTricks - 04-07-2017

(04-06-2017, 09:19 PM)Mudbill Wrote: What's the crash? What's the script? We may be script wizards but we can't do magic. You gotta give us something to go on if we are to help you. Help us help you, you know?

void OnStart()
{
PlayMusic("01_amb_darkness.ogg", true, 0.9, 0, 1, false);

SetEntityPlayerInteractCallback("Bedroom_1", "DoorMessage_1", false);

SetEntityPlayerInteractCallback("Bedroom_2", "DoorMessage_2", false);

SetEntityPlayerInteractCallback("Bedroom_3", "DoorMessage_3", false);

SetEntityPlayerInteractCallback("MasterBed_1", "DoorMessage_4", false);

SetEntityPlayerInteractCallback("StorageDoor_1", "DoorMessage_5", false);

SetEntityPlayerInteractCallback("Kitchen", "DoorMessage_6", false);

AddUseItemCallback("", "Key_2", "Masterbed_1", "KeyFunc", true);

AddEntityCollideCallback("Player", "SuitorArea_1", "EnemySpawn", false, 1);

AddEntityCollideCallback("Player", "MonsterArea_1", "EnemySpawn_1", false, 1);

AddUseItemCallback("", "Key_3", "mansion_9", "DoorKey", true);

AddEntityCollideCallback("Player", "AreaCollide_1", "Message", true, 1);

AddUseItemCallback("", "Key_4", "StorageDoor_1", "UnlockDoor", true);

AddEntityCollideCallback("Player", "MonsterArea", "Monster", true, 1);
}




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

ShowEnemyPlayerPosition("Player");
}




void UnlockDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);

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

RemoveItem("Key_4");
}





void Message(string &in asParent, string &in asChild, int alState)
{
AddQuest("Journal", "Memento");
}




void DoorKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);

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

RemoveItem("Key_3");
}




void EnemySpawn_1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Demon_1", true);

ShowEnemyPlayerPosition("Player");
}




void EnemySpawn(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Suitor_1", true);

ShowEnemyPlayerPosition("Player");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_1", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_2", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_3", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_4", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_5", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_6", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_7", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_8", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_9", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_10", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_11", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_12", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_13", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_14", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_15", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_16", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_17", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_18", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_19", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_20", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_21", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_22", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_23", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_24", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_25", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_26", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_27", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_28", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_29", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_30", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_31", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_32", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_33", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_34", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_35", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_36", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_37", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_38", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_39", 0.001f, "");

AddEnemyPatrolNode("Suitor_1", "PathNodeArea_40", 0.001f, "");
}




void DoorMessage_1(string &in asEntity)
{
SetMessage("Messages", "DoorEntry_1", 0.00f);
}


void DoorMessage_2(string &in asEntity)
{
SetMessage("Messages", "DoorEntry_2", 0.00f);
}


void DoorMessage_3(string &in asEntity)
{
SetMessage("Messages", "DoorEntry_3", 0.00f);
}


void DoorMessage_4(string &in asEntity)
{
SetMessage("Messages", "DoorEntry_4", 0.00f);
}


void DoorMessage_5(string &in asEntity)
{
SetMessage("Messages", "DoorEntry_5", 0.00f);
}


void DoorMessage_6(string &in asEntity)
{
SetMessage("Messages", "DoorEntry_6", 0.00f);
}




void KeyFunc(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);

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

RemoveItem("Key_2");
}




void OnEnter()
{



}




void OnLeave()
{

StartCredits("ending_alexander.ogg", "Messages", "EndDemo", 1);

}


FATAL ERROR: Could not load script file ''
custom_stories/MyLastWords/maps/MyLastWords.hps'!
main (241, 6) : ERR : No matching signatures to 'StartCredits(string@%,
string@&, string@&, const uint)'


RE: Ending A custom story - Mudbill - 04-07-2017

The StartCredits script is supposed to be this:

PHP Code:
void StartCredits(stringasMusicbool abLoopMusicstringasTextCatstringasTextEntryint alEndNum); 

You've forgotten the second argument, the bool. That's why it can't find the "signature" for the script and crashes.

Try:

PHP Code:
StartCredits("ending_alexander.ogg"true"Messages""EndDemo"1); 



RE: Ending A custom story - XeOnTricks - 04-07-2017

(04-07-2017, 04:12 PM)Mudbill Wrote: The StartCredits script is supposed to be this:

PHP Code:
void StartCredits(stringasMusicbool abLoopMusicstringasTextCatstringasTextEntryint alEndNum); 

You've forgotten the second argument, the bool. That's why it can't find the "signature" for the script and crashes.

Try:

PHP Code:
StartCredits("ending_alexander.ogg"true"Messages""EndDemo"1); 

void OnEnter()
{



}




void OnLeave()
{

StartCredits("ending_alexander.ogg", true, "Messages", "EndDemo", 1);

}



i did what you told me but now i'm getting another error. when i exit the map it says it cannot load the other map but i never made one either, sorry, i'm pretty bad at explaining this but all i wanted it to do was open the credit screen and then do it's thing saying it's only a demo.


RE: Ending A custom story - Mudbill - 04-08-2017

How are you leaving the map? If you're leaving through a level door without an assigned map, it will crash. If you're just going to end the game when you leave the door instead of actually loading another map, then just select the current map as the destination.


RE: Ending A custom story - XeOnTricks - 04-08-2017

(04-08-2017, 04:20 AM)Mudbill Wrote: How are you leaving the map? If you're leaving through a level door without an assigned map, it will crash. If you're just going to end the game when you leave the door instead of actually loading another map, then just select the current .p as the destination.

so are you saying to mark the first map as the destination? which i did but the credits didnt show up it just put me back into the map. Im wondering what im doing wrong .


RE: Ending A custom story - Mudbill - 04-09-2017

I suppose putting the destination to the same map won't trigger the OnLeave callback. Try setting it to a different map.