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 


How to perform an action when a known instruction is called?

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

Joined: 18 Jan 2022
Posts: 2

PostPosted: Tue Jan 18, 2022 11:25 am    Post subject: How to perform an action when a known instruction is called? Reply with quote

In the campaign of Total War: Warhammer 2, whenever you initiate diplomacy with an AI faction, an instruction is called that copies the value of the faction's current wealth into a register:

Code:
Warhammer2.EMPIRECAMPAIGN::FACTION_ECONOMICS::treasury
8B 81 20090000        mov eax,[rcx+00000920]


Let's say I create a table entry called SelectedFactionWealth to store a pointer to the 4-Byte treasury value of the most recently viewed faction. How can I hook into the instruction so that every time it gets called, it sets my pointer to the source address (rcx+920)?

I'm new to CE, assembly and lua, so while I am working through the tutorials and docs, I've not yet come across a solution for this. Even if someone could just point me to relevant documentation, I'd be happy to work it out from there. Thanks!
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue Jan 18, 2022 11:54 am    Post subject: Reply with quote

Loop up code injection copy.
_________________
Back to top
View user's profile Send private message Visit poster's website
Pscyking
How do I cheat?
Reputation: 0

Joined: 18 Jan 2022
Posts: 2

PostPosted: Tue Jan 18, 2022 12:04 pm    Post subject: Reply with quote

Exactly what I need; thanks!
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 Gamehacking 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