Page 1 of 1

Help with teleporter

Posted: March 26th, 2012, 1:12 am
by dkforreal
Can someone please give me a script for a teleporter that only works if player has finished

Re: Help with teleporter

Posted: March 26th, 2012, 5:14 am
by dkforreal
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

Re: Help with teleporter

Posted: March 26th, 2012, 9:31 am
by Nekoneko
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

Re: Help with teleporter

Posted: March 27th, 2012, 10:37 am
by dkforreal
:D Thanks