Tutorial How To Make A Teleport Hack

·҉ dollaz·҉. .

Approved iModder
Original poster
Approved iModder
Mar 26, 2021
159
1,796
193
Somewhere
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"
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:

aQReh

Rookie
Sep 4, 2022
2
0
1
22
Pakistan
please can you show me how to apply this correcly in tweak.xm and give a switch.
sorry i a new. but i want to learn
 

Sninja

Platinian
Jun 25, 2022
7
2
3
43
Costa Rica
If i want teleport to map marker then whats tge process??
you need to have the coords to teleport to as a vector3, so your X Y Z. You can use game guardian to locate the player position and read the value's when you are at the location you want to teleport to.

I added a debug function too my ESP that just displays player position as a vector3( x, y, z).