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
How can I make an area for a mapchange?
SkuLLfac3 Offline
Junior Member

Posts: 48
Threads: 11
Joined: Jun 2011
Reputation: 0
#1
Question  How can I make an area for a mapchange?

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
06-22-2011, 10:17 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#2
RE: How can I make an area for a mapchange?

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

06-22-2011, 11:18 PM
Website Find
SkuLLfac3 Offline
Junior Member

Posts: 48
Threads: 11
Joined: Jun 2011
Reputation: 0
#3
RE: How can I make an area for a mapchange?

Thanks but thats not for areas, is it?
Or does a mapchange with an area doesn't need any special script?
06-23-2011, 12:30 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#4
RE: How can I make an area for a mapchange?

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

06-23-2011, 12:34 AM
Website Find
SkuLLfac3 Offline
Junior Member

Posts: 48
Threads: 11
Joined: Jun 2011
Reputation: 0
#5
RE: How can I make an area for a mapchange?

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:
void OnStart()
{
    
    AddEntityCollideCallback("Player", "toLatrine", "to_Latrine", false, 1);
}

Anyone know the mistakes? :/
void OnEnter()

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

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

06-23-2011, 01:27 AM
Find
rojkish Offline
Junior Member

Posts: 45
Threads: 0
Joined: Jun 2011
Reputation: 0
#6
RE: How can I make an area for a mapchange?

Could you post the whole script?
06-23-2011, 01:31 AM
Find
SkuLLfac3 Offline
Junior Member

Posts: 48
Threads: 11
Joined: Jun 2011
Reputation: 0
#7
RE: How can I make an area for a mapchange?

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
06-23-2011, 01:34 AM
Find
rojkish Offline
Junior Member

Posts: 45
Threads: 0
Joined: Jun 2011
Reputation: 0
#8
RE: How can I make an area for a mapchange?

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", "", "");
}

06-23-2011, 01:40 AM
Find
SkuLLfac3 Offline
Junior Member

Posts: 48
Threads: 11
Joined: Jun 2011
Reputation: 0
#9
RE: How can I make an area for a mapchange?

Thank you it works Smile Smile

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

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

and

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...
06-23-2011, 02:10 AM
Find
rojkish Offline
Junior Member

Posts: 45
Threads: 0
Joined: Jun 2011
Reputation: 0
#10
RE: How can I make an area for a mapchange?

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
06-23-2011, 02:21 AM
Find




Users browsing this thread: 3 Guest(s)