Suggestion for LunaLua: Memory Locking
Posted: Tue Oct 25, 2016 10:28 pm
Are you familiar with that checkbox next to each memory address in Cheat Engine that "locks" it so the hooked program can't change it? This could be a powerful function for LunaLua, especially if it could be done to a specific NPC or block. I know, you could set the address to the same value every frame. But this doesn't always work. Let's look at platform NPCs, for example:
What if you wanted to take control of a platform's movement? The movement pattern of a platform is determined by an address that stores the ID of the line it is on, and this value is set every frame, depending on what line the platform is on (set to 0 if not on a line). If the value is 0 and the platform is active, the platform is affected by gravity. You don't want it to be affected by gravity; this makes controlling its movement a hassle. You can't set the platform to not be affected by gravity in its .txt (I tried and it doesn't work). Changing the memory address containing the line ID to 0 every frame doesn't work, either. SMBX just changes it back to 0 and it still falls a bit before Lua switches it back to 71 (the horizontal line).
It would work like this:
"address" can be any memory address. For instance, if you wanted to lock AI-1 of an NPC (it would probably need to be wrapped with pnpc.lua), you would use:
This would lock that address and prevent SMBX from changing it. You could still change it yourself using LunaLua, of course.
I will put this in the LunaLua wishlist, linked to this page.
What if you wanted to take control of a platform's movement? The movement pattern of a platform is determined by an address that stores the ID of the line it is on, and this value is set every frame, depending on what line the platform is on (set to 0 if not on a line). If the value is 0 and the platform is active, the platform is affected by gravity. You don't want it to be affected by gravity; this makes controlling its movement a hassle. You can't set the platform to not be affected by gravity in its .txt (I tried and it doesn't work). Changing the memory address containing the line ID to 0 every frame doesn't work, either. SMBX just changes it back to 0 and it still falls a bit before Lua switches it back to 71 (the horizontal line).
It would work like this:
Code: Select all
Misc.lockMem(address)
Code: Select all
Misc.lockMem(npc.ai1)
I will put this in the LunaLua wishlist, linked to this page.