Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research: trigger player death #52

Open
3 tasks
zpl-zak opened this issue Jan 13, 2024 · 2 comments
Open
3 tasks

Research: trigger player death #52

zpl-zak opened this issue Jan 13, 2024 · 2 comments

Comments

@zpl-zak
Copy link
Member

zpl-zak commented Jan 13, 2024

Description

We have identified an issue where it is impossible to programmatically trigger a player's death by directly setting the health value to 0. This requires investigation to understand the underlying cause and to identify if there is an existing function within the game's SDK that would allow us to achieve this functionality appropriately.

Tasks

  • Investigate the current implementation to understand why setting the health value to 0 does not trigger the player's death.
  • Research the game's SDK to find an existing function that can be used to programmatically induce a player's death.
  • Determine if there are any alternative methods or workarounds to simulate the player's death without directly manipulating the health value.

Scope

This issue is restricted to the client side.

See #47 (comment) for details.

@zpl-zak zpl-zak added bug Something isn't working priority:low research and removed bug Something isn't working labels Jan 13, 2024
@Segfaultd
Copy link
Member

There is a I_Human2::Kill method. Parameters to research

@Deewarz
Copy link
Contributor

Deewarz commented Jan 21, 2024

Interesting because C_HumanScript::SetHealth should call I_Human2::Kill if health is <= 0.0

void __fastcall C_HumanScript::SetHealth(__int64 *a1, float a2)
{
  __int64 v2; // rcx
  __int64 Game; // rax
  __int64 v4; // rax
  __int64 HealthSystem; // rax
  __int64 HealthBar; // rax

  v2 = *a1;
  if ( *(_BYTE *)(v2 + 24) == 9 )
  {
    Game = GetGame();
    v4 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)Game + 144i64))(Game);
    HealthSystem = C_Player2::GetHealthSystem(v4);
    HealthBar = mafia::health_system::C_HealthSystem::GetHealthBar(HealthSystem);
    sub_142BF4650(HealthBar);
  }
  else if ( (*(_BYTE *)(v2 + 28) & 1) != 0 )
  {
    if ( a2 <= 0.0 )
      I_Human2::Kill(v2, 9, 0, (__int64)ue::sys::math::ZeroVector);
    else
      I_Human2::SetHealth(v2, a2);
  }
}

Do we have an idea of what is v2 + 24 in if ( *(_BYTE *)(v2 + 24) == 9 )?

@zpl-zak zpl-zak added this to the racing gamemode milestone Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants