Modifying values of pointers

Anything Cheat Engine related, bugs, suggestions, helping others, etc..
Post Reply
HailoSir
Noobzor
Noobzor
Posts: 11
Joined: Thu May 18, 2017 3:16 pm
Reputation: 3

Modifying values of pointers

Post by HailoSir » Sat Jun 22, 2019 8:16 am

1) I have a multilevel pointer which gives the value for money with a multiplier applied to the value shown in the game. However, I don't want to open my calculator every time to apply the multiplier to the amount I want... Is it possible to change the value to the amount I want with a script that applies the multiplier automatically?

2) Also, this money pointer is at all times 8 bytes away from another useful address pointing toward an honor value. How would I go about writing a script to calculate the honor address based off the money pointer?

User avatar
TheyCallMeTim13
Administration
Administration
Posts: 1626
Joined: Fri Mar 03, 2017 12:31 am
Reputation: 588

Re: Modifying values of pointers

Post by TheyCallMeTim13 » Sat Jun 22, 2019 1:25 pm

1.) You can add a custom type and set the pointer value type to that.
Here is a script for an integer (4 byte) divided by 100, you'll need to add this to the table Lua script:

Code: Select all


local TypeName = 'Int / 100'
local ByteCount = 4
local IsFloat = false

local function bytesToValue( ... )
	local bytes = { ... }
	return (byteTableToDword({ bytes[1], bytes[2], bytes[3], bytes[4] }) / 100)
end
local function valueToBytes(value)
	local bytes = dwordToByteTable(value * 100)
	return bytes[1], bytes[2], bytes[3], bytes[4]
end

registerCustomTypeLua(TypeName, ByteCount, bytesToValue, valueToBytes, IsFloat)

2.) Just add to the final offset. Copy & paste the pointer, then add to the final offset (the one at the top in the CE address/pointer window).
CE wiki - Tutorials CE wiki - Auto Assembler Basics - CE wiki - Lua Basics If it's not a Personal Message don't PM me, use the forum. I ignore PMs that should be asked on the forum.

User avatar
SunBeam
Administration
Administration
Posts: 2600
Joined: Sun Feb 04, 2018 7:16 pm
Reputation: 1040

Re: Modifying values of pointers

Post by SunBeam » Sat Jun 22, 2019 2:25 pm

Yeah, sure he'll know wtf you mean with Lua code ;)

HailoSir
Noobzor
Noobzor
Posts: 11
Joined: Thu May 18, 2017 3:16 pm
Reputation: 3

Re: Modifying values of pointers

Post by HailoSir » Sat Jun 22, 2019 6:23 pm

Thanks, TheyCallMeTim13! Everything is working :D

Post Reply

Who is online

Users browsing this forum: kmagna