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
(SOLVED) StartCredits script confusion.
G510s Offline
Banned

Posts: 58
Threads: 32
Joined: Jun 2014
#1
(SOLVED) StartCredits script confusion.

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?
(This post was last modified: 01-05-2015, 07:21 AM by G510s.)
01-04-2015, 12:02 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: StartCredits script confusion.

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: (Select All)
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:
<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.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 01-04-2015, 01:44 AM by Romulator.)
01-04-2015, 01:41 AM
Find
G510s Offline
Banned

Posts: 58
Threads: 32
Joined: Jun 2014
#3
RE: StartCredits script confusion.

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?
(This post was last modified: 01-04-2015, 08:29 AM by G510s.)
01-04-2015, 08:05 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
RE: StartCredits script confusion.

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.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
01-04-2015, 08:31 AM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#5
RE: StartCredits script confusion.

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 ..
01-04-2015, 07:06 PM
Find
G510s Offline
Banned

Posts: 58
Threads: 32
Joined: Jun 2014
#6
RE: StartCredits script confusion.

(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");

}
01-05-2015, 06:46 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#7
RE: (SOLVED) StartCredits script confusion.

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

"Veni, vidi, vici."
"I came, I saw, I conquered."
01-05-2015, 10:02 AM
Find
G510s Offline
Banned

Posts: 58
Threads: 32
Joined: Jun 2014
#8
RE: (SOLVED) StartCredits script confusion.

(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.
01-05-2015, 10:10 AM
Find




Users browsing this thread: 2 Guest(s)