Help! Crash game

HolaAmigos27

Platinian
Original poster
Oct 9, 2021
28
4
3
29
Moscow
Code:
bool (*get_isEnemy)(void *_this) = (bool(*)(void *))getAbsoluteAddress(targetLibName,0x15BA1DC);

int (*old_Get_stat)(void *_this);
int Get_stat(void *_this) {
        bool isEnemy = get_isEnemy(_this);
        if (isEnemy) {
            return 150;
        }
    return old_Get_stat(_this);
}
MSHookFunction((void*)getAbsoluteAddress(targetLibName,0x15AD0C4), (void*)Get_stat, (void**)&old_Get_stat);
Whats wrong? Crash in battle only with unlink(bool isEnemy = get_isEnemy(_this)).
Without unlink all good
 

Raebydett

Awesome Active Platinian
Jan 20, 2020
171
60
28
G
Because u missing check if instance isnt null, if it still crash find other function. its not always isEnemy u need to look at. Modding is an Art, u need to be creative