Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Las0mbra
Cheater
Posts: 32 Joined: Fri Mar 17, 2017 10:53 am
Reputation: 11
Post
by Las0mbra » Thu Nov 16, 2017 3:08 pm
The script appears to work as it should but I have just a bit of experience with lua and almost no experience using it in CE.
So if anyone has the time to look it over I'd appreciate it.
The "bpointer" was found using a AA script beforehand.
Code: Select all
[ENABLE]
{$lua}
errorOnLookupFailure(false)
isAlly = "[bpointer]+30"
maxTroops = "[bpointer]+38"
curTroops = "[bpointer]+3C"
function GodMode()
unitAlly = readBytes(isAlly, 1)
unitMaxTroops = readInteger(maxTroops)
unitCurTroops = readInteger(curTroops)
if (unitAlly and unitMaxTroops and unitCurTroops) then
if (unitAlly == 1)
then writeInteger(curTroops, unitMaxTroops)
end
end
end
RepeatTimer = createTimer(nil,true)
RepeatTimer.Interval = 250
RepeatTimer.onTimer = GodMode
{$asm}
[DISABLE]
{$lua}
RepeatTimer.enabled = false
{$asm}
seikur0
Code Alchemist
Posts: 438 Joined: Sat Aug 26, 2017 10:48 am
Reputation: 344
Post
by seikur0 » Thu Nov 16, 2017 5:03 pm
Seems good, though you could probably do it with autoassembler instead of lua in a much easier way by finding some code that's accessing the current troops and injecting there.
Las0mbra
Cheater
Posts: 32 Joined: Fri Mar 17, 2017 10:53 am
Reputation: 11
Post
by Las0mbra » Thu Nov 16, 2017 8:52 pm
seikur0 wrote: ↑ Thu Nov 16, 2017 5:03 pm
Seems good,
Thanks for looking it over. I'm glad there is nothing major wrong with it.
seikur0 wrote: ↑ Thu Nov 16, 2017 5:03 pm
though you could probably do it with autoassembler instead of lua in a much easier way by finding some code that's accessing the current troops and injecting there.
Yeah probably. At the time lua seemed easier to figure out.
seikur0
Code Alchemist
Posts: 438 Joined: Sat Aug 26, 2017 10:48 am
Reputation: 344
Post
by seikur0 » Thu Nov 16, 2017 9:16 pm
One thing that came to mind just now: You should delete the timer object in your disable section with RepeatTimer.destroy().
Las0mbra
Cheater
Posts: 32 Joined: Fri Mar 17, 2017 10:53 am
Reputation: 11
Post
by Las0mbra » Thu Nov 16, 2017 10:16 pm
Replaced the RepeatTimer.enabled = false with RepeatTimer.destroy(). Thanks.
Users browsing this forum: No registered users