| ethics   Member
 
 Posts: 51
 Threads: 18
 Joined: Jan 2014
 Reputation: 
0
 | 
			| PlayerStartAreas are behaving weirdly/teleport script not working 
 
				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?
 
 
				
(This post was last modified: 04-08-2017, 10:05 PM by ethics.)
 |  | 
	| 04-08-2017, 09:43 PM |  | 
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: PlayerStartAreas are behaving weirdly/teleport script not working 
 
				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?
 
 Trying is the first step to success. |  | 
	| 04-09-2017, 12:34 AM |  | 
	
		| Mudbill   Muderator
 
 Posts: 3,881
 Threads: 59
 Joined: Apr 2013
 Reputation: 
179
 | 
			| RE: PlayerStartAreas are behaving weirdly/teleport script not working 
 
				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.
			 
 
				
(This post was last modified: 04-09-2017, 11:12 PM by Mudbill.)
 |  | 
	| 04-09-2017, 11:11 PM |  |