AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [L4D2] Windows signature need help(BossZombiePlayerBot::ShouldRetreatToCove r)T^T (https://forums.alliedmods.net/showthread.php?t=336151)

GlowingTree 01-31-2022 00:58

[L4D2] Windows signature need help(BossZombiePlayerBot::ShouldRetreatToCove r)T^T
 
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:stupid:

Silvers 01-31-2022 03:06

Re: [L4D2] Windows signature need help(BossZombiePlayerBot::ShouldRetreatToCove r)T^T
 
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.

GlowingTree 02-02-2022 09:20

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

Originally Posted by Silvers (Post 2770023)
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.:)

Dragokas 02-03-2022 11:31

Re: [L4D2] Windows signature need help(BossZombiePlayerBot::ShouldRetreatToCove r)T^T
 
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.


All times are GMT -4. The time now is 15:46.

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