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 


Auto-multiply adress value?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
squerol
Advanced Cheater
Reputation: 2

Joined: 06 Jul 2015
Posts: 65
Location: Poland

PostPosted: Thu Jul 06, 2017 1:30 pm    Post subject: Auto-multiply adress value? Reply with quote

Hey.
I have a small question.
The situation looks like that - I'm messing with some cRPG game (TES IV : Oblivion), I've found wanted by me "attack speed multiplier".

The dissapointing thing is, that the value of this multiplier is dependent on which weapon type player uses - for example, iron dagger have attack speed multiplier 1.4 float, iron warhammer 0.7 float, iron longsword 1.0 float, bare hands 1.0 float etc.

It's not global multiplier which multiply Your attack speed no matter which weapon You are using.

What I want to do is to multiply any weapon type attack speed value by 0.5 automatically, no matter what value I will set.

For example, when I equip iron dagger with 1.4 multiplier I want to Cheat Engine multiply that value *0.5 and set it automatically (0.7 value so). I have 0.7 with dagger, ok, nice, I will equip iron longsword then, I will get 0.5 value (1.0*0.5) and so on...

Basically I would like to it work like that - no matter what float value is set to choosen adress, it will be automatically multiplied *0.5 after setting it.

Is something like that possible in lua for example, or maybe some different trick will work here?

Thank You.

_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Thu Jul 06, 2017 1:45 pm    Post subject: Reply with quote

what i understood is you want every weapon have a speed of 0.5

i do believe its possible to modify that instruction and make it write 0.5 for every weapon you use.

i never went into this type of cheats. (weapons attack speed).
but still modifying the instruction should do the work

_________________
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
squerol
Advanced Cheater
Reputation: 2

Joined: 06 Jul 2015
Posts: 65
Location: Poland

PostPosted: Fri Jul 07, 2017 12:55 pm    Post subject: Reply with quote

OldCheatEngineUser wrote:
what i understood is you want every weapon have a speed of 0.5

i do believe its possible to modify that instruction and make it write 0.5 for every weapon you use.

i never went into this type of cheats. (weapons attack speed).
but still modifying the instruction should do the work


No.

The adress found by me store attack speed value.

Different weapon sets different value in this adress - if I equip Longsword, there is 1.0 value. If I equip Warhammer, there is 0.7 value.

I want the value in this adress be always multiplied by 0.5 (or divided by 2, same is) - I don't want same 0.5 value all time as You though. I just want to made every waepon attack speed 2x slower with that.

About instructions...

Code:

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

newmem: //this is allocated memory, you have read,write,execute access
//place your code here

originalcode:
fstp dword ptr [edi+000000C0]

exit:
jmp returnhere

"Oblivion.exe"+1FE09C:
jmp newmem
nop
returnhere:


I've found "what writes to this adress", gone to "show dissasembler" and them "ctrl+a" on it and then "template" - > "code injection"

So now, can I somehow edit code so the value will be always multiplied x0.5?

I've tried searching internet for solution but no success.

Or maybe somehow by lua it's possible, for example something like that:

if adress value with description "attack_speed" is bigger than -777 then multiply x0.5? Is that possible? So it will multiply only once, when adress value is changed when I switch weapon in game? Not looping when value is unchanged, only when game triggers value change when I switch weapon in game.

Thanks.

_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Fri Jul 07, 2017 1:21 pm    Post subject: This post has 1 review(s) Reply with quote

there must be
fsub dword ptr [edi+c0]

assemble this instruction and add this
push esi
mov esi,(float)500 // you can change this
idiv esi:[edi+c0]
mov [edi+c0],esi
pop esi

NOTE:
my code have bugs. so it might give you a favorable result and might not.

_________________
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
squerol
Advanced Cheater
Reputation: 2

Joined: 06 Jul 2015
Posts: 65
Location: Poland

PostPosted: Fri Jul 07, 2017 3:00 pm    Post subject: This post has 1 review(s) Reply with quote

OldCheatEngineUser wrote:
there must be
fsub dword ptr [edi+c0]

assemble this instruction and add this
push esi
mov esi,(float)500 // you can change this
idiv esi:[edi+c0]
mov [edi+c0],esi
pop esi

NOTE:
my code have bugs. so it might give you a favorable result and might not.


Oh nice, Thank You for code.
Anyway, game crashes when I try to change weapon in game.

Or I'm just copy-pasting it in wrong place?

Can be a dumb question.... but were to place Your code? Just under newmem and execute it or where?

Tried under newmem, tried under originalcode, tried fsub dword ptr [edi+c0] separately under originalcode and rest of Your code under newmem and vice versa...

_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Fri Jul 07, 2017 3:35 pm    Post subject: Reply with quote

the injection point should be on fsub
and the code should be under newmem
it also should work without crashing your game (not for every game of course)

i apologize if i couldnt help you much.

question:
did you got the result as you wished?

_________________
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
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Fri Jul 07, 2017 6:43 pm    Post subject: This post has 1 review(s) Reply with quote

Code:
[ENABLE]
alloc(newmem,2048)
alloc(wpnSpdMult,4)
label(returnhere)

newmem:
  fmul [wpnSpdMult]
  fstp dword ptr [edi+000000C0]
  jmp returnhere

wpnSpdMult:
  dd (float)0.5

"Oblivion.exe"+1FE09C:
  jmp newmem
  nop
returnhere:

[DISABLE]
dealloc(newmem)
dealloc(wpnSpdMult)

"Oblivion.exe"+1FE09C:
  db D9 9F C0 00 00 00

File -> Assign to current cheat table

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
squerol
Advanced Cheater
Reputation: 2

Joined: 06 Jul 2015
Posts: 65
Location: Poland

PostPosted: Sat Jul 08, 2017 1:18 am    Post subject: Reply with quote

OldCheatEngineUser wrote:
the injection point should be on fsub
and the code should be under newmem
it also should work without crashing your game (not for every game of course)

i apologize if i couldnt help you much.

question:
did you got the result as you wished?


Sorry, still crashing.
But no need to apologize Wink

ParkourPenguin wrote:
Code:
[ENABLE]
alloc(newmem,2048)
alloc(wpnSpdMult,4)
label(returnhere)

newmem:
  fmul [wpnSpdMult]
  fstp dword ptr [edi+000000C0]
  jmp returnhere

wpnSpdMult:
  dd (float)0.5

"Oblivion.exe"+1FE09C:
  jmp newmem
  nop
returnhere:

[DISABLE]
dealloc(newmem)
dealloc(wpnSpdMult)

"Oblivion.exe"+1FE09C:
  db D9 9F C0 00 00 00

File -> Assign to current cheat table


Oh, Thank You very much, it works perfect, as intended!

Solved!

_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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