AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved L4D Nav Mesh Attributes (https://forums.alliedmods.net/showthread.php?t=339140)

3ipKa 08-18-2022 14:47

L4D Nav Mesh Attributes
 
Hello! Maybe somebody knows or can give some advice of getting attributes.
Here is list of exising attributes. It'd be interesting how to get, for example, Spawn Attributes.

HarryPotter 08-19-2022 02:17

Re: L4D Nav Mesh Attributes
 
you can read

https://developer.valvesoftware.com/...ign/Nav_Meshes
https://developer.valvesoftware.com/...ed_Nav_Editing

sorallll 08-19-2022 02:37

Re: L4D Nav Mesh Attributes
 
PHP Code:

"Offsets"
{
    
/* CNavArea::InheritAttributes(CNavArea *__hidden this, CNavArea *, CNavArea *) */
    
"CNavArea::InheritAttributes::m_attributeFlags"
    
{
        
"linux"      "84"
        "windows"    "84"
    
}

    
/* TerrorNavArea::SetSpawnAttributes(TerrorNavArea *__hidden this, unsigned int) */
    
"TerrorNavArea::SetSpawnAttributes::m_spawnAttributes"
    
{
        
"linux"    "300"
        "windows"    "296"
    
}



3ipKa 08-23-2022 12:59

Re: L4D Nav Mesh Attributes
 
Quote:

Originally Posted by HarryPotter (Post 2786842)

Yeah, I know about that ) I'm searching way to do this through Sourcemod.

Quote:

Originally Posted by sorallll (Post 2786843)
PHP Code:

"Offsets"
{
    
/* CNavArea::InheritAttributes(CNavArea *__hidden this, CNavArea *, CNavArea *) */
    
"CNavArea::InheritAttributes::m_attributeFlags"
    
{
        
"linux"      "84"
        "windows"    "84"
    
}

    
/* TerrorNavArea::SetSpawnAttributes(TerrorNavArea *__hidden this, unsigned int) */
    
"TerrorNavArea::SetSpawnAttributes::m_spawnAttributes"
    
{
        
"linux"    "300"
        "windows"    "296"
    
}



Thank you, sorallll ) I took your End Safearea Teleport plugin as example.

I saw VScripts has some nav functions: GetNavArea, HasSpawnAttributes... Tried it use with L4D2_GetVScriptOutput, but haven't found a way yet. Is it possible do it with VScripts through SM?

Marttt 08-23-2022 13:37

Re: L4D Nav Mesh Attributes
 
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); 


eyal282 08-23-2022 14:03

Re: L4D Nav Mesh Attributes
 
Quote:

Originally Posted by Marttt (Post 2787247)
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.

Silvers 08-23-2022 20:10

Re: L4D Nav Mesh Attributes
 
Quote:

Originally Posted by eyal282 (Post 2787250)
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.

Run the "script_execute" command from the vscript?


I've added Get/Set "m_attributeFlags" and "m_spawnAttributes" natives to Left4DHooks for next update.

Dragokas 09-21-2022 14:15

Re: L4D Nav Mesh Attributes
 
1 Attachment(s)
I'm not sure flags and attributes are same.

Here is nav flags extractor, I did vizualizer for BHaType code long time ago.

L4D1 version attached. See "flag" variable.
For L4D2 version, you can extract from [L4D2] Navigation Loot Spawner

3ipKa 09-22-2022 02:23

Re: L4D Nav Mesh Attributes
 
Thanks guys! I made it, thanks for your advice, your plugins, for your responsiveness :)


All times are GMT -4. The time now is 11:47.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.