Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Get Coords from another Script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
selina88
How do I cheat?
Reputation: 0

Joined: 21 Jun 2025
Posts: 3

PostPosted: Sat Jun 21, 2025 3:48 pm    Post subject: Get Coords from another Script Reply with quote

Hello,

i'm struggeling a bit right now. I'm still learning, don't judge Embarassed
I wanna take my coordinates from another script (activated) to a new script.
I want that enemies teleport infront of my location but i really don't know
how to do it right Confused


This works fine!
Code:

newmem:
  mov [rdi+14],(float)200 //x
  mov [rdi+1C],(float)120 //y
  mov [rdi+10],(float)12 //z
  jmp return


But this not works (can't work, I know):
Code:

newmem:
  mov [rdi+14],[GetPlayerCoords+4] //x
  mov [rdi+1C],[GetPlayerCoords+0] //y
  mov [rdi+10],[GetPlayerCoords+8] //z
  jmp return


I tried this one:
Code:

newmem:
  push eax
  mov eax,[GetPlayerCoords+4]
  mov [rdi+14],eax //x
  mov eax,[GetPlayerCoords+0]
  mov [rdi+1C],eax //y
  mov eax,[GetPlayerCoords+8]
  mov [rdi+10],eax //z
  pop eax
  jmp return

But does not work too..

Reading from the script with [GetPlayerCoords] is no problem.
The Pointers shows my x, y, z coordinates.

Any idea? Laughing
Never did that before..
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25762
Location: The netherlands

PostPosted: Sat Jun 21, 2025 4:33 pm    Post subject: Reply with quote

use another register
Code:

newmem:
  push rax
  mov eax,[GetPlayerCoords+4]
  mov [rdi+14],eax //x

  mov eax,[GetPlayerCoords+0]
  mov [rdi+1C],eax //y

  mov eax,[GetPlayerCoords+8]
  mov [rdi+10],eax //z
  pop rax
  jmp return


using eax instead of rax as it's 4 byte data

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
selina88
How do I cheat?
Reputation: 0

Joined: 21 Jun 2025
Posts: 3

PostPosted: Sat Jun 21, 2025 4:53 pm    Post subject: Reply with quote

I tried but does not work.
[GetPlayerCoords] are float Values. I hoped that works but I failed Sad
Is there another way?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4690

PostPosted: Sat Jun 21, 2025 4:54 pm    Post subject: Reply with quote

Also, the code in the other script that writes to GetPlayerCoords must be executed by the game before any code that reads the same data. If that injection is run every frame, then it's probably not an issue; otherwise, you might want to make another variable that indicates whether or not the coordinates have been initialized with a valid value.

You can always set a breakpoint and check the values of registers or memory addresses at any point.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
selina88
How do I cheat?
Reputation: 0

Joined: 21 Jun 2025
Posts: 3

PostPosted: Sun Jun 22, 2025 5:46 am    Post subject: Reply with quote

Okay now it works but.. strange problem now...
Why the hell the Mobs just teleport to my location if i DEACTIVATE the script.. ? Shocked

Activate set them to my location but the mobs are on another position it looks like, but they are exactly at the position they should, not visible. If i deactivate, they are visible on the location they should.

If i give them just coordinates like yesterday, they do the same. I just restarted the pc nothung more, never changed the simple script with the direkt locations i set into the script directly.

EDIT: I'm stupid... forgot that the game needs to read the new location.... Sorry Sad
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites