• Welcome Guest, The new Modme forums are here! Please visit here for all recommended information.

A script I need for my map to be complete

jfuvv

Well-known member
Just a quick question does anyone know the script for when if you fell off a challenge map it will spawn you back on the map it would amazing if someone could help me thank you
 

KillJoy

Well-known member
in your mapname.gsc directly under:

C++:
function main()

{

    zm_usermap::main();
add this

C++:
thread player_teleporter_init();

at very bottom of gsc

add this

C++:
function player_teleporter_init()
{
    player_tp = GetEntArray( "teleport_player", "targetname" );
    for( i = 0; i < player_tp.size; i++ )
    {
        player_tp[i] thread player_teleport();
    }
}

function player_teleport()
{
    destination = GetEnt( self.target, "targetname" );
    while(1)
    {
        self waittill( "trigger", player );
        player SetOrigin( destination.origin );
        player SetPlayerAngles( destination.angles );
    }
}


in Radiant:

add a trig_multi with the targetname "teleport_player"

add a script_struct

deselect all

select the trig then select the struct then press w (this will auto link them for script)

expand the trig_multi to the area that is off the map
once the player touches the trigger, he will be teleported back to the struct

save compile link your map


that should be it, this is from my 2018 monopoly map so lmk if i missed anything
 

jfuvv

Well-known member
in your mapname.gsc directly under:

C++:
function main()

{

    zm_usermap::main();
add this

C++:
thread player_teleporter_init();

at very bottom of gsc

add this

C++:
function player_teleporter_init()
{
    player_tp = GetEntArray( "teleport_player", "targetname" );
    for( i = 0; i < player_tp.size; i++ )
    {
        player_tp[i] thread player_teleport();
    }
}

function player_teleport()
{
    destination = GetEnt( self.target, "targetname" );
    while(1)
    {
        self waittill( "trigger", player );
        player SetOrigin( destination.origin );
        player SetPlayerAngles( destination.angles );
    }
}


in Radiant:

add a trig_multi with the targetname "teleport_player"

add a script_struct

deselect all

select the trig then select the struct then press w (this will auto link them for script)

expand the trig_multi to the area that is off the map
once the player touches the trigger, he will be teleported back to the struct

save compile link your map


that should be it, this is from my 2018 monopoly map so lmk if i missed anything
Your a legend pal thank you for the help thank you
 

jfuvv

Well-known member
in your mapname.gsc directly under:

C++:
function main()

{

    zm_usermap::main();
add this

C++:
thread player_teleporter_init();

at very bottom of gsc

add this

C++:
function player_teleporter_init()
{
    player_tp = GetEntArray( "teleport_player", "targetname" );
    for( i = 0; i < player_tp.size; i++ )
    {
        player_tp[i] thread player_teleport();
    }
}

function player_teleport()
{
    destination = GetEnt( self.target, "targetname" );
    while(1)
    {
        self waittill( "trigger", player );
        player SetOrigin( destination.origin );
        player SetPlayerAngles( destination.angles );
    }
}


in Radiant:

add a trig_multi with the targetname "teleport_player"

add a script_struct

deselect all

select the trig then select the struct then press w (this will auto link them for script)

expand the trig_multi to the area that is off the map
once the player touches the trigger, he will be teleported back to the struct

save compile link your map


that should be it, this is from my 2018 monopoly map so lmk if i missed anything
Alright killjoy thank you for the script I followed every step and when I go into the trigger nothing happens have you got any idea why this could be happing ?
 
Top