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 


I need help with this loop script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Yuno Gasai
How do I cheat?
Reputation: 0

Joined: 24 Feb 2016
Posts: 3
Location: Japan

PostPosted: Wed Feb 24, 2016 7:41 pm    Post subject: I need help with this loop script Reply with quote

I'm making this script for Dark Souls.

So I've found the current health and max health using pointer scan.

ActHP gives me a nil error

This is my script:

Code:
 timer = createTimer(nil, true)
timer_setInterval(timer, 100)

function HP_Regen()
if (getOpenedProcessID() ~= 0) then
local ActHP = readInteger('[[[[["DARKSOULS.exe"+00EE29E8]+2d4]+f8]+2c0]+28]+0')
local MaxHP = readInteger('[["DARKSOULS.exe"+00F78700]+14]+8')
if (ActHP ~= nil) and (MaxHP ~= nil) then
if (ActHP < MaxHP) then
writeInteger(ActHP, MaxHP)
end
end
end
end

timer_onTimer(timer, HP_Regen)
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Feb 24, 2016 8:12 pm    Post subject: Reply with quote

Code:
writeInteger('[[[[["DARKSOULS.exe"+00EE29E8]+2d4]+f8]+2c0]+28]+0', MaxHP)
Back to top
View user's profile Send private message
Yuno Gasai
How do I cheat?
Reputation: 0

Joined: 24 Feb 2016
Posts: 3
Location: Japan

PostPosted: Wed Feb 24, 2016 8:16 pm    Post subject: Reply with quote

Why can't I just do

Code:
writeInteger(ActHP, MaxHP)
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Feb 24, 2016 8:27 pm    Post subject: Reply with quote

Based on your code, it looks like ActHP is your current health, not the address where your current health is stored.
First parameter to writeInteger() needs to be an address where you wish to write the value.
Back to top
View user's profile Send private message
Yuno Gasai
How do I cheat?
Reputation: 0

Joined: 24 Feb 2016
Posts: 3
Location: Japan

PostPosted: Wed Feb 24, 2016 8:49 pm    Post subject: Reply with quote

Oh thank you for explaining it to me Very Happy
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 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