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 


Store Address

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

Joined: 24 Jul 2016
Posts: 26

PostPosted: Fri Aug 26, 2016 3:55 am    Post subject: Store Address Reply with quote

Hello,
via a script can locate the address of the player structure [Player.jpg]. But when, along my route, I find opponents, the address of this structure changes [Enemies.jpg]. The address of the player, of course remains unchanged, but in my table are uploaded to the addresses of the enemy's structure. Once you 've defeated the enemy or there are no enemies nearby, the table puts the player's address.

The script I used is as follows:

Code:
[ENABLE]
{$lua}
LaunchMonoDataCollector()
{$asm}

registersymbol(pCharacter)

alloc(newmem,2048)
alloc(pCharacter,4)
label(returnhere)
label(originalcode)
label(exit)

Character:Update:
jmp newmem
nop
nop
returnhere:

newmem:
push [esp+4]
pop [pCharacter]

originalcode:
push ebp
mov ebp,esp
push edi
sub esp,04

exit:
jmp returnhere

[DISABLE]

unregistersymbol(pCharacter)
dealloc(newmem)
dealloc(pCharacter)

Character:Update:
push ebp
mov ebp,esp
push edi
sub esp,04


Is there a way, by modifying or changing the script, so the script will give me as the exclusive result address of the player and let me just see this in my table ?

Thanks.



Player.jpg
 Description:
 Filesize:  98.2 KB
 Viewed:  3669 Time(s)

Player.jpg



Enemies.jpg
 Description:
 Filesize:  78.84 KB
 Viewed:  3669 Time(s)

Enemies.jpg


Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Fri Aug 26, 2016 4:08 am    Post subject: Reply with quote

Which offset has the "PlayerId" resp. the "IsEnemy" field?

Because both these seem suitable for the kind of compare you want.
Back to top
View user's profile Send private message
NexuIV
Cheater
Reputation: 0

Joined: 24 Jul 2016
Posts: 26

PostPosted: Fri Aug 26, 2016 4:19 am    Post subject: Reply with quote

hhhuut wrote:
Which offset has the "PlayerId" resp. the "IsEnemy" field?

Because both these seem suitable for the kind of compare you want.


Hi, Thanks for your help. Then...

PlayerId = [pCharacter]+248
IsEnemy = [pCharacter]+24C
BossId = [pCharacter]+250

I tried comparing the bytes but I have probably done something wrong. If you can give me an example of changing the script for a correct comparison I would be really grateful.

Thank You
Back to top
View user's profile Send private message
hhhuut
Grandmaster Cheater
Reputation: 6

Joined: 08 Feb 2015
Posts: 607

PostPosted: Fri Aug 26, 2016 7:03 am    Post subject: Reply with quote

Code:
[ENABLE]
{$lua}
LaunchMonoDataCollector()
{$asm}

registersymbol(pCharacter)

alloc(newmem,2048)
alloc(pCharacter,4)
label(returnhere)
label(originalcode)
label(exit)

Character:Update:
jmp newmem
nop
nop
returnhere:

newmem:
push eax
mov eax,[esp+04]
test eax,eax
je originalcode   //check if the given address is zero

cmp dword ptr [eax+248],00   //check if playerId=0 (zero)
jne originalcode

cmp byte ptr [eax+24c],00   //check if IsEnemy=0 (zero)
jne originalcode

mov [pCharacter],eax   //still here so it seems to be the wanted character address

originalcode:
pop eax
push ebp
mov ebp,esp
push edi
sub esp,04

exit:
jmp returnhere

[DISABLE]

unregistersymbol(pCharacter)
dealloc(newmem)
dealloc(pCharacter)

Character:Update:
push ebp
mov ebp,esp
push edi
sub esp,04

A common compare would look like that, but note the following:
Depending on how exactly the game handles/treats those flags, you may not always be the player with ID=0 and maybe the IsEnemy flag is also zero for allied AI.
Back to top
View user's profile Send private message
NexuIV
Cheater
Reputation: 0

Joined: 24 Jul 2016
Posts: 26

PostPosted: Fri Aug 26, 2016 7:46 am    Post subject: Reply with quote

Thank you very much.

I modified the script as follows...

Code:
[ENABLE]

{$lua}
LaunchMonoDataCollector()
{$asm}

registersymbol(pCharacter)

alloc(newmem,2048)
alloc(pCharacter,4)
label(returnhere)
label(originalcode)
label(exit)

Character:Update:
jmp newmem
nop
nop
returnhere:

newmem:
push ecx    //ecx is empty
mov ecx,[esp+08]
test ecx,ecx
je originalcode   //check if the given address is zero

cmp dword ptr [ecx+248],00   //check if playerId=0 (zero)
jne originalcode

//cmp byte ptr [eax+24c],00   //check if IsEnemy=0 (zero)
//jne originalcode

mov [pCharacter],ecx

originalcode:
pop ecx
push ebp
mov ebp,esp
push edi
sub esp,04

exit:
jmp returnhere

[DISABLE]

unregistersymbol(pCharacter)
dealloc(newmem)
dealloc(pCharacter)

Character:Update:
//db 55 8B EC 57 83 EC 04
push ebp
mov ebp,esp
push edi
sub esp,04


and it works perfectly !!! Thank You.
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