Modme Forums
Menu:

ok so i have the 5 style teleports but when 2 players tp thay get downed

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


mrlednor:

how do i stop players getting sudden death ?
```
#using scripts\codescripts\struct;
#using scripts\shared\array_shared;
#using scripts\shared\callbacks_shared;
#using scripts\shared\clientfield_shared;
#using scripts\shared\compass;
#using scripts\shared\exploder_shared;
#using scripts\shared\flag_shared;
#using scripts\shared\laststand_shared;
#using scripts\shared\math_shared;
#using scripts\shared\scene_shared;
#using scripts\shared\util_shared;
#insert scripts\shared\shared.gsh;
#insert scripts\shared\version.gsh;
#insert scripts\zm\_zm_utility.gsh;
#using scripts\zm\_load;
#using scripts\zm\_util;
#using scripts\zm\_zm;
#using scripts\zm\_zm_audio;
#using scripts\zm\_zm_powerups;
#using scripts\zm\_zm_utility;
#using scripts\zm\_zm_weapons;
#using scripts\zm\_zm_zonemgr;
#using scripts\shared\ai\zombie_utility;
#using scripts\zm\_zm_spawner;
#define KINO_SWIRL "_NSZ/Kino_Tele/kino_swirl"
#define TELE_BEAM "dlc0/factory/fx_teleporter_beam_factory"
//*****************************************************************************************************************************
#define TARGET_DISTANCE 1000 //Change to distance you want the zombies to get attracted to portal
//*****************************************************************************************************************************
#precache( "fx", KINO_SWIRL );
#precache( "fx", TELE_BEAM );
//-------------------------------------------------------------------------------
// setup and kick off think functions
//-------------------------------------------------------------------------------
function teleporter_init()
{
thread teleport_pad_init();
}

//-------------------------------------------------------------------------------
// handles turning on the pad.
//-------------------------------------------------------------------------------
function teleport_pad_init()
{
level.portal_trig = GetEntArray( "portal_trigs", "targetname" );
for ( i = 0; i < level.portal_trig.size; i++ )
{
level.portal_trigthread player_teleporting();
}
}

//-------------------------------------------------------------------------------
// handles moving the players and fx, etc...
//-------------------------------------------------------------------------------
function player_teleporting()
{
while(true)
{
self waittill( "trigger", player );

//also allow when in last stand
if ( zm_utility::is_player_valid( player ) || player laststand::player_is_in_laststand())
{
self thread Teleport_Player(player);
}

}
}

//-------------------------------------------------------------------------------
//-------------------------------------------------------------------------------
function teleport_player(user)
{
if(IsDefined(user.teleporting) && user.teleporting == true)
{
return;
}
user.teleporting = true;
self thread teleporting_zombies(user);
PlayFX( TELE_BEAM, self.origin);
self playsound( "kino_beam_fx" );
rand = RandomFloatRange(0.9,0.3.);
if(isdefined(self.target))
{
destination = struct::get(self.target, "targetname");
user setstance( "stand" );
wait(0.1);
//user playlocalsound( "zmb_black_hole_bomb_teleporter_go" );
user DisableWeapons();
user DisableOffhandWeapons();
user freezecontrols( true );
// trying to force angles on player.
user SetOrigin( destination.origin * rand );
user SetPlayerAngles( destination.angles );
PlayFX( TELE_BEAM, user.origin);
user playlocalsound( "kino_teleport_2d" );
}
else
{
// script origin trigger destination targets for player placement.
player_destination = struct::get("final_dest", "targetname");
user setstance( "stand" );
wait(0.1);
user playlocalsound( "kino_teleport_2d" );
user DisableWeapons();
user DisableOffhandWeapons();
user freezecontrols( true );
// trying to force angles on player.
user SetOrigin( player_destination.origin * rand );
user SetPlayerAngles( player_destination.angles );
PlayFX( TELE_BEAM, user.origin);
}
wait(0.5);
user enableweapons();
user enableoffhandweapons();
user FreezeControls( false );
user.teleporting = false;
}

//-------------------------------
// thread each zombie to teleport
//-------------------------------
function teleporting_zombies(user)
{
zombie = GetAISpeciesArray(level.zombie_team, "all");
for(i = 0; i < zombie.size; i++)
{
zombiethread teleport_zombies(user, self);
}
}
//--------------------------------
// self is zombies in zombie array
//--------------------------------
function teleport_zombies(targeted_player, target)
{
self endon( "death" );
//if zombie is too far just kill
if(Distance(self.origin, target.origin) >= TARGET_DISTANCE && IsDefined(self.favoriteenemy) && self.favoriteenemy == targeted_player)
{
level.zombie_total++;
self DoDamage(self.health + 666, self.origin);
}
while(Distance(self.origin, target.origin) < TARGET_DISTANCE && IsDefined(self.favoriteenemy) && self.favoriteenemy == targeted_player)
{
self.v_zombie_custom_goal_pos = target.origin;
if(self.favoriteenemy != targeted_player)
{
self.v_zombie_custom_goal_pos = undefined;
}
if(Distance(self.origin, target.origin) <= 50)
{
self thread zombie_touching(target, targeted_player);
break;
}
wait(0.05);
}
self.v_zombie_custom_goal_pos = undefined;
}
//----------------------------------------
// if zombie is touching trigger, teleport
//----------------------------------------
function zombie_touching(portal_trig, targeted_player)
{
zombie_origin = struct::get_array("zom_origin", "targetname");
if(self IsTouching(portal_trig))
{
PlayFX( TELE_BEAM, self.origin);
portal_trig playsound( "kino_beam_fx" );
closest = ArrayGetClosest(targeted_player.origin, zombie_origin);
self forceteleport(closest.origin, closest.angles, false, true);
//self.v_zombie_custom_goal_pos = undefined;
PlayFX(TELE_BEAM, closest.origin);
PlaySoundAtPosition( "kino_beam_fx" , closest.origin);
}
else
{
level.zombie_total++;
self DoDamage(self.health + 666, self.origin);
break;
}
}```