MinimalXenon
Platinian
So I'm wondering if the class of the Update() method im trying to hook with needs to have inherited from MonoBehaviour.
Why am I asking this? Because im trying to forcefully set all mob position using get_Transform() and set_Position().
However, my Update() method seems wrong since I can't set mob position at all. (Or my code)
This is my code:
Code:
public class MobManager : MonoBehaviour
Why am I asking this? Because im trying to forcefully set all mob position using get_Transform() and set_Position().
However, my Update() method seems wrong since I can't set mob position at all. (Or my code)
This is my code:
C++:
void *(*get_transform)(void *instance);
void (*set_position)(void *transform, Vector3 pos);
void Pointers() {
get_transform = (void *(*)(void *)) (g_il2cppBaseMap.startAddress + string2Offset(OBFUSCATE("0x2171EE8")));
set_position = (void (*)(void *, Vector3)) (g_il2cppBaseMap.startAddress + string2Offset(OBFUSCATE("0x2343CE4")));
}
bool setMobPos;
typedef void (*mobUpdate)(void *instance);
mobUpdate old_mobUpdate = nullptr;
void mobUpdate(void *instance) {
if (!instance) return;
debugInfo += "Mob Update Hooked\n"; // Debug
if (instance) {
if (setMobPos) {
Vector3 pos = GetSavePlayerPosition(); // Fetch my position
set_position(get_transform(instance), pos); // Teleport mobs to me
}
}
if (old_mobUpdate) {
old_mobUpdate(instance);
}
}
void Hooks() {
HOOK("0x14554CC", mobUpdate, old_mobUpdate);
}
Last edited: