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

"Broken parachute after dying with one in your inventory" fix #6

Open
Lordmau5 opened this issue Jun 23, 2022 · 4 comments
Open

"Broken parachute after dying with one in your inventory" fix #6

Lordmau5 opened this issue Jun 23, 2022 · 4 comments

Comments

@Lordmau5
Copy link

Hey there!

First off, thank you guys for this mod, it definitely brings in lots of fantastic fixes and makes the game more enjoyable :)

2nd off, I was working on one of my own mods that adds some Chaos Mod related fixes as well and ended up finding a solution to the bug where the parachute doesn't work properly after you die with one in your inventory.

In the external PLCHUTE script there are 2 variables:
FREEFALL_STAGE and PARACHUTE_CREATION_STAGE.

These 2 variables aren't reset to 0 when the player spawns.

The fix I found is to hook a method within CGameLogic::Update (in my case, the call for CReferences::RemoveReferencesToPlayer) and just reset those to 0 in there.

Working code from my mod:

static void
Hooked_BrokenParachuteFix ()
{
    CReferences::RemoveReferencesToPlayer ();

	// GetGlobalVariable is getting the corresponding value from the CTheScripts::ScriptSpace
    int &parachuteCreationStage = GetGlobalVariable<int> (1497);
    int &freefallStage          = GetGlobalVariable<int> (1513);

    parachuteCreationStage = 0;
    freefallStage          = 0;
}

I thought I'd share it with you guys so you can implement it yourself :)

@JuniorDjjr
Copy link
Owner

Interesting, but what does "doesn't work properly" means?

@Lordmau5
Copy link
Author

Lordmau5 commented Jun 23, 2022

Instead of trying to explain it in words, check out this short video:
https://streamable.com/3j4nfe

I have a parachute on me, then I die with the suicide cheat.
If I try to open the parachute in the air after this death it won't work as the parachute script is not reset properly.

Basically, the controls don't work and you will just fall to your death as the game thinks you don't have a parachute on.

@JuniorDjjr
Copy link
Owner

This is a very serious bug, are you sure it's vanilla and mods like SilentPatch don't fix it already? Anyway, I will add, thanks.

@Lordmau5
Copy link
Author

Yes, this is a very long-standing vanilla bug that surprisingly isn't already fixed by SilentPatch (I would've contacted him and asked him if he would like to add it as well, but he's not working on any mods for R* games anymore for obvious reasons)

Either way, I'd assume this just never came up during testing at R*.
Who get's a parachute, then dies with it, only to get another one and go skydiving with it right after? 😁

But yes, good to hear it's getting added - I also have it in my Chaos Mod but it's nice to have for everyone else, too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants