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 find and modify an "array adress"

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
MustangNil
Newbie cheater
Reputation: 0

Joined: 13 Jun 2022
Posts: 10

PostPosted: Mon Jun 13, 2022 5:58 am    Post subject: How to find and modify an "array adress" Reply with quote

Well, I found a certain address that accesses the lives of all characters: "A0409689" my question is: how can I find and change the addresses that access "A0409689" to 0 in lua? I thought about making pointers to each address, but it's really unfeasible. If possible, I would like a code example. I've seen some similar threads but it's still not clear to me.

Sorry for any spelling mistakes, I'm using or translator.

_________________
As always, with doubts...
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

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

PostPosted: Mon Jun 13, 2022 8:52 am    Post subject: Reply with quote

You would need to know the size of the array. Assuming, that 0xA0409689 is the base address of the array and that the value type is an integer.
Code:

local array = 0xA0409689

for i = 0, array_count -1 do
  writeInteger(array + i, 0)
end

--array_count is the amount of elements within the array
Back to top
View user's profile Send private message
MustangNil
Newbie cheater
Reputation: 0

Joined: 13 Jun 2022
Posts: 10

PostPosted: Mon Jun 13, 2022 11:28 am    Post subject: Reply with quote

LeFiXER wrote:
You would need to know the size of the array. Assuming, that 0xA0409689 is the base address of the array and that the value type is an integer.
Code:

local array = 0xA0409689

for i = 0, array_count -1 do
  writeInteger(array + i, 0)
end

--array_count is the amount of elements within the array



Could say it worked, but Could also say it didn't.
the code itself looks right, but I don't think that's exactly what I wanted. The code above modified exactly like an array, a chain of bytes. but... although I said "array" I was referring to the addresses that access the instruction from address A0409689, I wanted to find and modify the values ​​of the addresses that access A0409689


I used the name "Array" because the instruction of A0409689 stores the life of at least 80 characters in the game, which reminds me of an Array. but I don't think that was the appropriate term, sorry for that.

_________________
As always, with doubts...
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1253

PostPosted: Mon Jun 13, 2022 12:11 pm    Post subject: Reply with quote

I just stopped by while passing by.
This code will make every byte it reaches (80 bytes in the example) 0, including the first address given.

If you don't want the address to change, start counting from 4.
Code:
for i=4, tonumber(byte) do


Code:
function youChoose(address,byte)

    for i=0, tonumber(byte) do
     local addr=address .. "+" .. i
     --print(i .. " (Original byte): " .. readByte(addr))
     writeBytes(addr,0)
     --print(i .. " (New byte): " .. readByte(addr) .. "\n")
      if i==byte then
       print("The operation is complete. Please check!")
      end
    end
end

--use
youChoose("A0409689",80)

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
MustangNil
Newbie cheater
Reputation: 0

Joined: 13 Jun 2022
Posts: 10

PostPosted: Mon Jun 13, 2022 1:06 pm    Post subject: Reply with quote

AylinCE wrote:
I just stopped by while passing by.
This code will make every byte it reaches (80 bytes in the example) 0, including the first address given.

If you don't want the address to change, start counting from 4.
Code:
for i=4, tonumber(byte) do


Code:
function youChoose(address,byte)

    for i=0, tonumber(byte) do
     local addr=address .. "+" .. i
     --print(i .. " (Original byte): " .. readByte(addr))
     writeBytes(addr,0)
     --print(i .. " (New byte): " .. readByte(addr) .. "\n")
      if i==byte then
       print("The operation is complete. Please check!")
      end
    end
end

--use
youChoose("A0409689",80)


I seem to get it, it worked! thank you so much!

_________________
As always, with doubts...
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