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 


Help with subtracting a value

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

Joined: 16 Nov 2017
Posts: 24

PostPosted: Sun Dec 03, 2017 8:28 am    Post subject: Help with subtracting a value Reply with quote

Hi

I've been compiling scripts for Shovel Knight as a tutorial. Right now I want to add a value to the Y coordinate to give me an air walk ability. The reason for adding is that the Y coordinate varies from level to level.

I came up with the script below;

Code:
[ENABLE]

aobscanmodule(Airwalk,ShovelKnight.exe,D9 41 10 D9 5C 24 10 D9 44 24 14 D9 5C 24 78) // should be unique
alloc(newmem,$1000)
alloc(var,1000)

label(code)
label(awalk_on)
label(air_walk)
label(return)
registersymbol(awalk_on)
registersymbol(var)

var:
dd (float)15

newmem:
cmp [awalk_on],1
je air_walk

code:
  fld dword ptr [ecx+10]
  fstp dword ptr [esp+10]
  jmp return

air_walk:
  fld dword ptr [ecx+10]
  fadd dword ptr [var]
  fstp dword ptr [esp+10]
  jmp return

awalk_on:
dd 0

Airwalk:
  jmp newmem
  nop
  nop
return:
registersymbol(Airwalk)

[DISABLE]

Airwalk:
  db D9 41 10 D9 5C 24 10

unregistersymbol(Airwalk)
unregistersymbol(awalk_on)
unregistersymbol(var)
dealloc(newmem)
dealloc(var)


The original code is fld dword ptr [ecx+10]

Inserting fadd doesn't give me the desired result as my character walks on the normal Y plane.

Any advice as to what I'm doing wrong?

Cheers
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Dec 03, 2017 9:29 am    Post subject: Reply with quote

Well, I'm not sure what the game then does with [esp+10].
Maybe it doesn't store that back into your address?
Could try adding a FST.
Code:
  fld dword ptr [ecx+10]
  fadd dword ptr [var]
  fst dword ptr [ecx+10]
  fstp dword ptr [esp+10]
Back to top
View user's profile Send private message
Ejay1984
Newbie cheater
Reputation: 0

Joined: 16 Nov 2017
Posts: 24

PostPosted: Sun Dec 03, 2017 10:21 am    Post subject: Reply with quote

Zanzer wrote:
Well, I'm not sure what the game then does with [esp+10].
Maybe it doesn't store that back into your address?
Could try adding a FST.
Code:
  fld dword ptr [ecx+10]
  fadd dword ptr [var]
  fst dword ptr [ecx+10]
  fstp dword ptr [esp+10]


I've tried it but it took my hero off screen. Could it be that I'd need to do an AOB to another opcodes accessed by the address. I got about 15 addresses and I used one that looked like it was the right one and had nothing accessing it.
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Sun Dec 03, 2017 11:00 pm    Post subject: Reply with quote

nothing accessing it?
then i dont believe its the right one!

havent you tried to modify the value before picking it up, just do it test these addresses til you find the right one.

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
Ejay1984
Newbie cheater
Reputation: 0

Joined: 16 Nov 2017
Posts: 24

PostPosted: Mon Dec 04, 2017 12:55 am    Post subject: Reply with quote

OldCheatEngineUser wrote:
nothing accessing it?
then i dont believe its the right one!

havent you tried to modify the value before picking it up, just do it test these addresses til you find the right one.


My apologies, I should've said one address was accessing it. The other addresses had a few number accessing it so I'll try them.
Back to top
View user's profile Send private message
Betcha
Expert Cheater
Reputation: 4

Joined: 13 Aug 2015
Posts: 232
Location: Somewhere In Space

PostPosted: Mon Dec 04, 2017 5:07 am    Post subject: Reply with quote

How about adding globalalloc and edit Y value manually with hotkeys?
Should be able to control the height if add Increase Decrease hotkeys.
Back to top
View user's profile Send private message
Ejay1984
Newbie cheater
Reputation: 0

Joined: 16 Nov 2017
Posts: 24

PostPosted: Mon Dec 04, 2017 1:26 pm    Post subject: Reply with quote

Betcha wrote:
How about adding globalalloc and edit Y value manually with hotkeys?
Should be able to control the height if add Increase Decrease hotkeys.


My apologies I'm not familiar with the globalalloc command, other than it being related to alloc
Back to top
View user's profile Send private message
Betcha
Expert Cheater
Reputation: 4

Joined: 13 Aug 2015
Posts: 232
Location: Somewhere In Space

PostPosted: Mon Dec 04, 2017 4:32 pm    Post subject: Reply with quote

aobscanmodule(Airwalk,ShovelKnight.exe,D9 41 10 D9 5C 24 10 D9 44 24 14 D9 5C 24 78)
alloc(newmem,$1000)
alloc(var,1000)
globalalloc(ValueY,8) // add this line

And your original code is fld dword ptr [ecx+10]
Write above it mov [ValueY],ecx

Then Add address manually by checking pointer, write in there ValueY offset 10.
Once script is active it should generate Y value for you on pointer you just made.
Add increase and decrease value hotkeys and see if can control manually your height.
Back to top
View user's profile Send private message
Ejay1984
Newbie cheater
Reputation: 0

Joined: 16 Nov 2017
Posts: 24

PostPosted: Tue Dec 05, 2017 3:01 am    Post subject: Reply with quote

Betcha wrote:
aobscanmodule(Airwalk,ShovelKnight.exe,D9 41 10 D9 5C 24 10 D9 44 24 14 D9 5C 24 7Cool
alloc(newmem,$1000)
alloc(var,1000)
globalalloc(ValueY,Cool // add this line

And your original code is fld dword ptr [ecx+10]
Write above it mov [ValueY],ecx

Then Add address manually by checking pointer, write in there ValueY offset 10.
Once script is active it should generate Y value for you on pointer you just made.
Add increase and decrease value hotkeys and see if can control manually your height.


Would I still need the air_walk label?
Back to top
View user's profile Send private message
Betcha
Expert Cheater
Reputation: 4

Joined: 13 Aug 2015
Posts: 232
Location: Somewhere In Space

PostPosted: Tue Dec 05, 2017 3:45 am    Post subject: Reply with quote

You can leave everything as it is, just add that globalalloc in there.
Pointer you make will show in table whats going on with your Y value.
From there can optimize script, or disable var who adds float 15.
And do same manipulation with hotkeys on exact value of coordinate Y.


Last edited by Betcha on Fri Jan 26, 2018 8:46 am; edited 1 time in total
Back to top
View user's profile Send private message
Ejay1984
Newbie cheater
Reputation: 0

Joined: 16 Nov 2017
Posts: 24

PostPosted: Tue Dec 05, 2017 8:02 am    Post subject: Reply with quote

Thanks a lot Very Happy , much appreciated
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 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