Thread: [Solved] L4D Nav Mesh Attributes
View Single Post
eyal282
Veteran Member
Join Date: Aug 2011
Old 08-23-2022 , 14:03   Re: L4D Nav Mesh Attributes
Reply With Quote #6

Quote:
Originally Posted by Marttt View Post
I heard that is possible to do that with left4dhooks vscripts functions, but I was never able to make it run.
One example from left4dhooks_test

PHP Code:
char buffer[128];
Format(buffersizeof(buffer), "GetCurrentFlowPercentForPlayer(%d)"client);
if( 
L4D2_GetVScriptOutput(bufferbuffersizeof(buffer)) )
    
PrintToServer("VScript: GetCurrentFlowPercentForPlayer(%d) = %s"clientbuffer); 
This is a VScript function I used in my mutation to check if a given non human entity is in the starting safe room:

Code:
/**
 * Checks whether or not an entity is in the starting safe room
 * 
 * @param entity     Entity to check
 * @return           true if entity is in start safe room, false otherwise.
 * @notes			 This works for the safe area on the first chapter of a campaign.
 */
function IsEntityInStartSafeRoom(entity)
{
	local origin = entity.GetOrigin();
	
	local navArea = NavMesh.GetNearestNavArea(origin, 2048, true, true);

	if(navArea != null)
	{
		// Some stupid maps like Blood Harvest finale and The Passing finale have CHECKPOINT inside a FINALE marked area.
		if(navArea.HasSpawnAttributes(64))
		{
			return false;
		}
		// https://developer.valvesoftware.com/wiki/List_of_L4D_Series_Nav_Mesh_Attributes
		else if(navArea.HasSpawnAttributes(2048) && GetFlowPercentForPosition(origin, false) <= 50.0)
		{
			return true;
		}

	}

	return false;
}
Maybe you can ask Silvers to allow making a file in addition to your plugin to declare VScript functions and then allow yourself to call them.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 08-23-2022 at 14:04.
eyal282 is offline