Frictional Games Forum (read-only)

Full Version: How can I make an area for a mapchange?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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
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/amn..._functions
Thanks but thats not for areas, is it?
Or does a mapchange with an area doesn't need any special script?
MapChange is a function you can call from anywhere, in area callbacks, use item callbacks, look at callbacks, timers...
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", "", "");
}

Could you post the whole script?
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
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", "", "");
}

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...oblem.jpg/
The original map in the editor

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

When I delete these two commands out of the script, the map works correctly. I don't understand that...
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
Pages: 1 2