Raised This Month: $12 Target: $400
 3% 

[L4D2]How to detect special infection behavior stuck


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sorallll
Senior Member
Join Date: Oct 2018
Old 08-29-2021 , 16:36   [L4D2]How to detect special infection behavior stuck
Reply With Quote #1

After spawning, they sometimes stay still somewhere until the end of the round
sorallll is offline
sorallll
Senior Member
Join Date: Oct 2018
Old 08-29-2021 , 16:40   Re: [L4D2]How to detect special infection behavior stuck
Reply With Quote #2

PHP Code:
Action<Boomer>::OnStuck(void)
BoomerBehavior::OnStuck(BoomerBehavior *__hidden thisBoomer *) 
When I try to detour these functions with dhooks, they just crash my server.
sorallll is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 08-29-2021 , 19:17   Re: [L4D2]How to detect special infection behavior stuck
Reply With Quote #3

Those functions aren't called when special infected get "stuck". They actually just change their behavior state when they lose their target.

I did something like this to check if a Tank is idle:
PHP Code:
bool bIsTankIdle(int tank, const char[] search "TankIdle")
{
    if (!
bIsTank(tank) || !IsFakeClient(tank) || bIsInfectedGhost(tank))
    {
        return 
false;
    }

    
Address adTank GetEntityAddress(tank);
    if (
adTank == Address_Null || g_iIntentionOffset == -1)
    {
        return 
false;
    }

    
Address adIntention view_as<Address>(LoadFromAddress((adTank view_as<Address>(g_iIntentionOffset)), NumberType_Int32));
    if (
adIntention == Address_Null || g_iBehaviorOffset == -1)
    {
        return 
false;
    }

    
Address adBehavior view_as<Address>(LoadFromAddress((adIntention view_as<Address>(g_iBehaviorOffset)), NumberType_Int32));
    if (
adBehavior == Address_Null || g_iActionOffset == -1)
    {
        return 
false;
    }

    
Address adAction view_as<Address>(LoadFromAddress((adBehavior view_as<Address>(g_iActionOffset)), NumberType_Int32));
    if (
adAction == Address_Null || g_iChildActionOffset == -1)
    {
        return 
false;
    }

    
Address adChildAction Address_Null;
    while ((
adChildAction view_as<Address>(LoadFromAddress((adAction view_as<Address>(g_iChildActionOffset)), NumberType_Int32))) != Address_Null)
    {
        
adAction adChildAction;
    }

    if (
g_hSDKGetName == null)
    {
        return 
false;
    }

    
char sAction[64];
    
SDKCall(g_hSDKGetNameadActionsActionsizeof sAction);
    return 
StrEqual(sActionsearch);

You can search for "TankBehavior" (no behavior found) to check if it's "stuck".
"TankIdle" - waiting for survivors to trigger it.
"TankAttack" - target found.
"TankBehavior" - no target found.

I've only seen this method to work on Tanks and Witches/Commons (requires slightly different method). I'm not sure how to check for idle Smokers, Boomers, Hunters, Chargers, Jockeys, and Spitters since IDA doesn't show them to have an idle mode, only "JockeyAttack", "JockeyLeap", etc.
__________________

Last edited by Psyk0tik; 08-30-2021 at 11:32.
Psyk0tik is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-22-2022 , 17:56   Re: [L4D2]How to detect special infection behavior stuck
Reply With Quote #4

If still actual, I used to use box bounding check:

PHP Code:
#include <sdktools>

public void OnPluginStart()
{
    
RegAdminCmd("sm_stuck"CmdCheckStuckADMFLAG_ROOT"Checks if client stuck");
}

public 
Action CmdCheckStuck(int clientint args)
{
    
PrintToChat(client"Stuck? %b"IsClientStuck(client));
    return 
Plugin_Handled;
}

stock bool IsClientStuck(int iClientfloat vOrigin[3] = {0.00.00.0})
{
    static 
float vMin[3], vMax[3];
    static 
Handle hTrace;
    static 
bool bHit;
    
bHit false;
    
GetClientMins(iClientvMin);
    
GetClientMaxs(iClientvMax);
    if( 
vOrigin[0] == 0.0 && vOrigin[1] == 0.0 && vOrigin[2] == 0.0 )
    {
        
GetClientAbsOrigin(iClientvOrigin);
    }
    
hTrace TR_TraceHullFilterEx(vOriginvOriginvMinvMaxMASK_PLAYERSOLIDTraceRayNoPlayersiClient);
    if (
hTrace != INVALID_HANDLE) {
        
bHit TR_DidHit(hTrace);
        
CloseHandle(hTrace);
    }
    return 
bHit;
}

public 
bool TraceRayNoPlayers(int entityint maskany data)
{
    if(
entity == data || (entity >= && entity <= MaxClients))
    {
        return 
false;
    }
    return 
true;

__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:10.


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