Frictional Games Forum (read-only)
[SCRIPT] PlayerStartAreas are behaving weirdly/teleport script not working - 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: [SCRIPT] PlayerStartAreas are behaving weirdly/teleport script not working (/thread-53649.html)



PlayerStartAreas are behaving weirdly/teleport script not working - ethics - 04-08-2017

I've got a very strange problem.
I made a script that triggers when you touch a door; you will be teleported "behind" the door. I reality, you are teleported to a different area of the map in front of a door (some may recall this mechanic from Cry of Fear).

Here's the problem: The TeleportPlayer script does not work at all. I interacted with the door and nothing happened.
Also, now that I have placed a second PlayerStartArea, it starts me at that one when loading the level from the menu, although I have defined a different one in the custom_story_settings. wtf?

Here's my script:

void OnStart()
{
SetEntityPlayerInteractCallback("tur_raus", "Stuff", true);
}

void Stuff(string &in asEntity)
{
FadeOut(5);
AddTimer("tele", 5, "Teleport");
}

void Teleport(string &in asTimer)
{
FadeIn(5);
TeleportPlayer("draussenstart");
}

EDIT:
I kinda solved this by changing the level when you touch the door, but this still interests me. Was there an update that made the TeleportPlayer script unusable?


RE: PlayerStartAreas are behaving weirdly/teleport script not working - FlawlessHappiness - 04-09-2017

From my experience, TeleportPlayer works just fine. The problem is probably rather in your code.
Did you test any of the other parts? Like the FadeOut?


RE: PlayerStartAreas are behaving weirdly/teleport script not working - Mudbill - 04-09-2017

TeleportPlayer should still work, but alternatively you can use SetPlayerPos. The only noticeable difference is that with TeleportPlayer, the view is reset to the Y rotation of the area, but SetPlayerPos does not affect the pitch and yaw.