Help with teleporter

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
dkforreal
CJ Wannabe
CJ Wannabe
Posts: 7
Joined: November 30th, 2011, 12:15 am

Help with teleporter

Post by dkforreal » March 26th, 2012, 1:12 am

Can someone please give me a script for a teleporter that only works if player has finished

dkforreal
CJ Wannabe
CJ Wannabe
Posts: 7
Joined: November 30th, 2011, 12:15 am

Re: Help with teleporter

Post by dkforreal » March 26th, 2012, 5:14 am

KillerSam wrote:
dkforreal wrote:Can someone please give me a script for a teleporter that only works if player has finished
Search the forums - Code that will do that is probably on here 20+ times.
couldn't find any

Nekoneko
CJ Fan
CJ Fan
Posts: 170
Joined: April 18th, 2011, 3:48 pm

Re: Help with teleporter

Post by Nekoneko » March 26th, 2012, 9:31 am

well you want 2 triggers, right?
one to set that the player has finished and another to teleport him only if he has finished.
you place 2 trigger_multiples.
one with the targetname trigger_endmap
and another with the targetname trigger_teleport
you have to give the 2nd one a script_origin as a target, to point out where the desired position to be teleported to is
so it would look something like this

Code: Select all

main()
{
        //....
        thread end_map();
        thread teleporter();
}
 
end_map()
{
        entTrigger = getEnt( "trigger_endmap", "targetname" );
        while(1)
        {
                entTrigger waittill( "trigger", player );
                player.finished = true;
                wait 1;
        }
}
 
teleporter()
{
        entTrigger = getEnt( "trigger_teleport", "targetname" );
        while(1)
        {
                entTrigger waittill( "trigger", player );
                if( isdefined( player.finished ) && player.finished )
                        player setOrigin( entTrigger.target.origin );
                wait 1;
        }
}
 
hope i could help

dkforreal
CJ Wannabe
CJ Wannabe
Posts: 7
Joined: November 30th, 2011, 12:15 am

Re: Help with teleporter

Post by dkforreal » March 27th, 2012, 10:37 am

:D Thanks

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 30 guests