Modme Forums
Menu:

Super Simple Teleport?

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: zomboassasin
Hey guys

Can someone please make a simple teleport script for me?

What i need is when the player falls/passes through a trigger it starts a timer

and when that timer ends i need it to teleport all the players in a specific area back to the spawn or a certain point.

Thanks!


ModmeBot:

Reply By: natesmithzombies

zomboassasinwhen that timer ends i need it to teleport all the players in a specific area back to the spawn or a certain point.


What you say here is a bit confusing. I am assuming you want the player to fall through an area, and then have a set amount of time to do something before being teleported to zone that has already been activated. If that is the case:

Insert a trigger>multiple into your map with the KVPs: targetname - timer_trig. Also insert a script>origin with the KVPs: targetname - timer_origin. The insert this code in your mapname.gsc at the bottom:

function trigger_timer()
{
	trigger = GetEnt( "timer_trig", "targetname" ); 
	
	while(1)
	{
		trigger waittill( "trigger", player );
		player thread timed_run(); 
	}
}

function timed_run()
{
	org = GetEnt( "timer_origin", "targetname" ); 
	wait(30); // Change this to whatever you want 
	self SetOrigin( org.origin ); 
}



Thread your function in mapname.gsc so it looks something like this:

function main()
{
    level thread trigger_timer(); 


ModmeBot:

Reply By: zomboassasin
Thanks it works perfectly!


ModmeBot:

Reply By: Blink-420
When I teleport back into an active zone my character bounces up and down rapidly and cant move for about 10 seconds :( The script_origin is placed in an open space above the ground


ModmeBot:

Reply By: zomboassasin

Blink-420When I teleport back into an active zone my character bounces up and down rapidly and cant move for about 10 seconds :( The script_origin is placed in an open space above the ground


That's because it will start the script every tick as long as your standing in the trigger. When you finally teleport after the amount of time you set all the other times the script was started are still trying to catch up. So basically it will teleport you there for however long you were in the trigger after the set amount of time.

In the example I am using this for the player falls through the trigger so he only hit it for a like half a second. So when i get teleported it works fine because it only teleports me there once. To fix it you would have to change the code so it only gets activated once or change the map so the player only is able to touch it for a brief amount of time.

Hope this helps


ModmeBot:

Reply By: Blink-420

zomboassasin
Blink-420When I teleport back into an active zone my character bounces up and down rapidly and cant move for about 10 seconds :( The script_origin is placed in an open space above the ground


That's because it will start the script every tick as long as your standing in the trigger. When you finally teleport after the amount of time you set all the other times the script was started are still trying to catch up. So basically it will teleport you there for however long you were in the trigger after the set amount of time.

In the example I am using this for the player falls through the trigger so he only hit it for a like half a second. So when i get teleported it works fine because it only teleports me there once. To fix it you would have to change the code so it only gets activated once or change the map so the player only is able to touch it for a brief amount of time.

Hope this helps


Ohh I covered the whole room..thanks :P