RVA: 0x604820 VA: 0xc0204820
private Void NormalDamage(Int32 newDamage, EnemyInfo enemy, Single multiplier) { }
// RVA: 0x5e8008 VA: 0xc01e8008
private Void Update() { }
void (*old_Damage)(void *instance, float value);
void Damage(void *instance, float value) {
if (instance != NULL) {
old_Damage(instance, 9999.0f);
return;
}
return old_Damage(instance,value);
}
MSHookFunction((void *)getAbsoluteAddress("libil2cpp.so", 0x604820), (void *) Damage, (void **) &old_Damage);
void (*isDamage)(void *instance,float value);
void (*old_Damage)(void *instance);
void Damage(void *instance) {
if (instance != NULL) {
isDamage(instance, 9999.0f);
}
return old_Damage(instance);
}
isDamage = (void (*)(void *, int))getAbsoluteAddress("libil2cpp.so",0x604820);
MSHookFunction((void *)getAbsoluteAddress(targetLibName, 0x5e8008), (void *) Damage, (void **) &old_Damage);
void (*old_Damage)(void *instance, float value);
void Damage(void *instance, float value) {
if (instance == nullptr)return;
value == 9999.0f;
old_Damage(instance,value);
}
HOOK_LIB("libil2cpp.so", "0x604820", Damage, old_Damage);
What do you mean by this? I'm not very good with modding terminologyyou need to hook the parameter
What do you mean by this? I'm not very good with modding terminology
Thank you for your answer, but unfortunately I was unable to compile the projectvoid NormalDamage(void * instance, int newDamage, void *enemy, void *multiplier) ;
void _NormalDamage(void * instance, int newDamage, void *enemy, void *multiplier) {
if (instance != nullptr) {
//do whatever you want here
newDamage = 999999; //example for changing the param value
}
NormalDamage(instance, newDamage, enemy, multiplier);
}
Thank you.void (*NormalDamage)(void *instance, int newDamage, void *enemy, float multiplier);
void (*old_Update)(void *instance);
void Update(void *instance) {
if(instance!=NULL) {
void *enemy = *(void **) ((uint64_t) instance + 0xOFFSET);
NormalDamage(instance, 9999, enemy, 1.0);
}
}
old_Update(instance);
}
void (*NormalDamage)(void *instance, int newDamage, void *enemy, float multiplier);
void (*old_Update)(void *instance);
void Update(void *instance) {
if(instance!=NULL) {
void *enemy = *(void **) ((uint64_t) instance + 0x604820);
NormalDamage(instance, 9999, enemy, 1.0);
//}
}
old_Update(instance);
}
HOOK_LIB("libil2cpp.so", "0x5e8008", Update, old_Update);
void (*NormalDamage)(void *instance, int newDamage, void *enemy, float multiplier);
void (*old_Update)(void *instance);
void Update(void *instance) {
if(instance!=NULL) {
void *enemy = *(void **) ((uint64_t) instance + 0xOFFSET);
NormalDamage(instance, 9999, enemy, 1.0);
}
old_Update(instance);
}
In this case, I also get a crash, I will try to use other offsets, but for some reason it seems to me that we did not quite understand each other and that is why the result is negative. Could you explain why this fragment is used in your code? :Your game is likely crashing because the ememy offset you entered is incorrect. Look for a field offset called enemy in the same class
void *enemy = *(void **) ((uint64_t) instance + 0x604820);
NormalDamage(instance, 9999, enemy, 1.0);
float multiplier = *(float **) ((uint64_t) instance + 0x604820);
NormalDamage(instance, 9999, multiplier, 1.0);
It doesn't matter anymore, I just reduced the enemies' health. Thanks again for your helpThe 3rd parameter in the method you're hooking (NormalDamage) is enemy, you need to define the enemy class there, the 4th parameter (1.0) is the multiplier, I've just put 1.0 but you can change it to whatever you want.
What game are you modding
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies