Frictional Games Forum (read-only)
How can I make an area for a mapchange? - 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: How can I make an area for a mapchange? (/thread-8756.html)

Pages: 1 2


How can I make an area for a mapchange? - SkuLLfac3 - 06-22-2011

Hey

Sorry if there is already a thread with this question. I searched but I don't found anything.

My question is: How can I make an area for a mapchange?

I have a room with a hole in the middle. On the bottom of the hole is a area called "Area1". Now I want that the map changes when you fall trough the hole (trough the area). The next map called "Map2".
Does anyone know what script I have to write?

Thanks Smile


RE: How can I make an area for a mapchange? - Tanshaydar - 06-22-2011

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

For this and more: http://wiki.frictionalgames.com/hpl2/amnesia/script_functions


RE: How can I make an area for a mapchange? - SkuLLfac3 - 06-23-2011

Thanks but thats not for areas, is it?
Or does a mapchange with an area doesn't need any special script?


RE: How can I make an area for a mapchange? - Tanshaydar - 06-23-2011

MapChange is a function you can call from anywhere, in area callbacks, use item callbacks, look at callbacks, timers...


RE: How can I make an area for a mapchange? - SkuLLfac3 - 06-23-2011

Thank you Smile

But now I have another problem. Always when I run the custom story, the game crashes after the first map and this message appears:

FATAL ERROR: Could not load script file 'custom_stories/Latrine der Angst EXTENDED VERSION/maps/ch01/Intro2.hps'!
main (15, 1) : ERR : Expected ',' or ','

The script is:
Code:
void OnStart()
{
    
    AddEntityCollideCallback("Player", "toLatrine", "to_Latrine", false, 1);
}

Anyone know the mistakes? :/
Code:
void OnEnter()

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

{
    ChangeMap("Latrine", "PlayerStartArea_1", "", "");
}




RE: How can I make an area for a mapchange? - rojkish - 06-23-2011

Could you post the whole script?


RE: How can I make an area for a mapchange? - SkuLLfac3 - 06-23-2011

Code:
void OnStart()
{
    
    MovePlayerHeadPos( 0, 0, 0, 10, 0.10f);
    
    PlayMusic("introsound.ogg", true, 1.0f, 0, 100, true);
    
    AddEntityCollideCallback("Player", "toLatrine", "to_Latrine", false, 1);
}



void OnEnter()

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

{
    ChangeMap("Latrine", "PlayerStartArea_1", "", "");
}


void OnLeave()
{
    SetupLoadScreen("LoadingText", "Loading_Latrine", 1, "loadingscreen.jpg");
}

Thats the full script of Intro2.map


RE: How can I make an area for a mapchange? - rojkish - 06-23-2011

You need to use both { and } on void OnEnter(), after that it should work correctly.

i.e;

Spoiler below!

void OnStart()
{

MovePlayerHeadPos( 0, 0, 0, 10, 0.10f);

PlayMusic("introsound.ogg", true, 1.0f, 0, 100, true);

AddEntityCollideCallback("Player", "toLatrine", "to_Latrine", false, 1);
}



void OnEnter()
{

}

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

{
ChangeMap("Latrine", "PlayerStartArea_1", "", "");
}




RE: How can I make an area for a mapchange? - SkuLLfac3 - 06-23-2011

Thank you it works Smile Smile

But now I have one last (I hope so) problem... -.-

When I have the commands
Code:
AddEntityCollideCallback("Player", "toLatrine", "to_Latrine", true, 1);

and

Code:
void toLatrine(string &in asParent, string &in asChild, int alState)

{
ChangeMap("Latrine", "PlayerStartArea_1", "", "");
}

in the script, then there some things missing in the map o.O

Here some screens:

http://imageshack.us/photo/my-images/830/mapproblem.jpg/
The original map in the editor

http://imageshack.us/photo/my-images/228/mapproblem2.jpg/
The map ingame

When I delete these two commands out of the script, the map works correctly. I don't understand that...


RE: How can I make an area for a mapchange? - rojkish - 06-23-2011

Quote:I don't understand that...

Neither do I, it certainly isn't anything wrong with the script itself. Perhaps you should try to restart the game? It's pretty weird actually...

Since the "way" to the green light and stuff is shorter when you add the scripts, perhaps the game is loading an old mapfile? No it shouldn't... You're not changing any of that stuff. Ah well I'm unsure, tell if you find a way to fix it