Frictional Games Forum (read-only)

Full Version: Two questions.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I checked the wiki, but I couldn't find anything, so I figured I'd ask here.

Anyway, I want to know how to make the player teleport to another map from picking up an object (what I plan on doing is having the player pick up a note, and teleport to a new level when their done reading it).

And, how do I end my custom story, as in, make the credits roll and such.

Thanks for any help.
http://wiki.frictionalgames.com/hpl2/amn..._functions

void ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);

Immediatly loads another map.

asMapName - the file to load
asStartPos - the name of the StartPos on the next map
asStartSound - the sound that is played when the change starts
asEndSound - the sound that is played when the new map is loaded


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

Starts the end credits screen.

asMusic - the music to play (including .ogg)
abLoopMusic - determines whether the music should loop
asTextCat - the category to be used in the .lang file (must be “Ending”)
asTextEntry - the entry in the .lang file (must be “MainCredits”)
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.
(10-11-2011, 09:42 PM)Tanshaydar Wrote: [ -> ]http://wiki.frictionalgames.com/hpl2/amn..._functions

void ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);

Immediatly loads another map.

asMapName - the file to load
asStartPos - the name of the StartPos on the next map
asStartSound - the sound that is played when the change starts
asEndSound - the sound that is played when the new map is loaded
So If I wanted that to trigger with a note, would the line of script be "AddEntityPlayerInteractCallback("", "note_4", "ChangeMap", "")"


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

Starts the end credits screen.

asMusic - the music to play (including .ogg)
abLoopMusic - determines whether the music should loop
asTextCat - the category to be used in the .lang file (must be “Ending”)
asTextEntry - the entry in the .lang file (must be “MainCredits”)
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.
And to make that when the player goes through a door, would that have to be run when the player is leaving the map? (So under // Run when leaving map
void OnLeave()
{


})

(10-12-2011, 11:00 PM)A Tricky Carnie Wrote: [ -> ]
(10-11-2011, 09:42 PM)Tanshaydar Wrote: [ -> ]http://wiki.frictionalgames.com/hpl2/amn..._functions

void ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);

Immediatly loads another map.

asMapName - the file to load
asStartPos - the name of the StartPos on the next map
asStartSound - the sound that is played when the change starts
asEndSound - the sound that is played when the new map is loaded
So If I wanted that to trigger with a note, would the line of script be "AddEntityPlayerInteractCallback("", "note_4", "ChangeMap", "")"
For that, try:
//___________________________
void OnStart() //OnEnter if you're making him enter the map in the first place.
{
SetEntityPlayerInteractCallback("note_4", "Note_mapchanger", true);
}


void Note_mapchanger(string &in asEntity)
{
ChangeMap("MAPNAME.map", "SPAWNPOSITONNAME", "", "");
}

//____________________________

(10-12-2011, 11:00 PM)A Tricky Carnie Wrote: [ -> ]
Quote:void StartCredits(string& asMusic, bool abLoopMusic, string& asTextCat, string& asTextEntry, int alEndNum);

Starts the end credits screen.

asMusic - the music to play (including .ogg)
abLoopMusic - determines whether the music should loop
asTextCat - the category to be used in the .lang file (must be “Ending”)
asTextEntry - the entry in the .lang file (must be “MainCredits”)
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.
And to make that when the player goes through a door, would that have to be run when the player is leaving the map? (So under // Run when leaving map
void OnLeave()
{


})
As for this, make an area box on the other side of the door and name it "ending_area". Then try this script function:
//__________________________________
void OnStart() //OnEnter if originally entering the map.
{
AddEntityCollideCallback("Player", "ending_area", "RollCredits", true, 1);
}


void RollCredits(string &in asParent, string &in asChild, int alState)
{
void StartCredits("MUSIC.ogg", true, "CATEGORY_IN_.lang", "ENTRY_IN_.lang", "HONESTLY, I'M NOT SURE WHAT THIS DOES");
}
_____________________

lemme know if these scripts work out correctly. and DON'T FORGET to try "OnLeave" if it isn't working. I haven't used it yet, so I don't know how "OnLeave" works exactly...
(10-13-2011, 01:46 AM)Statyk Wrote: [ -> ]
(10-12-2011, 11:00 PM)A Tricky Carnie Wrote: [ -> ]
(10-11-2011, 09:42 PM)Tanshaydar Wrote: [ -> ]http://wiki.frictionalgames.com/hpl2/amn..._functions

void ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);

Immediatly loads another map.

asMapName - the file to load
asStartPos - the name of the StartPos on the next map
asStartSound - the sound that is played when the change starts
asEndSound - the sound that is played when the new map is loaded
So If I wanted that to trigger with a note, would the line of script be "AddEntityPlayerInteractCallback("", "note_4", "ChangeMap", "")"
For that, try:
//___________________________
void OnStart() //OnEnter if you're making him enter the map in the first place.
{
SetEntityPlayerInteractCallback("note_4", "Note_mapchanger", true);
}


void Not_mapchanger(string &in asEntity)
{
ChangeMap("MAPNAME.map", "SPAWNPOSITONNAME", "", "");
}

//____________________________

(10-12-2011, 11:00 PM)A Tricky Carnie Wrote: [ -> ]
Quote:void StartCredits(string& asMusic, bool abLoopMusic, string& asTextCat, string& asTextEntry, int alEndNum);

Starts the end credits screen.

asMusic - the music to play (including .ogg)
abLoopMusic - determines whether the music should loop
asTextCat - the category to be used in the .lang file (must be “Ending”)
asTextEntry - the entry in the .lang file (must be “MainCredits”)
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.
And to make that when the player goes through a door, would that have to be run when the player is leaving the map? (So under // Run when leaving map
void OnLeave()
{


})
As for this, make an area box on the other side of the door and name it "ending_area". Then try this script function:
//__________________________________
void OnStart() //OnEnter if originally entering the map.
{
AddEntityCollideCallback("Player", "ending_area", "RollCredits", true, 1);
}


void RollCredits(string &in asParent, string &in asChild, int alState)
{
void StartCredits("MUSIC.ogg", true, "CATEGORY_IN_.lang", "ENTRY_IN_.lang", "HONESTLY, I'M NOT SURE WHAT THIS DOES");
}
_____________________

lemme know if these scripts work out correctly. and DON'T FORGET to try "OnLeave" if it isn't working. I haven't used it yet, so I don't know how "OnLeave" works exactly...
Thanks, I'll try these out.
@Statyk


The script layout you gave me didn't work, this is my script, in case I didn't do it right:
Spoiler below!
////////////////////////////// Run when entering map
void OnStart()
//OnEnter
{
AddEntityCollideCallback("Player", "ending_area", "RollCredits", true, 1);
}
void RollCredits(string &in asParent, string &in asChild, int alState)
{)
void StartCredits("05_paper_transformation.ogg", true, "Ending"", "MainCredits”, "1");
}


// Run when leaving map
void OnLeave()
{


}
I forgot to add the error message that comes when the game crashes when trying to load the script, here it is:
Spoiler below!
FATAL ERROR: Could not load script file
'custom_stories/InLimbo/maps/ch01/J:/Steam/steamapps/common/amnesia the dark descent/custom_stories/InLimbo/maps/ch01/credits.hps'!
main (8,2) : ERR : Expected expression value
(10-13-2011, 02:13 AM)A Tricky Carnie Wrote: [ -> ]Thanks, I'll try these out.
@Statyk

The script layout you gave me didn't work, this is my script, in case I didn't do it right:
Spoiler below!
////////////////////////////// Run when entering map
void OnStart()
//OnEnter
{
AddEntityCollideCallback("Player", "ending_area", "RollCredits", true, 1);
}
void RollCredits(string &in asParent, string &in asChild, int alState)
{)
void StartCredits("05_paper_transformation.ogg", true, "Ending"", "MainCredits”, "1");
}


// Run when leaving map
void OnLeave()
{


}

"main (8,2) : ERR : Expected expression value"

This means it's the eighth line down that can't be read. So there's a problem in the EIGHTH line, SECOND letter in.. which is "{)"... You can't have a parenthesis after a Squiggly-bracket. Or anything for that matter really. Remove the parenthesis and it should work. Let me know if it works or not.

(10-14-2011, 02:03 AM)Statyk Wrote: [ -> ]
(10-13-2011, 02:13 AM)A Tricky Carnie Wrote: [ -> ]Thanks, I'll try these out.
@Statyk

The script layout you gave me didn't work, this is my script, in case I didn't do it right:
Spoiler below!
////////////////////////////// Run when entering map
void OnStart()
//OnEnter
{
AddEntityCollideCallback("Player", "ending_area", "RollCredits", true, 1);
}
void RollCredits(string &in asParent, string &in asChild, int alState)
{)
void StartCredits("05_paper_transformation.ogg", true, "Ending"", "MainCredits”, "1");
}


// Run when leaving map
void OnLeave()
{


}

"main (8,2) : ERR : Expected expression value"

This means it's the eighth line down that can't be read. So there's a problem in the EIGHTH line, SECOND letter in.. which is "{)"... You can't have a parenthesis after a Squiggly-bracket. Or anything for that matter really. Remove the parenthesis and it should work. Let me know if it works or not.
now theres this error:
Quote:(9,68) : ERR : Expected '(' or ','
(10-14-2011, 02:31 AM)A Tricky Carnie Wrote: [ -> ]
(10-14-2011, 02:03 AM)Statyk Wrote: [ -> ]
(10-13-2011, 02:13 AM)A Tricky Carnie Wrote: [ -> ]Thanks, I'll try these out.
@Statyk

The script layout you gave me didn't work, this is my script, in case I didn't do it right:

////////////////////////////// Run when entering map
void OnStart()
//OnEnter
{
AddEntityCollideCallback("Player", "ending_area", "RollCredits", true, 1);
}
void RollCredits(string &in asParent, string &in asChild, int alState)
{)
void StartCredits("05_paper_transformation.ogg", true, "Ending"", "MainCredits”, "1");
}


// Run when leaving map
void OnLeave()
{
now theres this error:
Quote:(9,68) : ERR : Expected '(' or ','

There is a second quote next to "Ending" as highlighted above... Please read the errors and figure it out. remember, the first number in the error code is the line down, the second number is hw many letters over the error is occurring on that line.


(10-14-2011, 02:35 AM)Statyk Wrote: [ -> ]
(10-14-2011, 02:31 AM)A Tricky Carnie Wrote: [ -> ]
(10-14-2011, 02:03 AM)Statyk Wrote: [ -> ]
(10-13-2011, 02:13 AM)A Tricky Carnie Wrote: [ -> ]Thanks, I'll try these out.
@Statyk

The script layout you gave me didn't work, this is my script, in case I didn't do it right:

////////////////////////////// Run when entering map
void OnStart()
//OnEnter
{
AddEntityCollideCallback("Player", "ending_area", "RollCredits", true, 1);
}
void RollCredits(string &in asParent, string &in asChild, int alState)
{)
void StartCredits("05_paper_transformation.ogg", true, "Ending"", "MainCredits”, "1");
}


// Run when leaving map
void OnLeave()
{
now theres this error:
Quote:(9,68) : ERR : Expected '(' or ','

There is a second quote next to "Ending" as highlighted above... Please read the errors and figure it out. remember, the first number in the error code is the line down, the second number is hw many letters over the error is occurring on that line.
okay, I'll fix that, thanks for the help, its greatly appreciated.
Pages: 1 2