Help! Changing parameters whose classes are unknown and calling methods

im newbie in modding, dont kill me pls :)

First problem
I found the method I needed:
1735556988269.png


I hooked it:
C++:
int (*old_TakeDamageHook)(void *instance, void* attackResult);
int TakeDamageHook(void *instance, void* attackResult) {
    if (godmode) {
        //im stuck here, attackResult have a Field "Damage", how can i edit it?
    }
    return old_TakeDamageHook(instance, attackResult);
}
but I dont know how to change its parameters, because it is an unknown class.

Second problem
1735557070470.png

i need to call it, but how?
i tried this:
C++:
void (*DieHook)(void *instance) = (void (*)(void*))(0x12340B4);
DieHook();
but it doesnt work.
 
Firstly, the "TakeDamage" method you can NOP it by HEX patching it. NOP will fully disable that method.

Secondly, for the "Die" method, you can hook it like this:
C++:
void (*Is_die)(void *instance);
void Die(void *instance) {
    if(instance!=nullptr) {
        if(IsDead) {
            Buy_vvip(instance);
            IsDead=false;  // because we only want to call the method once
        }
    }
    Is_die(instance);
}
Adding the hook with an update method is better and prefferable.
 
Back
Top Bottom