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 


Change character coordinates in a 2D game

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

Joined: 11 Jul 2023
Posts: 3

PostPosted: Tue Jul 11, 2023 8:01 am    Post subject: Change character coordinates in a 2D game Reply with quote

I was trying to change the coordinates of my character in a 2D game (make my character walks automatically), but I got some trouble with that. I found with cheat engine the value who says "go to coordinate X". But when I lock the value for this coordinate, the character doesn't move to coordinate X until I try to move it manually with my mouse (not necessarily to X, but just left-click to any position near me). Seems like that the left-click of my mouse is a "trigger" that makes the character walks. Anyone experienced something similar and know how to solve it?
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Tue Jul 11, 2023 2:33 pm    Post subject: Reply with quote

Changing character coordinates and moving the character automatically are two, different things.

By changing coordinates, you are essentially teleporting the object/character to the new location.

Getting a character to travel to the new coordinates using in-game functions involves not only telling the game where to go, but initializing those functions.

Depending on what your goal is, will determine the best approach.

If you simply want to teleport, then you will likely need to find a different address to work with. If you want the character to walk to a specific set of coordinates, then you probably have what you need already, and now you just need to simulate a mouse click. You can use LUA or assembly for this.
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Tue Jul 11, 2023 2:46 pm    Post subject: Reply with quote

That's assuming the game has navmeshes and a navigation system implemented. Explicit teleporation is the far simpler method here, wouldn't you agree?

I mean, there are ways to achieve it like ++METHOS says, manually sending the navigation points over a period of time to simulate movement.
Back to top
View user's profile Send private message
RobertDolani
How do I cheat?
Reputation: 0

Joined: 11 Jul 2023
Posts: 3

PostPosted: Tue Jul 11, 2023 3:56 pm    Post subject: Reply with quote

I appreciate the replies. I want the character to move itself automatically, i.e, I want to simulate a mouse-click. I'm new at Cheat Engine, how can I simulate a mouse-click to a given coordinate with Lua or assembly? I already have the coordinates X,Y where I am and the coordinates X,Y to move (these coordinates are in-game coordinates, not in terms of my screen or something else). I have another question too: I'd like the hack to work when I'm doing other things on my laptop, so would be the simulation of the mouse-click a problem?

As ++METHOS mentioned

"Getting a character to travel to the new coordinates using in-game functions involves not only telling the game where to go, but initializing those functions.",

I think the problem here is how to initialize the function for walking. Is there a way to initialize this function manually? Or this is far more complex than just simulate a mouse-click?
Back to top
View user's profile Send private message
DougElms
How do I cheat?
Reputation: 0

Joined: 12 Jul 2023
Posts: 1

PostPosted: Wed Jul 12, 2023 6:45 am    Post subject: Reply with quote

Thanks for helping me as well, I am new here too. I am learning.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Jul 12, 2023 7:19 pm    Post subject: Reply with quote

RobertDolani wrote:
I think the problem here is how to initialize the function for walking. Is there a way to initialize this function manually? Or this is far more complex than just simulate a mouse-click?
-You can simulate a mouse click or even multiple mouse clicks, but what is your actual goal here? Because if your goal is to create some kind of bot that will auto-play through the game, then this will require much more than just a simple mouse input. You would need to get the coordinates for every location that you wish to travel to, set up some kind of checks for determining when to initialize the mouse inputs, then have a way to actually do that. Some 2D games may use screen-based coordinates, which could further-complicate things for you.

In addition to that, you would basically have to manually play through the game first in order to gather all of the data necessary for creating a bot that can do it for you, and you would need a good understanding of lua or assembly to pull it off.

If your purpose is not to create a bot, and you simply want to move from one place to the other without actually pressing your mouse, then I do not see the purpose of that, since you will still need to perform a manual task in order to initialize everything, which is no different than clicking the mouse yourself. I suppose that there may be a way to have everything happen automatically, upon attachment of the target process, but I just do not see the point, really, since you would have to write a lot of code just to save yourself a single mouse click.
Back to top
View user's profile Send private message
RobertDolani
How do I cheat?
Reputation: 0

Joined: 11 Jul 2023
Posts: 3

PostPosted: Thu Jul 13, 2023 7:59 am    Post subject: Reply with quote

I want the character to keep moving around an area and attacking monsters. But let's focus only in the character movement. At the moment, I'm using cheat engine to only get the pointer addresses. Then I'm using pymen library in Python to change these values. For example, I can easily tell Python to change the coordinates where my character have to go. But as you told before, it's necessary to activate the function for walking too. Is it possible?
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Jul 13, 2023 7:36 pm    Post subject: Reply with quote

Is what possible?

Before, you mentioned that the character will move to the new location automatically when you click your mouse. So, simulating a mouse click should initialize any walking function, no?
Back to top
View user's profile Send private message
icp
Newbie cheater
Reputation: 0

Joined: 09 Dec 2021
Posts: 24

PostPosted: Wed Jul 26, 2023 6:52 am    Post subject: Reply with quote

Code:
{$lua}
  mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP)


...at the right place in the program. The click will occur at the current cursor location. If the cursor position needs to be changed, use the appropriate offset commands.
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3320

PostPosted: Thu Jul 27, 2023 4:16 am    Post subject: Reply with quote

I recall Geri (God bless his soul) made a table for Angry Birds to control the projectile (bird) you launch.
Might be worth a shot looking it up.
Back to top
View user's profile Send private message
extaczs
How do I cheat?
Reputation: 0

Joined: 02 Aug 2023
Posts: 1

PostPosted: Wed Aug 02, 2023 12:16 pm    Post subject: Reply with quote

i have exactly the same problem as the author, i am developing a bot for pxg(a tibia mod), i got the destination coordinates in memory, and it only moves to them, if there is a mouse click, and that it's bad i wish it moved automatically
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions 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