View previous topic :: View next topic |
Author |
Message |
eXistensial Warlock How do I cheat? Reputation: 0
Joined: 20 Dec 2018 Posts: 2 Location: Chicago, IL
|
Posted: Thu Dec 20, 2018 2:04 pm Post subject: Multiply a value upon increase |
|
|
Hey guys. I did an hour of googling before coming here so sorry if this has been asked before.
I'd like to set up a script that will increase the rate of experience gained in a game. Experience is stored as a 4 Byte variable.
Is there a way to compare the previous value with the new one, then multiply the difference, and add that to the new value? In this case, I would like to double the amount of experience gained, so I suppose simply being able to find the difference and adding it to the new value again would do the trick.
Thanks in advance.
P.S. I am not positive whether or not experience increments until it reaches the new value, or if the change in the variable is instantaneous. I would imagine this could cause complications if it did increment until the "gained" experience is depleted, especially if the script applies every time the experience value is changed. The change appears instant, but I'd have to play further into the game to see bigger experience values before I could really tell a difference.
---
I've used Cheat Engine for years now to do simple variable edits, but nothing too much more complicated than finding and editing values like money and experience. I haven't touched any scripting.
If there's a tutorial out there that will handle what I'm trying to accomplish, I'd be glad to take a look at that as well!
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4300
|
Posted: Thu Dec 20, 2018 3:02 pm Post subject: |
|
|
Using AA to inject code would likely be best (see step 7 "Code Injection" of the CE tutorial), but Lua can do what you're asking.
Code: | local oldv = tonumber(AddressList.getMemoryRecordByDescription'My Experience'.Value)
local t = createTimer()
t.Interval = 200
t.OnTimer = function(t)
local mr = AddressList.getMemoryRecordByDescription'My Experience'
if not mr then t.destroy(); return end
local v = tonumber(mr.Value)
if v - oldv > 0 then -- increased
oldv = 2*v - oldv
mr.Value = tostring(oldv)
elseif v - oldv < 0 then -- decreased
oldv = v
end
end | edit: removed print
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Last edited by ParkourPenguin on Thu Dec 20, 2018 5:33 pm; edited 1 time in total |
|
Back to top |
|
|
eXistensial Warlock How do I cheat? Reputation: 0
Joined: 20 Dec 2018 Posts: 2 Location: Chicago, IL
|
Posted: Thu Dec 20, 2018 4:56 pm Post subject: |
|
|
Hey, this looks like what I'm looking for. Thanks a bunch!
|
|
Back to top |
|
|
u2l How do I cheat? Reputation: 0
Joined: 20 Jun 2020 Posts: 8
|
Posted: Mon Jun 22, 2020 3:32 am Post subject: |
|
|
ParkourPenguin wrote: | Using AA to inject code would likely be best (see step 7 "Code Injection" of the CE tutorial), but Lua can do what you're asking.
Code: | local oldv = tonumber(AddressList.getMemoryRecordByDescription'My Experience'.Value)
local t = createTimer()
t.Interval = 200
t.OnTimer = function(t)
local mr = AddressList.getMemoryRecordByDescription'My Experience'
if not mr then t.destroy(); return end
local v = tonumber(mr.Value)
if v - oldv > 0 then -- increased
oldv = 2*v - oldv
mr.Value = tostring(oldv)
elseif v - oldv < 0 then -- decreased
oldv = v
end
end | edit: removed print |
I'm using your code and it works, but is there a way to do this for multiple characters?. I try messing around with the code and just create "My Experience2", "My Experience3" for my other characters but sometimes it would work for 2 of them, most of the time only 1 is getting the multiplied exp. if there is a better way, would you lay down the foundation so I can plug in the numbers?. I don't have any coding experience so plz be specific with the instruction if you can. thank you
right now my code looks something like this. it looks dumb since I'm just making it up by tripling everything base on your code
local oldv = tonumber(AddressList.getMemoryRecordByDescription'Brooklyn Luckfield x5 exp'.Value)
local oldvmain = tonumber(AddressList.getMemoryRecordByDescription'main char x5 exp'.Value)
local oldvcute = tonumber(AddressList.getMemoryRecordByDescription'cute chick xp x5'.Value)
local t = createTimer()
t.Interval = 200
t.OnTimer = function(t)
local mr = AddressList.getMemoryRecordByDescription'Brooklyn Luckfield x5 exp'
local mrmain = AddressList.getMemoryRecordByDescription'main char x5 exp'
local mrcute= AddressList.getMemoryRecordByDescription'cute chick xp x5'
if not mr then t.destroy(); return end
if not mrmain then t.destroy(); return end
if not mrcute then t.destroy(); return end
......
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Mon Jun 22, 2020 5:35 am Post subject: |
|
|
[quote="u2l"]
Quote: | I'm using your code and it works, but is there a way to do this for multiple characters?. I try messing around with the code and just create "My Experience2", "My Experience3" for my other characters but sometimes it would work for 2 of them, most of the time only 1 is getting the multiplied exp. if there is a better way, would you lay down the foundation so I can plug in the numbers?. I don't have any coding experience so plz be specific with the instruction if you can. thank you |
Maybe something like this ..
Code: | function ExpHack(Name1, multiplier)
multiplier = tonumber(multiplier)
local oldv1 = AddressList.getMemoryRecordByDescription(Name1)
oldv = tonumber(oldv1.Value)
--print(oldv)
local t = createTimer()
t.Interval = 200
t.OnTimer = function(t)
local mr = AddressList.getMemoryRecordByDescription(Name1) --'My Experience'
if not mr then t.destroy(); return end
local v = tonumber(mr.Value)
if v - oldv > 0 then -- increased
oldv = multiplier * v - oldv
mr.Value = tostring(oldv)
-- print(v.." - "..oldv)
t.destroy()
elseif v - oldv < 0 then -- decreased
oldv = v
-- print(v.." - "..oldv)
t.destroy()
end
end
end
ExpHack("My Experience", 2)
ExpHack("My Experience1", 4) |
_________________
|
|
Back to top |
|
|
u2l How do I cheat? Reputation: 0
Joined: 20 Jun 2020 Posts: 8
|
Posted: Mon Jun 22, 2020 12:57 pm Post subject: |
|
|
thank you for taking your time to help me with the coding, I was wondering how to modify exp for player 2,3 .... from your code, do I repeat all the codes above for player 2 after the end function?
again, I apologize if the answer is something obvious, I'm pretty clueless with these stuff ^^!
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Tue Jun 23, 2020 7:03 am Post subject: |
|
|
u2l wrote: | .... from your code, do I repeat all the codes above for player 2 after the end function? |
I just saw the solution code assigned to the topic and provided by @ParkourPenguin.
I have arranged for more than one player.
For example, you can assign the same code to the "Button Click" event for 3 players.
Sample;
Code: | UDF1.CEButton1.OnClick=function()
ExpHack("My Experience", 2)
end
UDF1.CEButton2.OnClick=function()
ExpHack("My Experience1", 2)
end
UDF1.CEButton3.OnClick=function()
ExpHack("My Experience2", 2)
end |
You can also give a follow-up and print the changes.
It has been added to the following code;
Code: | print("increased: "..v.." - "..oldv.." - "..Name1) |
Code: | function ExpHack(Name1, multiplier)
multiplier = tonumber(multiplier)
local oldv1 = AddressList.getMemoryRecordByDescription(Name1)
oldv = tonumber(oldv1.Value)
--print(oldv)
local t = createTimer()
t.Interval = 200
t.OnTimer = function(t)
local mr = AddressList.getMemoryRecordByDescription(Name1) --'My Experience'
if not mr then t.destroy(); return end
local v = tonumber(mr.Value)
if v - oldv > 0 then -- increased
oldv = multiplier * v - oldv
mr.Value = tostring(oldv)
print("increased: "..v.." - "..oldv.." - "..Name1)
t.destroy()
elseif v - oldv < 0 then -- decreased
oldv = v
print("decreased: "..v.." - "..oldv.." - "..Name1)
t.destroy()
end
end
end
function Exp1()
ExpHack("My Experience", 2)
end
function Exp2()
ExpHack("My Experience1", 2)
end
htk1=createHotkey(Exp1, VK_F8)
htk2=createHotkey(Exp2, VK_F9) |
_________________
|
|
Back to top |
|
|
u2l How do I cheat? Reputation: 0
Joined: 20 Jun 2020 Posts: 8
|
Posted: Sat Jun 27, 2020 9:50 am Post subject: |
|
|
ty once again, I haven't tried using it but will do soon. Hopefully I'll get it to work!
|
|
Back to top |
|
|
u2l How do I cheat? Reputation: 0
Joined: 20 Jun 2020 Posts: 8
|
Posted: Sun Jun 28, 2020 1:32 pm Post subject: |
|
|
I can't get your code to work after playing around with it, it's most probably my fault for not knowing how to use it properly. I'm not sure what's suppose to go in the "..." of the "..v.." , if anything at all.
I suppose the fastest way you could help me out is this:
Let's say I'v found 2 addresses, I name them "main character" and "boss"
Could you plug in the names in the above code, give main character x2 exp and boss x4 exp?
I guess it's gotta be that specific for me to replicate it for other games ><
again, thank you for your trouble.
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Sun Jun 28, 2020 4:20 pm Post subject: |
|
|
u2l wrote: | I name them "main character" and "boss"
Could you plug in the names in the above code, give main character x2 exp and boss x4 exp? |
Code: | ExpHack("main character", 2)
ExpHack("boss", 4) |
_________________
|
|
Back to top |
|
|
u2l How do I cheat? Reputation: 0
Joined: 20 Jun 2020 Posts: 8
|
Posted: Sun Jun 28, 2020 10:10 pm Post subject: |
|
|
I get this error when trying to execute the script, could there be something wrong with the code?
EDIT: I tried your earlier code and it works, however it seems only the first player get the multiplier but not second player, I have changed the value in the address manually to confirm that it's the right one. so in the attached picture (but applied for earlier code), Marica doesn't get the multiplier, only Pan.
Description: |
|
Filesize: |
546.36 KB |
Viewed: |
8839 Time(s) |
|
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Mon Jun 29, 2020 3:49 am Post subject: |
|
|
I think you are right.
For multiple players, it uses focus.
The code below focuses on the player you want to follow and upgrade.
Sample; Click "F8" to follow and upgrade the "Pan" player.
To return to the "Marica" player, click "F9".
Code: | function ExpHack(Name1, multiplier)
multiplier = tonumber(multiplier)
local oldv1 = AddressList.getMemoryRecordByDescription(Name1)
oldv = tonumber(oldv1.Value)
print(Name1.." - "..oldv)
local t = createTimer()
t.Interval = 200
t.OnTimer = function(t)
local mr = AddressList.getMemoryRecordByDescription(Name1) --'My Experience'
if not mr then t.destroy(); return end
local v = tonumber(mr.Value)
if v - oldv > 0 then -- increased
oldv = multiplier * v - oldv
mr.Value = tostring(oldv)
print("increased: "..v.." - "..oldv.." - "..Name1)
t.destroy()
Name1=""
elseif v - oldv < 0 then -- decreased
oldv = v
print("decreased: "..v.." - "..oldv.." - "..Name1)
--t.destroy()
Name1=""
end
end
end
--ExpHack("Pan", 2)
--ExpHack("Marica", 2)
function Exp1()
ExpHack("Pan", 2)
end
function Exp2()
ExpHack("Marica", 2)
end
if htk1 then htk1.destroy() end
if htk1 then htk2.destroy() end
htk1=createHotkey(Exp1, VK_F8)
htk2=createHotkey(Exp2, VK_F9) |
_________________
|
|
Back to top |
|
|
u2l How do I cheat? Reputation: 0
Joined: 20 Jun 2020 Posts: 8
|
Posted: Thu Jul 02, 2020 5:24 am Post subject: |
|
|
hey just wanna say thank you for the prompt replies and help, exp multiplier for 1 character is fine. I have this really weird way of wanting to play any new games on highest difficulty but not having to do the grind. giving some of my characters 3x exp usually does the trick for me. it probably makes the game unbalance for sure but that's just how I like to play lol.
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1260
|
Posted: Thu Jul 02, 2020 7:49 am Post subject: |
|
|
u2l wrote: | hey just wanna say thank you for the prompt replies and help, exp multiplier for 1 character is fine. I have this really weird way of wanting to play any new games on highest difficulty but not having to do the grind. giving some of my characters 3x exp usually does the trick for me. it probably makes the game unbalance for sure but that's just how I like to play lol. |
Nice idea @u2l ..
Don't stop cheating.
You will probably spend more time with codes while cheating.
This will familiarize you with the codes.
In fact, CE is a fun tool to bring you closer to these codes.
_________________
|
|
Back to top |
|
|
|