Raised This Month: $9 Target: $400
 2% 

[L4D2]How to detect special infection behavior stuck


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sorallll
Member
Join Date: Oct 2018
Old 08-29-2021 , 17: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 online now
sorallll
Member
Join Date: Oct 2018
Old 08-29-2021 , 17: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 online now
Psyk0tik
AlliedModders Donor
Join Date: May 2012
Location: Homeless
Old 08-29-2021 , 20: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.
__________________
AFK like JFK
--
Donate to Motivate
--
Get latest L4D/L4D2 gamedata signatures here.
--
PM me if you need help with finding signatures and/or offsets in the following games: L4D1&2/CSGO/TF2/NMRIH/INS/DODS/CSS/HL2DM

Last edited by Psyk0tik; 08-30-2021 at 12: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 11:16.


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