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 create simple regeneration?

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

Joined: 11 Feb 2015
Posts: 4

PostPosted: Sat Feb 10, 2018 4:14 pm    Post subject: How to create simple regeneration? Reply with quote

e.g. +1 to the adress value every 1 second
i'm a newbie so need some help Embarassed
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sat Feb 10, 2018 5:01 pm    Post subject: Reply with quote

There are a multitude of ways to do that

  1. hook code accessing the value and use inc or add if an integer or fadd dword ptr/addss for a float or fadd qword ptr/addsd for a double.
  2. use instructions from above but allocate memory and use createThread to write through a pointer you've found (or a copied address)
  3. use lua
    1. use autoAssemble to do 1 or 2 lol
    2. use a timer
      1. to read and write through a memory record, this code is the same for pretty much anything you do
        Code:
        {$lua}
        local desc = 'name/description of memory record to change'
        local regenRate = 1000 -- milliseconds
        local regenAmnt = 1 -- amount to regen (could be negative lol)
        [ENABLE]
        -- the rest will not change
        local uniqueName = desc .. 'timer'
        _G[uniqueName] = createTimer()
        local t =_G[uniqueName]
        local mr = getAddressList().getMemoryRecordByDescription(desc)
        t.Interval = regenRate
        t.OnTimer  = function(t)
          -- stop timer if mr does not exist
          if not mr then
            print('memory record', desc, 'does not exists!')
            t.destroy()
            return
          end
          -- avoid issue with writing to floating point when shown as hex
          local hex = mr.ShowAsHex
          mr.ShowAsHex = false
          local value = tonumber(mr.Value)
          value = value + regenAmnt
          mr.Value = value
          mr.ShowAsHex = hex
        end
        [DISABLE]
        local uniqueName = desc .. 'timer'
        _G[uniqueName].destroy() -- stop timer

      2. use readInteger/writeInteger (or float/double etc. variants) to write to a static address or pointer path eg.
        Code:
        local address = '[[game.exe+DEAF]+480]+4'
        writeInteger(address, readInteger(address) + 1)

    3. use lua's create thread to run a lua function in a new thread, essentially creating your own timer mechanism with sleep


There's probably a few other methods as well just with CE (obviously you could make a trainer in C++ etc. that uses Read/Write ProcessMemory).

Personally I recommend 1 if it's simple and you understand how or 3.2.1 (because it covers everything with the same code)
Back to top
View user's profile Send private message
KeepTRolling
How do I cheat?
Reputation: 0

Joined: 11 Feb 2015
Posts: 4

PostPosted: Sat Feb 10, 2018 10:16 pm    Post subject: Reply with quote

thx, I'll try
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