Frictional Games Forum (read-only)

Full Version: Level doors with different shape
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm currently working on a custom story, and in the beginning, the player has to crawl up through a pipe in order to get inside a castle. My question is, how can I make a hatch inside the pipe have the same function as a level door, which is teleporting the player to the next map as soon as it is interacted with. I've got little to none understanding of script whatsoever, so I really need some noob-friendly explanation.
Thanks in advance! Smile
It's actually really easy Smile
Code:
void OnStart()
{
SetEntityPlayerInteractCallback("hatch", "ChangeLevel", true); //Adds a callback to call the function ChangeLevel when "hatch" is interacted with. True simply means that the callback is only called once.
}

void ChangeLevel(string &in entity, string &in type)
{
ChangeMap("01.map", "PlayerStartArea_1", "", ""); //Changes to level "01.map" and you will start at "PlayerStartArea_1", of course change that if you wish.
}

//This is a comment explaining what each line does, and is ignored by the engine Smile
Thanks alot, works perfectly! Smile