mirror of
https://github.com/JezuzLizard/BO2-Reimagined.git
synced 2025-06-10 23:27:57 -05:00
Respawn near random player
This commit is contained in:
@ -51,6 +51,7 @@
|
||||
* Ignored by enemies for 1 second after being revived
|
||||
* Weapon is no longer switched after reviving if player switched weapons during revive
|
||||
* No longer gain points back on self revives
|
||||
* Respawn near random player (normally respawns near the same player every time)
|
||||
* Can shoot while looking at other players
|
||||
* Increased mantle speed
|
||||
* Increased ladder climb speed
|
||||
|
@ -29,6 +29,7 @@ main()
|
||||
replaceFunc(maps/mp/zombies/_zm::check_quickrevive_for_hotjoin, scripts/zm/replaced/_zm::check_quickrevive_for_hotjoin);
|
||||
replaceFunc(maps/mp/zombies/_zm::ai_calculate_health, scripts/zm/replaced/_zm::ai_calculate_health);
|
||||
replaceFunc(maps/mp/zombies/_zm::last_stand_pistol_rank_init, scripts/zm/replaced/_zm::last_stand_pistol_rank_init);
|
||||
replaceFunc(maps/mp/zombies/_zm::check_for_valid_spawn_near_team, scripts/zm/replaced/_zm::check_for_valid_spawn_near_team);
|
||||
replaceFunc(maps/mp/zombies/_zm::actor_damage_override, scripts/zm/replaced/_zm::actor_damage_override);
|
||||
replaceFunc(maps/mp/zombies/_zm::player_spawn_protection, scripts/zm/replaced/_zm::player_spawn_protection);
|
||||
replaceFunc(maps/mp/zombies/_zm::wait_and_revive, scripts/zm/replaced/_zm::wait_and_revive);
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include common_scripts\utility;
|
||||
#include maps\mp\zombies\_zm_utility;
|
||||
#include maps\mp\gametypes_zm\_hud_util;
|
||||
#include maps/mp/zombies/_zm;
|
||||
|
||||
check_quickrevive_for_hotjoin(disconnecting_player)
|
||||
{
|
||||
@ -461,6 +462,82 @@ getfreespawnpoint( spawnpoints, player )
|
||||
return spawnpoints[ 0 ];
|
||||
}
|
||||
|
||||
check_for_valid_spawn_near_team( revivee, return_struct )
|
||||
{
|
||||
if ( isDefined( level.check_for_valid_spawn_near_team_callback ) )
|
||||
{
|
||||
spawn_location = [[ level.check_for_valid_spawn_near_team_callback ]]( revivee, return_struct );
|
||||
return spawn_location;
|
||||
}
|
||||
|
||||
players = array_randomize(get_players());
|
||||
spawn_points = maps/mp/gametypes_zm/_zm_gametype::get_player_spawns_for_gametype();
|
||||
closest_group = undefined;
|
||||
closest_distance = 100000000;
|
||||
backup_group = undefined;
|
||||
backup_distance = 100000000;
|
||||
|
||||
if ( spawn_points.size == 0 )
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
|
||||
for ( i = 0; i < players.size; i++ )
|
||||
{
|
||||
if ( maps/mp/zombies/_zm_utility::is_player_valid( players[ i ], undefined, 1 ) && players[ i ] != self )
|
||||
{
|
||||
for ( j = 0; j < spawn_points.size; j++ )
|
||||
{
|
||||
if ( isdefined( spawn_points[ j ].script_int ) )
|
||||
{
|
||||
ideal_distance = spawn_points[ j ].script_int;
|
||||
}
|
||||
else
|
||||
{
|
||||
ideal_distance = 1000;
|
||||
}
|
||||
|
||||
if ( spawn_points[ j ].locked == 0 )
|
||||
{
|
||||
plyr_dist = distancesquared( players[ i ].origin, spawn_points[ j ].origin );
|
||||
if ( plyr_dist < ideal_distance * ideal_distance )
|
||||
{
|
||||
if ( plyr_dist < closest_distance )
|
||||
{
|
||||
closest_distance = plyr_dist;
|
||||
closest_group = j;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( plyr_dist < backup_distance )
|
||||
{
|
||||
backup_group = j;
|
||||
backup_distance = plyr_dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isdefined( closest_group ) )
|
||||
{
|
||||
closest_group = backup_group;
|
||||
}
|
||||
|
||||
if ( isdefined( closest_group ) )
|
||||
{
|
||||
spawn_location = get_valid_spawn_location( revivee, spawn_points, closest_group, return_struct );
|
||||
if ( isdefined( spawn_location ) )
|
||||
{
|
||||
return spawn_location;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
player_damage_override( einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime )
|
||||
{
|
||||
if ( isDefined( level._game_module_player_damage_callback ) )
|
||||
|
@ -28,6 +28,11 @@ init()
|
||||
level.special_weapon_magicbox_check = ::buried_special_weapon_magicbox_check;
|
||||
level._is_player_in_zombie_stink = maps/mp/zombies/_zm_perk_vulture::_is_player_in_zombie_stink;
|
||||
|
||||
if(is_gametype_active("zgrief"))
|
||||
{
|
||||
level.check_for_valid_spawn_near_team_callback = ::zgrief_respawn_override;
|
||||
}
|
||||
|
||||
turn_power_on();
|
||||
deleteslothbarricades();
|
||||
|
||||
@ -55,6 +60,117 @@ buried_special_weapon_magicbox_check(weapon)
|
||||
return 1;
|
||||
}
|
||||
|
||||
zgrief_respawn_override( revivee, return_struct )
|
||||
{
|
||||
players = array_randomize(get_players());
|
||||
spawn_points = maps/mp/gametypes_zm/_zm_gametype::get_player_spawns_for_gametype();
|
||||
grief_initial = getstructarray( "street_standard_player_spawns", "targetname" );
|
||||
|
||||
foreach ( struct in grief_initial )
|
||||
{
|
||||
if ( isDefined( struct.script_int ) && struct.script_int == 2000 )
|
||||
{
|
||||
spawn_points[ spawn_points.size ] = struct;
|
||||
initial_point = struct;
|
||||
initial_point.locked = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( spawn_points.size == 0 )
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
|
||||
closest_group = undefined;
|
||||
closest_distance = 100000000;
|
||||
backup_group = undefined;
|
||||
backup_distance = 100000000;
|
||||
i = 0;
|
||||
|
||||
while ( i < players.size )
|
||||
{
|
||||
if ( is_player_valid( players[ i ], undefined, 1 ) && players[ i ] != self )
|
||||
{
|
||||
j = 0;
|
||||
while ( j < spawn_points.size )
|
||||
{
|
||||
if ( isDefined( spawn_points[ j ].script_int ) )
|
||||
{
|
||||
ideal_distance = spawn_points[ j ].script_int;
|
||||
}
|
||||
else
|
||||
{
|
||||
ideal_distance = 1000;
|
||||
}
|
||||
|
||||
if ( spawn_points[ j ].locked == 0 )
|
||||
{
|
||||
plyr_dist = distancesquared( players[ i ].origin, spawn_points[ j ].origin );
|
||||
if ( plyr_dist < ( ideal_distance * ideal_distance ) )
|
||||
{
|
||||
if ( plyr_dist < closest_distance )
|
||||
{
|
||||
closest_distance = plyr_dist;
|
||||
closest_group = j;
|
||||
}
|
||||
j++;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( plyr_dist < backup_distance )
|
||||
{
|
||||
backup_group = j;
|
||||
backup_distance = plyr_dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isDefined( closest_group ) )
|
||||
{
|
||||
closest_group = backup_group;
|
||||
}
|
||||
|
||||
if ( isDefined( closest_group ) )
|
||||
{
|
||||
spawn_location = maps/mp/zombies/_zm::get_valid_spawn_location( revivee, spawn_points, closest_group, return_struct );
|
||||
if ( isDefined( spawn_location ) && !positionwouldtelefrag( spawn_location.origin ) )
|
||||
{
|
||||
if ( isDefined( spawn_location.plyr ) && spawn_location.plyr != revivee getentitynumber() )
|
||||
{
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return spawn_location;
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if ( isDefined( initial_point ) )
|
||||
{
|
||||
k = 0;
|
||||
while ( k < spawn_points.size )
|
||||
{
|
||||
if ( spawn_points[ k ] == initial_point )
|
||||
{
|
||||
closest_group = k;
|
||||
spawn_location = maps/mp/zombies/_zm::get_valid_spawn_location( revivee, spawn_points, closest_group, return_struct );
|
||||
return spawn_location;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
turn_power_on()
|
||||
{
|
||||
if(!(is_classic() && level.scr_zm_map_start_location == "processing"))
|
||||
|
@ -19,6 +19,7 @@ main()
|
||||
init()
|
||||
{
|
||||
level.special_weapon_magicbox_check = ::highrise_special_weapon_magicbox_check;
|
||||
level.check_for_valid_spawn_near_team_callback = ::highrise_respawn_override;
|
||||
|
||||
level thread elevator_solo_revive_fix();
|
||||
}
|
||||
@ -28,6 +29,43 @@ highrise_special_weapon_magicbox_check(weapon)
|
||||
return 1;
|
||||
}
|
||||
|
||||
highrise_respawn_override( revivee, return_struct )
|
||||
{
|
||||
players = array_randomize(get_players());
|
||||
spawn_points = maps/mp/gametypes_zm/_zm_gametype::get_player_spawns_for_gametype();
|
||||
|
||||
if ( spawn_points.size == 0 )
|
||||
{
|
||||
return undefined;
|
||||
}
|
||||
|
||||
for ( i = 0; i < players.size; i++ )
|
||||
{
|
||||
if ( is_player_valid( players[ i ], undefined, 1 ) && players[ i ] != self )
|
||||
{
|
||||
for ( j = 0; j < spawn_points.size; j++ )
|
||||
{
|
||||
if ( isDefined( spawn_points[ j ].script_noteworthy ) )
|
||||
{
|
||||
zone = level.zones[ spawn_points[ j ].script_noteworthy ];
|
||||
for ( k = 0; k < zone.volumes.size; k++ )
|
||||
{
|
||||
if ( players[ i ] istouching( zone.volumes[ k ] ) )
|
||||
{
|
||||
closest_group = j;
|
||||
spawn_location = maps/mp/zombies/_zm::get_valid_spawn_location( revivee, spawn_points, closest_group, return_struct );
|
||||
if ( isDefined( spawn_location ) )
|
||||
{
|
||||
return spawn_location;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
elevator_solo_revive_fix()
|
||||
{
|
||||
if (!(is_classic() && level.scr_zm_map_start_location == "rooftop"))
|
||||
|
Reference in New Issue
Block a user