Question about the TP function (fun-games)

Hey Guys, i am from Germany so sry for my terrible english!

So, i was in the costum game and there was the ability to teleport urself with the interact key. How do i do that on my own?

If you repost in the german forum I can help you there too, might make the communication easier.

I dont know how the teleport ability in this custom game worked exactly, but with the teleport(player, position) action you can teleport a player to a certain position.

I dont know how you input the target position in the mode you played, but I assume that it was by simply aiming at the desired spot. You do this with a ray cast. Example:

rule - ongoing - each player

condition:
- is button held(event player, interact) == true

action:
- teleport(event player, ray cast hit position(eye position(event player), add(eye position(event player), multiply(facing direction of(event player), 100)), NULL, all players(all teams), false))

and how do i do this. I mean put this command in the game?

You can either type it in a new workshop script (or an existing one) by hand.

Or import this gamecode: 9FAF5

Or strg + C this code and open the workshop and press the paste button:

regel("Interact to teleport")
{
	event
	{
		Ongoing - Each Player;
		All;
		All;
	}

	bedingungen
	{
		Is Button Held(Event Player, Interact) == True;
	}

	aktionen
	{
		Teleport(Event Player, Ray Cast Hit Position(Eye Position(Event Player), Add(Eye Position(Event Player), Multiply(
			Facing Direction Of(Event Player), 100)), Null, All Players(All Teams), False));
	}
}

I dont get it. I dont now how to do this

  • Go to the custom games.
  • Create a new lobby.
  • Click on settings.
  • In the upper right there are 4 blue buttons. One of them is called “import code”. Click on it.
  • Enter this: 9FAF5 into it and “OK”.
  • Start the game.

If you want to change the settings and/or are interested in adding more stuff to your custom game, its probably a good idea that you start learning how to code in workshop step by step :slight_smile:

Try using the portal gun code, that’s pretty fun. And might do the same.