Help! weird bool hook problem

Sami1980

Solid & Active Platinian
Original poster
May 15, 2021
64
11
8
43
Europe
Hi all,

I made a bool hook for a player's reaction, which is simply true or false, but couldn't get it to work unless it's written like this:

C++:
bool feature1, feature2, featureHookToggle, NoReaction = true;
int sliderValue = 1, level = 0;
void *instanceBtn;


bool (*old_noreaction)(void *instance);
bool noreaction(void *instance) {
    if (instance != NULL && NoReaction) {
        return true;
    }
    return old_noreaction(instance);
}
But the problem is that it is reversed. Meaning that if I toggle the swtich ON it gets deactivated and if I toggle the switch OFF it gets activated. Any other way I write it, for example: NoReaction = false; and return true; or any other combination of true and false then it doesn't work at all. Why is it doing the opposite of what it's supposed to? Many thanks to any help!
 

fshn06

Platinian
Oct 1, 2023
12
0
1
24
in your switch toggle are you using it like this?

NoReaction = !NoReaction;
 

Sami1980

Solid & Active Platinian
Original poster
May 15, 2021
64
11
8
43
Europe
in your switch toggle are you using it like this?

NoReaction = !NoReaction;
I was using it as:

NoReaction = boolean;

but I tried what you suggested and unfortunately it gave me a ton of errors.
 

Sami1980

Solid & Active Platinian
Original poster
May 15, 2021
64
11
8
43
Europe
I can either just hex patch it or leave it a bool hook but re-word the name of the cheat so that it's logical and makes sense for toggling on and off the switch :lol:
 

zxcDelix

Platinian
Feb 12, 2023
41
5
8
25
Ukraine
Try this:
C++:
bool (*old_noreaction)(void *instance);
bool noreaction(void *instance) {
    if (instance != NULL) {
        if (NoReaction) {
        return true;
       }
    }
    old_noreaction(instance);
}
Or thy hook this with MemoryPatch.
 

Sami1980

Solid & Active Platinian
Original poster
May 15, 2021
64
11
8
43
Europe
Try this:
C++:
bool (*old_noreaction)(void *instance);
bool noreaction(void *instance) {
    if (instance != NULL) {
        if (NoReaction) {
        return true;
       }
    }
    old_noreaction(instance);
}
Or thy hook this with MemoryPatch.
Thanks a lot for the reply. When I tried this code the game crashed at the time it tried to execute the hack. When you say MemoryPatch is that the same as hex patch? If so, I already did and it works, thanks. But I was hoping to understand why my hook was acting weird. If "MemoryPatch" is something different than hex patching, then can you explain a bit more about it please? Thanks
 

Francois284Modz

Awesome Active Platinian
Jun 10, 2018
188
2,447
193
26
france
Thanks a lot for the reply. When I tried this code the game crashed at the time it tried to execute the hack. When you say MemoryPatch is that the same as hex patch? If so, I already did and it works, thanks. But I was hoping to understand why my hook was acting weird. If "MemoryPatch" is something different than hex patching, then can you explain a bit more about it please? Thanks
Bool NoReaction = true IS allready been execute because you set the bool to true change it to false like that when you turn the switch on it get on that's the raison it doing the difference
 
  • Like
Reactions: zxcDelix