Call of duty bo3: ZM Cleanup

From COD Modding & Mapping Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Explanation

This code here will allow for 2 things:

  • Removing and re-spawning Zombies too far from the player into a zone closer to the player
  • Add Point Of Interest using "dog_location" for Zombies during Solo Revive or Zombie Blood

Code

  • In your Map GSC, before the first Main function add this:


#using scripts\zm\zm_giant_cleanup_mgr;
  • After the zm_usermap::main() in the Main function add this:


	level.enemy_location_override_func = &enemy_location_override;
	level.no_target_override = &no_target_override;
  • Now after the main function add this new functions:


function enemy_location_override( zombie, enemy )
{
	AIProfile_BeginEntry( "factory-enemy_location_override" );

	if ( IS_TRUE( zombie.is_trapped ) )
	{
		AIProfile_EndEntry();
		return zombie.origin;
	}

	AIProfile_EndEntry();
	return undefined;
}

// --------------------------------
//	NO TARGET OVERRIDE
// --------------------------------
function validate_and_set_no_target_position( position )
{
	if( IsDefined( position ) )
	{
		goal_point = GetClosestPointOnNavMesh( position.origin, 100 );
		if( IsDefined( goal_point ) )
		{
			self SetGoal( goal_point );
			self.has_exit_point = 1;
			return true;
		}
	}
	
	return false;
}

function no_target_override( zombie )
{
	if( isdefined( zombie.has_exit_point ) )
	{
		return;
	}
	
	players = level.players;
	
	dist_zombie = 0;
	dist_player = 0;
	dest = 0;

	if ( isdefined( level.zm_loc_types[ "dog_location" ] ) )
	{
		locs = array::randomize( level.zm_loc_types[ "dog_location" ] );
		
		for ( i = 0; i < locs.size; i++ )
		{
			found_point = false;
			foreach( player in players )
			{
				if( player laststand::player_is_in_laststand() )
				{
					continue;
				}
				
				away = VectorNormalize( self.origin - player.origin );
				endPos = self.origin + VectorScale( away, 600 );
				dist_zombie = DistanceSquared( locs[i].origin, endPos );
				dist_player = DistanceSquared( locs[i].origin, player.origin );
		
				if ( dist_zombie < dist_player )
				{
					dest = i;
					found_point= true;
				}
				else
				{
					found_point = false;
				}
			}
			if( found_point )
			{
				if( zombie validate_and_set_no_target_position( locs[i] ) )
				{
					return;
				}
			}
		}
	}
	
	
	escape_position = zombie giant_cleanup::get_escape_position_in_current_zone();
			
	if( zombie validate_and_set_no_target_position( escape_position ) )
	{
		return;
	}
	
	escape_position = zombie giant_cleanup::get_escape_position();
	
	if( zombie validate_and_set_no_target_position( escape_position ) )
	{
		return;
	}
	
	zombie.has_exit_point = 1;
	
	zombie SetGoal( zombie.origin );
}

Zone File

  • In your Zone file add this line:


scriptparsetree,scripts/zm/zm_giant_cleanup_mgr.gsc

Credits

This is Treyarch's code, as seen in The Giant

~~