In this video, I teach you how to code a game trainer in Lua from scratch using Cheat Engine's built-in tools. I kept in some of my thinking along the way and parts I probably would have otherwise edited out, but I thought those parts might come in handy for some of you. You can download the trainer and .CT from my GitHub: github.com/dsasmblr/KZbin-Tutorial-Files (And, yes, I know the sound of the keyboard strokes are out of sync with the video. It's an issue I'm working on with my video/audio recording software.)
@StephenChapman5 жыл бұрын
@Krojza Novic It will presumably work for any game you've been able to create a hack for!
@zafiralpstv80044 жыл бұрын
You put so much effort in you'r videos like nobody else on YT. Big thanks for that
@NightFyreTV3 жыл бұрын
You have no idea how much I appreciate you for having made this video tutorial. Thank you very much :)
@LastRoze5 жыл бұрын
Yoooo thanks man been looking clear tutorial for LUA, you're the best !
@userPrehistoricman5 жыл бұрын
Lua
@yorzengaming5 жыл бұрын
Actually watched a 1 hour video which was great!
@auxsyo4 жыл бұрын
lol I didn't even know the length of the video until I saw that...
@hodayfa000h Жыл бұрын
actually 1 hour feels like nothing when watching tutorials on cheat engine but on anything else IT IS LITERALLY DAYS also the reason i don't watch all videos that are 1 hour long is because literally i can't watch that many videos at max 12 video*which is not that much if you think about it and how you will get bored fast and how i am replying to a 3 year old computer
@trif1692 жыл бұрын
Great video man especially for myself starting out with cheat engine and using lua scripts I'm finding myself having a lot of fun realising what I can actually do with this information. Thanks again!
@270jonp5 жыл бұрын
Wish I had this when i first started. Amazing work.
@chrisfayte84825 жыл бұрын
Awesome bro I look forward to this, thank you !!! =)
@StephenChapman5 жыл бұрын
Hopefully it's not too boring for you! Just thought it might be a nice addition to the Lua trainer topic between all our channels. =)
@chrisfayte84825 жыл бұрын
@@StephenChapman Bro not at all, this information is absolute gold. Thank you for your hard work on this, great job pal!! Epic sneeze btw lol =)
@StephenChapman5 жыл бұрын
I was like, "How can I have fun with that instead of editing it out?" Lol. Thanks for your feedback, pal! I appreciate it. :)
@cheatstrainers46655 жыл бұрын
Great video bro, you done a great job. I've been learning some lua myself so was easier to understand. 👍
@StephenChapman5 жыл бұрын
Thanks, pal! Glad you found it easier to understand. Lua itself is pretty easy to wrangle it; it's learning all of CE's terminology and semantics that makes it really tough to use in this context. Or at least that's what I came to realize for myself after a certain point!
@byteninja37455 жыл бұрын
OH YEAH, once again you prove to be the man. Since I did the scripts for fatalities in mk9 I was looking for a way to auto disable the script and you have given me that, thank you pal, the final piece of the jigsaw is in place. Thank you for an awesome video my friend.
@StephenChapman5 жыл бұрын
So glad it helped you, pal! Hopefully I'll find more stuff to do Lua-based videos on and be of even more help. =)
@squall08335 жыл бұрын
so, your sneeze was too strong and shakes ur screen? :D
@greatbullets58604 жыл бұрын
LMAO
@fauzanelka2 жыл бұрын
Thanks for the tutorial! Btw could u please next time to increase the font size. It's so difficult to see in smaller screen
@Mythtician2 жыл бұрын
Agreed, I can't even see it. They should of remade this one instead of Assault Cube. Their was nothing wrong with their original video.
@Lucasbc5 ай бұрын
Very valuable content, thank you
@Uri73375 жыл бұрын
Love your vids
@voiduzumaki260329 күн бұрын
Your brain really got fried there at the end - it would be = and it would have been easier to say that: if ( playerHealth > maxHealth) then playerHealth = maxHealth end and then the writing health. This way, if you have 145 + 10 =155 > 150, you would still get the 5 missing HP and the yellow just mean something was changed.
@ScarlettesFuneral5 жыл бұрын
If you download and try to use his open the CT then edit the script and changed +510 where he defines INJECT to 50C and it'll work fine again
@ScarlettesFuneral5 жыл бұрын
Then re generate the trainer exe and fixed completely
@hodayfa000h Жыл бұрын
@@ScarlettesFuneral isn't that the same but in HEX?
@rudigonzalez14515 жыл бұрын
I still like to watch time to time a recap of ur vids stephen.. You and Chris need to do something together mate, like a Diplomate or Master degree. Really think about it. I cannot think in better teachers than u guys even if u add those crazies of guided hacking, what an exorbitant university!!! It will be like having Jesus and Zeus on your team to fight evil 😂 😂 . Anyway, cheers mate, waiting the notification for upcoming vids
@Waruh Жыл бұрын
Do you have any other tutorials regarding Define & Assert?
@rubbercable2 жыл бұрын
Great Video. Resolution is a little blurry tho. Can you explain why some scripts have a 'base' tickbox to acquire base addresses.
@sorynthian10885 жыл бұрын
okay so ive done everything the same way you did, however... whenever i open and close the trainer, despite the script 'isEnabled = 0' in line 1, if i click the check box, it basically does the opposite action. however if i execute the script after retyping it, it works normally. how do i make the script properly function every time i start the trainer? ive cycled through several different save types and generations etc.. it always end up the same way on a relaunch. and my sequence is EXACTLY the same as yours, only replaced for my specific situation where instead of 4Bytes my values are Floats and i replaced "Integer" properly with readFloat and writeFloat. and of course my names are different because im changing the shield value rather than health. i have both the max shield pointer and shield value fill pointer available in my table so i can up the max shield and at the same time, fill it in press of the button. hence why the "+ 400000" isEnabled = 0 function CETrainer_SHButtonClick(sender) if ( isEnabled == 1 ) then --Read pShield local playerShield = readFloat("[pShield]+A0") + 400000 --Write pShield writeFloat("[pShield]+A0", playerShield) end end function CETrainer_CECheckbox1Click(sender) local script = getAddressList() script = script.getMemoryRecordByDescription("Player Shield Script test") if ( isEnabled == 0 ) then script.Active = true isEnabled = 1 else script.Active = false isEnabled = 0 end end lines 1 through 21... its confused the fuck out of me considering the trainer works perfectly fine other than this very issue LOL.
@ScarlettesFuneral5 жыл бұрын
Try generating it out as a trainer (if you made it that way) might fix it might not I'm not sure lol it fixed mine tho
@SleppySnek5 жыл бұрын
Hey nice tutorial, I've been wondering about this stuff! The only thing I still can't figure out is how I can call a lua script from assembly. I've been playing around in Shogun 2, but it has some kind of debugger protection I just can't figure out how to get around. So my idea was to instead of "find out what other addresses this accesses" to make a lua script where I create a new address in cheat engine for each address a certain function accessed (up to a max of 10 so I can just compare structures them later and differentiate myself from AI players). I have the lua script and I know where to put the assembly, but I can't for the life of me make the call to the lua function. With this video I see this is also where we differ quite a bit in our way of making things work. Usually I'd go for a user friendly interface. Checking the script would be worked in the code so the user wouldn't have to worry about checkboxes being activated or not. (though I guess you might have done it this way so the video wouldn't end up 10 hours long explaining everything) I also prefer doing the calculations when writing the value instead of when assigning the variable like you did with playerHealth. In this case it doesn't matter at all, but in bigger pieces of code if you later expand on the function you could end up using the playerHealth variable further down thinking it's your actual health, while you already added +10 to it from the beginning. (again, this could also just be for convenience sake on your part) Anyway, thanks for the video, I definitely learned a few things here!
@StephenChapman5 жыл бұрын
Look into luaCall(). As for debug, did you try performing a break/trace (with step-over toggled on) on data access of X address? Should show you where in execution the crash seems to happen. If it's not too complex, you can try replacing CALLs with NOPs up the flow of execution found via break/trace. And you're correct that this video isn't intended to be exemplary of my coding abilities/habits or best practices.
@SleppySnek5 жыл бұрын
@@StephenChapman Thanks for the reply! I did try luaCall(), but I couldn't get it to do the actual call, nothing happens when I do. But I'll give it another shot later, maybe I missed something. As for the debugging, I can find where the crash occurs. I don't know if you've played Total War games before, so to give you some perspective, everything I do during my turn works just fine. I can debug, I can break and trace stuff, everything works. It's as soon as I click the "end turn" button and the AI is doing it's thing, that in some point during their turn the game crashes and only when the debugger is attached. I can detach the debugger and end my turn to keep the game running. But that does make finding some things a little difficult. (hence my lua attempts) From what I can tell, the code just happened to be somewhere in the middle of AI actions when the crash happens. It's as if a different thread is making a crash occur. If I NOP the calls I think I'll be skipping game functionality. Only one way to find out I guess. I have found calls to isDebuggerPresent, but NOP'ing that or forcing it to return false doesn't seem to work very well, I just crash faster. I'll try again, I'm certain this is possible. I just have to find it.
@FreeER5 жыл бұрын
@@SleppySnek To call lua from asm you have to setup a lua server thing with CE and call a function passing the lua script to run as a string (or I think there's another function that can parse/compile it and return an integer reference that can be passed, which is faster to call later). Here's an example I made a long time ago that just disables the memrec (of course the id for the script has to match), pastebin.com/QNxF86p0 There's a template for it just like with aobscans luaCall just does the same thing a {$lua} {$asm} block does which is run it when the script is enabled, more as a meta/macro feature. I think there's also an extension for CE that makes it a bit simpler to use as well, though I don't use it myself, mainly because I don't call lua from asm... yeah forum.cheatengine.org/viewtopic.php?t=607828 Presumably since the lua dll/engine is loaded and running in CE, the luaclient dll the template loads is just a way to communicate back and forth, so if you didn't need to do anything CE specific you could load the lua dll into the game and then use whatever the lua C api calls are from asm, and I imagine that CE's lua functions (eg. readInteger etc.) are in a dll that you might also be able to load into the process but that's going a lot further than I'd feel comfortable saying you can easily do without actually understanding everything involved lol (hm, maybe not, I'm not seeing one)
@userPrehistoricman5 жыл бұрын
Good video but how can you call the wiki a good resource? Last time I checked it had so much stuff missing. There's complete documentation in a text file in CE's installation directory called celua.txt
@StephenChapman5 жыл бұрын
Because it's gotten a lot better since then. And for the people this video is mainly geared towards, celua.txt is far too confusing to understand--not to mention convoluted. A giant text file? Lol. I've actually considered porting the information from that file into the wiki, but I just don't have time for that.
@LoganoutGm5 жыл бұрын
Hello, could you teach how to create a stylish trainer using CheckBox, Edit Value, etc.? I made a table where I modify the values to my preference. I wish I could have something like this to make editing these values easier in cheat. thks
@PumpiPie5 жыл бұрын
Still working on the camera tut :D And when you are going yo make the tut please use a game like FC5 or JC4 :D
@iiinsane45 жыл бұрын
I saw the terraria video and i had to ask will u make a video about the bug net script?
@infreezydark3 жыл бұрын
Such a good video, I just want to know if I use a static address that I found using pointer scanner instead of defining pHealth will it still work? also is registersymbol and unregistersymbol required? also can I delete return label since it's empty
@lollol-zk8dh4 жыл бұрын
Hey man, I was just wondering is it possible to spawn in items if you currently dont have it?
@leonbass32754 жыл бұрын
It's possible but very hard, easier to just swap one of the other item's ID value, stephen did make a video demonstrating his item spawner that he made
@michaelconroy3158 ай бұрын
Why not just disable the button until the checkbox is checked?
@Xt5gamerxX4 жыл бұрын
Great video! I was wondering, how do people let you set keybinds on the trainer?
@leto14493 жыл бұрын
in the hotkey tab
@bakarow13 жыл бұрын
Unrelated question: I wonder how you manage to balance between work, real life duties and game hacking (specially recording for youtube). Thank you.
@rigidhammer73767 ай бұрын
hi. pls tell me how you say 4 byte gap between health (hex 340) and max health (hex 33C)? you didnt mention how.
@leomon323 жыл бұрын
I did exactly what you did, I literally copy paste changing the values with the one for the game I wanted to hack, after tons of mistakes my code was accepted by Cheat Engine and it instantly crash the game... Is there a easy pointer tutorial like, I have the value, I can find it in memory but I want to share it to others so they don't have to do the research, is it possible T____T ?
@nurdon14 жыл бұрын
How to make Status "Games is Running" and Games Not Running" ...? May be call is Game Process Monitor... sory before for my bad english...
@LukeAvedon Жыл бұрын
Lua is so awesome.
@moneyboy5033 жыл бұрын
Hey, if you ever made an update to this video could you consider using the magnify tool at times? it's very hard to see
@cosmilitebar67722 жыл бұрын
Lets say i wanted to display the coordinates and view angles of my player in that gui. How would i do that? I cant find an event that triggers all the time to refresh those values. I can only get it to display the stuff i need on the press of an Button.
@StephenChapman2 жыл бұрын
Use a timer that you enable/disable! There are Lua timer examples on the Cheat Engine wiki. The idea is, while the timer is enabled/active, you watch the addresses of interest via read-based functions. You can output those values to your trainer however you choose. I also discuss this whole thing in my freecam videos.
@cosmilitebar67722 жыл бұрын
@@StephenChapman Thanks a lot. That was the solution. Also what could i try when the script activates just fine from the lua engine and from the adress list - but not from the generated .exe file? Is there something that can potentially break while doing that generation?
@ThatGuyNamedBender5 жыл бұрын
I know it's unrelated but how does your cheat engine have grey in the windows? All my windows are full white and it's an eyesore. I'd prefer the grey on white like your windows have but I can't find anywhere on google on how to do that
@StephenChapman5 жыл бұрын
I probably made slight UI changes in a script that I placed in my autorun folder.
@superguy6549 ай бұрын
If you were to enable the script via cheat engine first. Then generate the trainer would the trainer have that symbol to reference or would you need to enable the script via the trainer anyway?
@rigidhammer73767 ай бұрын
no. it should put all on the lua script of the trainer
@katsuyhahdy17375 жыл бұрын
Nice work 1 hours bung😂😁
@unknown-yo2tx3 жыл бұрын
when I find the addresses and search for what accesses the address nothing shows
@jonathanmedina6627 Жыл бұрын
How can I set a hotkey for a lua script? If button is pressed then check the box If button is pressed again uncheck the box
@hodayfa000h Жыл бұрын
this is late but i really want to know how to make the script work without clicking activate deactivate now i know how to program in lua but not in cheate engine lua how would i do that?
@dsilencio5175 жыл бұрын
Do you know how I can do various timer functions? Example: I have a client.exe program in it has a character, all functions must occur in parallel not sequentially in programming must be 100% timed without a game address and settings should only influence the client.exe program, so 1st function "start of function every 15 minutes must be executed or command corresponding to number 1 of end function keypad" 2nd "start of function every 7 min should be executed or execute command corresponding to number 2 of end function keypad" 3rd "start of function every 23 min must be executed or the command corresponding to number 3 of the keyboard with function" 4th "start of function every 15 min must be executed or the central command of the letter (A) of the keyboard and key A for the activated logo must be executed the D key command end of function "all must occur independently except the 4th function which must have 2 commands where one only happens after the other" , it is possible to make everyone work with a single timer within the 23 min limit where each function has its own pace limit and act in accordance with the master timer would be cool. If you don't know how to do it, tell me how I can get information to do at least that.
@future93885 жыл бұрын
this was excellent you should make a video game xD
@franciscoalmeida70174 жыл бұрын
I got the adress like you did and did everything but when I use writeInteger the value changes and it shows changed in game but when i go back to the game it resets to what it was. Did something change in terraria ?
@atultripathi91665 жыл бұрын
post a video on how to handle fld-like opcodes....what is that.....and how I can use it like mov,dec,inc,add....
@r4tb0y5 жыл бұрын
how can i call functions using mono dissector in CE? no option to call them appears when selecting them for me
@scrowfunk81094 жыл бұрын
i always thought a lot of the lua syntax was really dumb. it doesnt really make the code any cleaner to read and its all really arbitrary to the compiler.
@SamWinchester0075 жыл бұрын
Do you have a guide how to find HP value that is not in numbers. but like a red bar? I'm currently playing Elex, and I don't know how to create Inf HP.
@StephenChapman5 жыл бұрын
Start a search for an unknown value. Then try searching for increased/decreased as health increases/decreases. If that doesn't work, then changed/unchanged. With bars, values are commonly Float, but could still be 4 Byte (integer).
@SamWinchester0075 жыл бұрын
@@StephenChapman With your advice I manage to find three addresses. But their values are a lot of numbers that keep on changing every second. Not sure what to do now!
@ScormGaming5 жыл бұрын
@@SamWinchester007 Scan for ALL types, reduce integer size, or set to float. Alternatively you could divide your N bytes integer addresses into 2x N/2 bytes addresses and see if one of those makes sense, if not, repeat the process.
@MrXSharing_is_caring4 жыл бұрын
Hi, man i just found this now. i really like your video and the way you explain everything its really fun. but i want to know about infinite health when click the tooglebox it active. Please
@superdepressif60475 жыл бұрын
So this is what is called live reverse engineering in opposition to offline reverse engineering right?
@TeenNewsLive Жыл бұрын
Why not call the player base pointer pPlayer instead of pHealth?
@eluwave4 ай бұрын
thank you so much
@TReyeHD4 жыл бұрын
I'm curious. What does the +100 next to newmem stand for?
@StephenChapman4 жыл бұрын
It's an offset. The label "newmem" represents a specific memory address. Generally, to make our lives easier, we don't care what the actual address is. We just want to tell the computer to go reserve a place in memory that we can store data in, and whenever we say "newmem", the computer will know we mean to go reference wherever it reserved memory at for that label and/or symbol. An offset simply represents the number of addresses away from a specific memory address. So, if "newmem" represents address 7A66D880, then "newmem+100" would mean 7A66D880+100, which equals 7A66D980. All the same, if we said "newmem-100", that would be 7A66D880-100, which equals 7A66D780. But, again, to make our lives easier, we can just reference our label or symbol in the script and the computer will know what address that is. Then it will apply the offset to whatever that address happens to be!
@infreezydark3 жыл бұрын
@@StephenChapman if I want to define a new pointer pMana for example, is newmem+108 enough? since a pointer is most likely 32 or 64 bits
@hodayfa000h Жыл бұрын
@@infreezydark too late like really late useless but for others that come in the future, newmem is where you write your auto assembler script and new mem allocates 1000(or 2048) so really that doesn't matter if your auto assembler script isn't 100 opcodes long (or something of that kind)
@destro22453 жыл бұрын
You lost me there dude ...any idea how I can start to learn these stuff? (do I need to learn a certain programming language?) Cheat engine tutorial looks easy till you reach the pointers stage
@hodayfa000h Жыл бұрын
cheat engine auto assembler IS EASY
@djryu18462 жыл бұрын
is possible to create npc race script for f1 or forza horizon ?
@badcake49153 жыл бұрын
Do you know how to make free/easy crafting hack?
@Xt5gamerxX5 жыл бұрын
Hey! I was wondering how to freeze a value with lua. Feedback would be much appreciated! Grate video btw
@StephenChapman5 жыл бұрын
You either have to modify an instruction to always/never write a value, or write to a memory address of interest via a loop.
@BlindedByAnotherCat4 жыл бұрын
I'm still wondering how to make a trainer from Cheat Table that someone already make ._.
@leto14493 жыл бұрын
you learn by redoing
@rezar76234 жыл бұрын
i have a question can u hack a roblox game i will pay?
@josephlang25864 жыл бұрын
What is a trainer?
@StephenChapman4 жыл бұрын
A program that makes a game easier for you somehow. The name stems from back in the 90s when these types of programs were used to help you (jokingly) "train" to get good at a game. The name has stuck around ever since.
@khazi-D4 жыл бұрын
Hello, I have a question, can your trainer work independently cheat engine? or does cheat engine have to be running for it to work?
@ug76404 жыл бұрын
24:17 Gigantic option = trainer works independently Tiny = Cheat Engine should be installed and running
@sinan54884 жыл бұрын
can this work with garrys mod?
@onon18772 жыл бұрын
nice
@amhirmama14 күн бұрын
took so long to get +10 hp😭🙏
@rollo41275 жыл бұрын
farcry 4 don't like my pointer it close the game
@Anon208554 жыл бұрын
oh my god what the fuck ? of course this is so easy when you have the fancy .net functions what about the games that just appear as "gamename.exe+hex"
@chillingtime5794 жыл бұрын
Heya how can i hack a facebook poker game, i try so many times but show me to many fake address, HEELP