·҉ dollaz·҉. .
Awesome Active Platinian
Hello, Im gonna show how to make a basic teleport mod. Isn't the best but its something :).
Step one is to add this header, you can either paste it in your tweak.xm or make a Vector3.h file, put it in the same folder as your tweak.xm and import it into your tweak.xm. Like this: #import "Vector3.h"
Step two is to paste this under your import lines,
Step 3 is to call it in your hook. Here's an example.
set a pointer like this to your ismine:
all you gotta do is change the offsets. You can put the teleport thing in almost any class with an update function, not just your player update hook.
Step one is to add this header, you can either paste it in your tweak.xm or make a Vector3.h file, put it in the same folder as your tweak.xm and import it into your tweak.xm. Like this: #import "Vector3.h"
Code:
struct Vector3{
float x;
float y;
float z;
Vector3();
Vector3(float x, float y, float z);
~Vector3();
};
Vector3::Vector3() {}
Vector3::Vector3(float x, float y, float z) : x(x), y(y), z(z) {}
Vector3::~Vector3() {}
Step two is to paste this under your import lines,
Code:
void *(*get_transform)(void *_instance) = (void*(*)(void *))getRealOffset(0x10239446C);
void (*set_position_Injected)(void *_instance, Vector3 _vectorInstance) = (void (*)(void *, Vector3 ))getRealOffset(0x1023BF5FC);
void setPosition(void *component, Vector3 position) {
void* transform = get_transform(component);
set_position_Injected(transform, position);
}
Step 3 is to call it in your hook. Here's an example.
Code:
void(*old_PlayerUpdate)(void *instance);
void PlayerUpdate(void *instance){
bool isMine = get_isMine(instance);
if([switches isSwitchOn:@"Teleport"]) {
if(isMine == true){
/*where it says Vector3(100.0f, 0.0f, 100.0f)); you can make it whatever coords
you want, you just gotta experiment with where you set it. You can find coords easier with
igamegod or game guardian by looking for your x, y and z. */
setPosition(instance, Vector3(100.0f, 0.0f, 100.0f));
}
}
return old_PlayerUpdate(instance);
}
%ctor {
MSHookFunction((void *)getRealOffset(0x10185AEB0), (void *)PlayerUpdate, (void **)&old_PlayerUpdate);
}
set a pointer like this to your ismine:
Code:
bool (*get_isMine)(void *instance) = (bool (*)(void *))getRealOffset(0x1019F6604); //SynchronizedGameObject$$get_isMine
all you gotta do is change the offsets. You can put the teleport thing in almost any class with an update function, not just your player update hook.
Last edited: