Raised This Month: $ Target: $400
 0% 

[L4D2]How to detect special infection behavior stuck


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
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 #1

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
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:47.


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