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

[L4D2] Windows signature need help(BossZombiePlayerBot::ShouldRetreatToCove r)T^T


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GlowingTree
New Member
Join Date: Dec 2021
Location: Guangdong-China
Old 01-31-2022 , 00:58   [L4D2] Windows signature need help(BossZombiePlayerBot::ShouldRetreatToCove r)T^T
Reply With Quote #1

Hello everyone, I am a newbie in signature scanning and SDKCall using.

I am trying to make a function in coop mode that when special infecteds all dead and there is only a bot tank in the spot, the bot tank will evade to find a cover instead of continuing approaching to survivors and taking damage.

I have tried to use BossZombiePlayerBot::ShouldRetreatToCover signature

PHP Code:
_DWORD __cdecl BossZombiePlayerBot::ShouldRetreatToCover(BossZombiePlayerBot *__hidden this
because i could not found any function like ChargerEvade::ChargerEvade(void) or BoomerRetreatToCover::BoomerRetreatToCover(Bo omerRetreatToCover *__hidden this, TerrorNavArea *) on tank.

In linux, the call sequence is probably like this:

PHP Code:
BossZombiePlayerBot::ShouldRetreatToCover -> CDirector::SpecialsShouldRetreatToCover -> CDirectorChallengeMode::SpecialsShouldRetreatToCover 
there is a string "cm_SpecialsRetreatToCover" in "CDirectorChallengeMode::SpecialsShouldRetrea tToCover" so we can scan the string to find BossZombiePlayerBot::ShouldRetreatToCover signature.

But in server.dll binary i have tried to find string "cm_SpecialsRetreatToCover" an go to it's xref "sub_1025ADB0", i think it is "CDirectorChallengeMode::SpecialsShouldRetrea tToCover" function but there is no an "Up" xref to "sub_1025ADB0" which mean i couldn't find "CDirector::SpecialsShouldRetreatToCover" signature.

So i am confused in how to find "BossZombiePlayerBot::ShouldRetreatToCove r" signature in windowsT^T

I also have tried to use SDKCall to call "CDirector::SpecialsShouldRetreatToCover" directly in linux server, the code is like this
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>

#define GAMEDATA "test"

Handle g_hRetreatToCover;

public 
void OnPluginStart()
{
    
Handle g_hGameConf LoadGameConfigFile("test");
    if (
g_hGameConf == INVALID_HANDLE)
    {
        
SetFailState("can't read test in gamedata folder");
    }
    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetFromConf(g_hGameConfSDKConf_Signature"BossZombiePlayerBot::ShouldRetreatToCover");
    
g_hRetreatToCover EndPrepSDKCall();
    if (
g_hRetreatToCover == INVALID_HANDLE)
    {
        
SetFailState("can't read signature BossZombiePlayerBot::ShouldRetreatToCover");
    }
    
RegConsoleCmd("sm_ret"Cmd_Retreat);
}

public 
Action Cmd_Retreat(int clientint args)
{
    if (
client && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == && !IsFakeClient(client))
    {
        
int iTank;
        for (
int i 1MaxClientsi++)
        {
            if (
IsValidEntity(i))
            {
                if (
GetEntProp(iProp_Send"m_zombieClass") == 8)
                {
                    
iTank i;
                }
            }
        }
        
SDKCall(g_hRetreatToCoveriTank);
        
PrintToChatAll("\x03info:SDKCall finished");
    }

The test.txt in gamedata folder is like this
PHP Code:
"Games"
{
    
"left4dead2"
    
{
        
"Signatures"
        
{
            
/*
            *  BossZombiePlayerBot::ShouldRetreatToCover(BossZombiePlayerBot *__hidden this)
            */
            
"BossZombiePlayerBot::ShouldRetreatToCover"
            
{
                
"library"    "server"
                "linux"    "@_ZNK19BossZombiePlayerBot20ShouldRetreatToCoverEv"
            
}
        }
    }

The code has no effect when i spawned a tank and type !ret in the chat, there may be some mistakes in the code because i couldn't use SDKCall proficientlyT^T
May be we could use another method to achieve this function

Last edited by GlowingTree; 01-31-2022 at 01:00.
GlowingTree is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 01-31-2022 , 03:06   Re: [L4D2] Windows signature need help(BossZombiePlayerBot::ShouldRetreatToCove r)T^T
Reply With Quote #2

This function calls this:
PHP Code:
char __cdecl CDirectorChallengeMode::SpecialsShouldRetreatToCover(CDirectorChallengeMode *this)
{
  
char result// al

  
result = *((_BYTE *)this 1);
  if ( 
result )
    
result CDirector::GetScriptValue(TheDirector"cm_SpecialsRetreatToCover"0) != 0;
  return 
result;

So you could set "cm_SpecialsRetreatToCover" to "1" probably via VScript although that might not have the desired result, depends when the "CDirectorChallengeMode::SpecialsShouldRetrea tToCover" function gets called which might not be in any think function for the tank.


To find the sig on windows see the TUT link in my signature, there's a link that explains how to find stuff by vtable if there are no strings. But SDKCalling this is unlikely to make the tank retreat.
__________________

Last edited by Silvers; 01-31-2022 at 03:07.
Silvers is offline
GlowingTree
New Member
Join Date: Dec 2021
Location: Guangdong-China
Old 02-02-2022 , 09:20   Re: [L4D2] Windows signature need help(BossZombiePlayerBot::ShouldRetreatToCove r)T^T
Reply With Quote #3

Quote:
Originally Posted by Silvers View Post
This function calls this:
PHP Code:
char __cdecl CDirectorChallengeMode::SpecialsShouldRetreatToCover(CDirectorChallengeMode *this)
{
  
char result// al

  
result = *((_BYTE *)this 1);
  if ( 
result )
    
result CDirector::GetScriptValue(TheDirector"cm_SpecialsRetreatToCover"0) != 0;
  return 
result;

So you could set "cm_SpecialsRetreatToCover" to "1" probably via VScript although that might not have the desired result, depends when the "CDirectorChallengeMode::SpecialsShouldRetrea tToCover" function gets called which might not be in any think function for the tank.


To find the sig on windows see the TUT link in my signature, there's a link that explains how to find stuff by vtable if there are no strings. But SDKCalling this is unlikely to make the tank retreat.
Thanks a lot, Silvers, and sorry for my late reply. I have tried to write a simple VScript named coop.nut like this and tested it in coop mod, linux server
PHP Code:
DirectorOptions <-
{
    
cm_SpecialsRetreatToCover    1

And as you said, the VScript didn't perform me the desired effect, for example, I spawned a smoker and it still will tried to approach to survivors and perform a drag instead of retreating, and so did tank, would not retreat after spawning.

I will try another method, first use L4D_GetRandomPZSpawnPosition function in left4dhooks.inc to get a random spawn position, then use
PHP Code:
CommandABot(  {cmd DirectorScript.BOT_CMD_MOVEpos Vector( %f, %f, %f)}, pos[0], pos[1], pos[2] ) 
to let bot tank go to the specific position which generated by L4D_GetRandomPZSpawnPosition function. Hope this method will work.

I watched the video on youtube of sigscanning intro and how to make good signatures, I have learnt a lot of sigscanning, and i will continue learning sigscanning and vtable using from your tutorial.

Whatever, thanks so much for your help and happy Chinese New Year.

Last edited by GlowingTree; 02-02-2022 at 09:21.
GlowingTree is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 02-03-2022 , 11:31   Re: [L4D2] Windows signature need help(BossZombiePlayerBot::ShouldRetreatToCove r)T^T
Reply With Quote #4

The different approach to do what you want, is to change zombie class of tank to "smoker". Such a way he will inherit smoker's "cover" behaviour. I think BHaType has published such work.
__________________
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 07:38.


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