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

Solved [L4D2] Remove starting items of survivors in Scavenge Mode


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Forgetest
Member
Join Date: Aug 2020
Old 08-07-2021 , 09:06   [L4D2] Remove starting items of survivors in Scavenge Mode
Reply With Quote #1

The game always tries to equip survivors with kits and pills on every beginning round, but it's more like buggy for it sometimes doesn't give pills as well.

Thing is I'd like to remove this feature, but I could hardly make sure where this takes place (vscript? internal function?).

Unfortunately, all my efforts turned out to be nothing but I could only use a plugin that simply removes those items afterwards, marking the survivor character removed so it won't repeat.

This is obviously not 100% safe. The game would sometimes have identical characters at present. And if the characters that marked removed respawns, they can still get the equipments (unlikely to happen though).

It would be greatly appreciated if anyone can share some hints or suggestions on how to improve the plugin.

Last edited by Forgetest; 08-13-2021 at 11:15. Reason: Succeed via memory patching.
Forgetest is offline
Forgetest
Member
Join Date: Aug 2020
Old 08-13-2021 , 09:41   Re: [L4D2] Remove starting items of survivors in Scavenge Mode
Reply With Quote #2

Found through disassembly.

PHP Code:
_DWORD __cdecl CTerrorPlayer::GiveDefaultItems(CTerrorPlayer *__hidden this
Part of pseudocode:
PHP Code:
if ( !(unsigned __int8)CDirectorChallengeMode::GiveDefaultItems(*((CDirectorChallengeMode **)TheDirector 354), this) )
  {
    (*(
void (**)(void))(*(_DWORD *)this 1728))();
    if ( ((
unsigned __int8)CTerrorGameRules::IsSurvivalMode(this)
       || (
unsigned __int8)CTerrorGameRules::IsScavengeMode(v23))
      && !*((
_BYTE *)this 0x4000) )
    {
      (*(
void (__cdecl **)(CTerrorPlayer *, const char *, _DWORDint_DWORD))(*(_DWORD *)this 1728))(
        
this,
        
"weapon_pistol",
        
0,
        
1,
        
0);
      (*(
void (__cdecl **)(CTerrorPlayer *, char *, _DWORDint_DWORD))(*(_DWORD *)this 1728))(
        
this,
        
"first_aid_kit",
        
0,
        
1,
        
0);
      (*(
void (__cdecl **)(CTerrorPlayer *, char *, _DWORDint_DWORD))(*(_DWORD *)this 1728))(
        
this,
        
"pain_pills",
        
0,
        
1,
        
0);
    } 
Linux signature:
Code:
_ZN13CTerrorPlayer16GiveDefaultItemsEv
Forgetest is offline
Forgetest
Member
Join Date: Aug 2020
Old 08-13-2021 , 12:03   Re: [L4D2] Remove starting items of survivors in Scavenge Mode
Reply With Quote #3

Released plugin here https://github.com/Target5150/MoYu_S...starting_items
Forgetest is offline
Reply



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 20:46.


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