Frictional Games Forum (read-only)
Level doors with different shape - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Level doors with different shape (/thread-7987.html)



Level doors with different shape - Modular100 - 05-14-2011

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


RE: Level doors with different shape - Roenlond - 05-14-2011

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


RE: Level doors with different shape - Modular100 - 05-14-2011

Thanks alot, works perfectly! Smile