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 


Is there an easier way to increase currency rewards?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
AJarOfLube
Newbie cheater
Reputation: 0

Joined: 30 Dec 2015
Posts: 12

PostPosted: Fri Jan 19, 2018 5:22 pm    Post subject: Is there an easier way to increase currency rewards? Reply with quote

One of my favorite ways to cheat is to increase the amount of currency you gain when eg. picking up a coin, opening a chest, or whatever.

The way I usually do this is:
1. Find the memory location of the currency
2. Set a breakpoint on write
3. Do jmp-injection in the write-function.
4. In the injected code, check if the new value is larger than the old value, and if it is, increase the value further to eg. double the amount being added

However, this is a lot of work, and doesn't work well in a lot of games (for instance, when the function is used to write other values too, or when the value is written in multiple places). It seems like there should be a much easier way to do it:

1. Find the memory location of the currency
2. Tell Cheat Engine run some LUA code whenever it detects that the value has changed. The code will compare the new value to the old one, and increase the value further if necessary.

However, I have no idea how to do this. Is this even possible with Cheat Engine? Or is there another, better way to accomplish this?
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 8

Joined: 24 Feb 2017
Posts: 272
Location: Right Here Buddy.

PostPosted: Fri Jan 19, 2018 6:19 pm    Post subject: Reply with quote

You could use a timer in Lua, but know that I do this all the time and just us injections for it.

Code:
LAST_MONEY_VALUE = 0
MONEY_ADDRESS = 'ptrMoney'
--------
-------- Timer
--------
local aTimer = nil
local aTimerInterval = 10
local aTimerTicks = 0
local aTimerTickMax = 0
local function aTimer_tick(timer)
   if aTimerTickMax > 0 and aTimerTicks >= aTimerTickMax then
      timer.destroy()
   end
   aTimerTicks = aTimerTicks + 1
   local m = readInteger(MONEY_ADDRESS)
   if m ~= nil and LAST_MONEY_VALUE > 0 and m > LAST_MONEY_VALUE then
      local incValue = m - LAST_MONEY_VALUE
      writeInteger(MONEY_ADDRESS, m + incValue * 3)
   end
   LAST_MONEY_VALUE = m
end
aTimer = createTimer(MainForm, false)
aTimer.Interval = aTimerInterval
aTimer.OnTimer = aTimer_tick
aTimer.Enabled = true


You would just need to add some code to disable the timer.

Currently setting "aTimerTickMax" to any value above zero with kill the timer if it is already under "aTimerTicks".

_________________
A: What manner of man are you that can summon up fire without flint or tinder?
T: I... am an enchanter.


Last edited by TheyCallMeTim13 on Fri Jan 19, 2018 7:59 pm; edited 1 time in total
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater
Reputation: 23

Joined: 09 Aug 2013
Posts: 623

PostPosted: Fri Jan 19, 2018 7:50 pm    Post subject: Re: Is there an easier way to increase currency rewards? Reply with quote

AJarOfLube wrote:
for instance, when the function is used to write other values too, or when the value is written in multiple places
If you can't find a good way to get access to the address, that's going to cause a problem in every scenario. If you can just find some code that only reads that value that makes everything easier because if nothing else you can set a hardware breakpoint on that via lua and copy the value in the register to get the address (you'd want to try other options first but).

Once you have a solid way to get the address then you have several options, you can use the lua freeze or update timer that CE uses, or create your own lua timer or an assembly timer via createthread or hooking some code that runs regularly (maybe a couple other options to repeat code...) and then from there write a constant value or read the value and add to it or find the difference from the last read and multiply that by any factor and add that etc.

but it all depends on having some way to access that memory and if the only way you can find to get the address so you can do so is an instruction that accesses a bunch of other addresses as well, then that's what you have to deal with. (lua does have a way to do memory scans, so that is an option but at that point you might as well tell the user to do the scans and change the address of a certain memory record since they'd need to provide the current value for you to do the scans anyway. Which is always an option, just not as nice as you usually want lol)

Quote:
Tell Cheat Engine run some LUA code whenever it detects that the value has changed. The code will compare the new value to the old one, and increase the value further if necessary.
Code:
memrec.OnGetDisplayValue=function(mr,prevValue, newValue)
  local change = tonumber(newValue, mr.ShowAsHex and 16 or 10) - tonumber(prevValue,mr.ShowAsHex and 16 or 10) -- strings
  if change < 0 then return false end -- let it change to newValue
  local factor = 16
  return true, newValue+change*(factor-1) -- change it to what we want
  -- should autoconvert to string iirc
end
Back to top
View user's profile Send private message
sahartje
How do I cheat?
Reputation: 0

Joined: 25 Jan 2018
Posts: 4
Location: Holland

PostPosted: Thu Jan 25, 2018 3:06 pm    Post subject: Reply with quote

Hi, I'm new to cheat engine and I want to increase currency when earning something too, I just don't know how.
The first way you described it in those 4 steps. But I don't even know how to find the memory location, do you just mean scanning until you find the right value? And.. How do you set a breakpoint on write? And what is jmp-injection?

Sorry for all these questions.. I'm not a pro... But in some tutorials online, the specific goal to earn currency when rewarded a gift box etc is not explained well...Thanks so much in advance!
Back to top
View user's profile Send private message
AJarOfLube
Newbie cheater
Reputation: 0

Joined: 30 Dec 2015
Posts: 12

PostPosted: Thu Jan 25, 2018 3:09 pm    Post subject: Reply with quote

Please open another thread for those questions, this is not the place.
Back to top
View user's profile Send private message
sahartje
How do I cheat?
Reputation: 0

Joined: 25 Jan 2018
Posts: 4
Location: Holland

PostPosted: Thu Jan 25, 2018 3:10 pm    Post subject: Reply with quote

AJarOfLube wrote:
Please open another thread for those questions, this is not the place.


Ohh ok thnxx
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