This is the place for discussion and support for LunaLua and related modifications and libraries.
Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
Circle Guy wrote:How do you create a lunadll.lua file? (The one for your episode)
Create a new .txt file, then rename it from "New Text Document.txt" to "lunadll.lua". You should get a warning about changing the filetype, but that's fine, just click OK. If you don't get a warning, chances are you haven't changed the filetype, and you may end up with a file called "lunadll.lua.txt", which won't work, so keep that in mind.
local encrypt = API.load("encrypt")
_G["Borderlands"] = encrypt.Data(Data.DATA_WORLD, "Borderlands", true)
local eventu = API.load("eventu")
--medals images
local gold = Graphics.loadImage("../medals/gold-medal.png")
local silver = Graphics.loadImage("../medals/silver-medal.png")
local bronze = Graphics.loadImage("../medals/bronze-medal.png")
--universal layers
local timetrialsmode = Layer(3)
local normalmode = Layer(4)
--time trials selection elements
Borderlands:set("section20", 0)
Borderlands:set("canright", 1)
Borderlands:set("canleft", 0)
local qbox = Graphics.loadImage("../question/qbox.png")
Borderlands:set("drawQboxImg", 0)
local qbox2 = Graphics.loadImage("../question/qbox2.png")
Borderlands:set("drawQbox2Img", 0)
if Borderlands:get("secretcounter") == nil then
--counters
Borderlands:set("secretcounter", 0)
Borderlands:set("coincounter", 0)
Borderlands:set("areacounter", 0)
Borderlands:set("storedpower", 1)
Borderlands:set("jumpcounter", 0)
--area counters
--(only counted the first time the player enters an area)
Borderlands:set("area1", 1)
Borderlands:set("area2", 1)
Borderlands:set("area3", 1)
Borderlands:set("area4", 1)
Borderlands:set("area5", 1)
Borderlands:set("area6", 1)
--world complete counters
--(w1 - w5 triggered on boss death; w6 triggered on last level completed)
Borderlands:set("w1", 1)
Borderlands:set("w2", 1)
Borderlands:set("w3", 1)
Borderlands:set("w4", 1)
Borderlands:set("w5", 1)
Borderlands:set("w6", 1)
--achievements
--(set to 0 when completed)
Borderlands:set("up", 1)
local up1 = Graphics.loadImage("../achievements/up.png")
Borderlands:set("drawUpImg", 0)
--Up: Jump 1 time.
Borderlands:set("hopscotchx150", 1)
local hopscotchx1501 = Graphics.loadImage("../achievements/hopscotchx150.png")
Borderlands:set("drawHopscotchx150Img", 0)
--Hopscotch x 150: Jump 1500 times.
Borderlands:set("leapfrog", 1)
local leapfrog1 = Graphics.loadImage("../achievements/leapfrog.png")
Borderlands:set("drawLeapFrogImg", 0)
--Leapfrog: Jump 5000 times.
Borderlands:set("tiredlegs", 1)
local tiredlegs1 = Graphics.loadImage("../achievements/tiredlegs.png")
Borderlands:set("drawTiredLegsImg", 0)
--Tired Legs: Jump 30 000 times.
Borderlands:set("getalife", 1)
local getalife1 = Graphics.loadImage("../achievements/getalife.png")
Borderlands:set("drawGetALifeImg", 0)
--Get a Life: Jump 90 000 times.
Borderlands:set("piggybank", 1)
local piggybank1 = Graphics.loadImage("../achievements/piggybank.png")
Borderlands:set("drawPiggyBankImg", 0)
--Piggy Bank: Collect 500 coins.
Borderlands:set("crescentcollector", 1)
--Crescent Collector: Collect a 3-up moon.
Borderlands:set("moonbeam", 1)
--Moonbeam: Collect all 5 3-up moons.
Borderlands:set("twinkletwinkle", 1)
--Twinkle Twinkle: Collect 5 shines.
Borderlands:set("stargazer", 1)
--Stargazer: Collect 10 shines.
Borderlands:set("diamondbright", 1)
--Diamond Bright: Collect 27 shines.
Borderlands:set("shipsacker", 1)
--Ship Sacker: Beat Heavy Metal Airship I.
Borderlands:set("metalmasher", 1)
--Metal Masher: Beat Heavy Metal Airship II.
Borderlands:set("brutebasher", 1)
--Brute Basher: Beat Heavy Metal Airsip III.
Borderlands:set("downwithkoopa", 1)
--Down with Koopa: Beat Heavy Metal Airship IV.
Borderlands:set("onebehinditall", 1)
--One Behind It All: Beat Heavy Metal Airship V.
Borderlands:set("finalfrontier", 1)
--Final Frontier: Beat 6-4.
Borderlands:set("hiddentreasure", 1)
--Hidden Treasure: Find a secret area.
Borderlands:set("secretstalker", 1)
--Secret Stalker: Find two secret areas.
Borderlands:set("sharpeyes", 1)
--Sharp Eyes: Find three secret areas.
Borderlands:set("four", 1)
--Four!: Find four secret areas.
Borderlands:set("cheating", 1)
--Cheating?: Find five secret areas.
Borderlands:set("paranormalplayer", 1)
--Paranormal Player: Find all six secret areas.
--time trials
Borderlands:set("timetrials", 1)
--unlocked when main game finished
Borderlands:set("gold11", 0)
--Level 1-1 Gold Time: 275 seconds left or better
Borderlands:set("silver11", 0)
Borderlands:set("silver11active", 0)
--Level 1-1 Silver Time: 265 seconds left or better
Borderlands:set("bronze11", 0)
Borderlands:set("bronze11active", 0)
--Level 1-1 Bronze Time: 255 seconds left or better
Borderlands:save()
end
--time trials: selection screen
--(player automatically is warped)
function onLoadSection20() --all selection screens for time trials in section 21
if Borderlands:get("timetrials") == 0 then
normalmode:show(true)
end
if Borderlands:get("timetrials") == 1 then
section20 = true
Borderlands:set("drawQboxImg", 1)
end
end
function onInputUpdate()
if player.altJumpKeyPressing then
player.altJumpKeyPressing = false
player.jumpKeyPressing = true
end
if section20 == true then
player.dropKeyPressing = false
player.jumpKeyPressing = false
for playerIndex, thePlayer in pairs(Player.get()) do
if thePlayer.rightKeyPressing then
if Borderlands:get("canright") == 1 then
Borderlands:set("drawQboxImg", 0)
Borderlands:set("drawQbox2Img", 1)
Borderlands:set("canright", 0)
Borderlands:set("canleft", 1)
Borderlands:save()
end
end
if thePlayer.leftKeyPressing then
if Borderlands:get("canleft") == 1 then
Borderlands:set("drawQbox2Img", 0)
Borderlands:set("drawQboxImg", 1)
Borderlands:set("canleft", 0)
Borderlands:set("canright", 1)
Borderlands:save()
end
end
if thePlayer.upKeyPressing == true then
if Borderlands:get("canleft") == 0 then
timetrialsmode:show(true)
Borderlands:set("drawQboxImg", 0)
Borderlands:set("drawQbox2Img", 0)
Borderlands:set("canleft", 0)
Borderlands:set("canright", 0)
section20 = false
end
if Borderlands:get("canright") == 0 then
normalmode:show(true)
Borderlands:set("drawQboxImg", 0)
Borderlands:set("drawQbox2Img", 0)
Borderlands:set("canleft", 0)
Borderlands:set("canright", 0)
section20 = false
end
end
--cannot use reserve power-up during time trials
thePlayer.dropKeyPressing = false
end
end
end
function onJumpEnd()
x = tonumber(Borderlands:get("jumpcounter"))
Borderlands:set("jumpcounter", x + 1)
Borderlands:save()
end
--time trials: remove and remember power-up
function onStart()
if Borderlands:get("timetrials") == 1 then
if player.powerup == PLAYER_BIG then
Borderlands:set("storedpower", 2)
end
if player.powerup == PLAYER_FIREFLOWER then
Borderlands:set("storedpower", 3)
end
if player.powerup == PLAYER_LEAF then
Borderlands:set("storedpower", 4)
end
if player.powerup == PLAYER_TANOOKIE then
Borderlands:set("storedpower", 5)
end
if player.powerup == PLAYER_HAMMER then
Borderlands:set("storedpower", 6)
end
if player.powerup == PLAYER_ICE then
Borderlands:set("storedpower", 7)
end
player.powerup = PLAYER_SMALL
Borderlands:save()
end
end
--time trials: give player back power-up
function onExitLevel()
if Borderlands:get("timetrials") == 1 then
if Borderlands:get("storedpower") == 2 then
player.powerup = PLAYER_BIG
end
if Borderlands:get("storedpower") == 3 then
player.powerup = PLAYER_FIREFLOWER
end
if Borderlands:get("storedpower") == 4 then
player.powerup = PLAYER_LEAF
end
if Borderlands:get("storedpower") == 5 then
player.powerup = PLAYER_TANOOKIE
end
if Borderlands:get("storedpower") == 6 then
player.powerup = PLAYER_HAMMER
end
if Borderlands:get("storedpower") == 7 then
player.powerup = PLAYER_ICE
end
Borderlands:set("storedpower", 1)
Borderlands:save()
end
end
function onLoopSection20()
player.jumpKeyPressing = false
player.runKeyPressing = false
player.altjumpKeyPressing = false
player.altrunKeyPressing = false
end
function onTick()
--check for achievements
if Borderlands:get("jumpcounter") == 1 then
if Borderlands:get("up") == 1 then
Borderlands:set("up", 0)
Borderlands:set("drawUpImg", 1)
Borderlands:save()
playSFX(20) --boss-beat
end
end
if Borderlands:get("jumpcounter") == 1500 then
if Borderlands:get("hopscotchx150") == 1 then
Borderlands:set("hopscotchx150", 0)
Borderlands:set("drawHopscotchx150Img", 1)
Borderlands:save()
playSFX(20)
end
end
if Borderlands:get("jumpcounter") == 5000 then
if Borderlands:get("leapfrog") == 1 then
Borderlands:set("leapfrog", 0)
Borderlands:set("drawLeapFrogImg", 1)
Borderlands:save()
playSFX(20)
end
end
if Borderlands:get("jumpcounter") == 30000 then
if Borderlands:get("tiredlegs") == 1 then
Borderlands:set("tiredlegs", 0)
Borderlands:set("drawTiredLegsImg", 1)
Borderlands:save()
playSFX(20)
end
end
if Borderlands:get("jumpcounter") == 90000 then
if Borderlands:get("getalife") == 1 then
Borderlands:set("getalife", 0)
Borderlands:set("drawGetALifeImg", 1)
Borderlands:save()
playSFX(20)
end
end
end
--display completed achievements
function onDraw()
if Borderlands:get("drawUpImg") == 1 then
Graphics.drawImageWP(up1, 0, 0, 5)
eventu.setTimer(3, EndDrawUpImg, false)
end
if Borderlands:get("drawHopscotchx150Img") == 1 then
Graphics.drawImageWP(Hopscotchx1501, 0, 0, 5)
eventu.setTimer(3, EndDrawHopscotchx150Img, false)
end
if Borderlands:get("drawLeapFrogImg") == 1 then
Graphics.drawImageWP(LeapFrog1, 0, 0, 5)
eventu.setTimer(3, EndDrawLeapFrogImg, false)
end
if Borderlands:get("drawTiredLegsImg") == 1 then
Graphics.drawImageWP(TiredLegs1, 0, 0, 5)
eventu.setTimer(3, EndDrawTiredLegsImg, false)
end
if Borderlands:get("drawGetALifeImg") == 1 then
Graphics.drawImageWP(GetALife1, 0, 0, 5)
eventu.setTimer(3, EndDrawGetALifeImg, false)
end
if Borderlands:get("drawPiggyBankImg") == 1 then
Graphics.drawImageWP(PiggyBank1, 0, 0, 5)
eventu.setTimer(3, EndDrawPiggyBankImg, false)
end
if Borderlands:get("drawQboxImg") == 1 then
Graphics.drawImageWP(qbox, 0, 0, 5)
end
if Borderlands:get("drawQbox2Img") == 1 then
Graphics.drawImageWP(qbox2, 0, 0, 5)
end
end
function EndDrawUpImg()
Borderlands:set("drawUpImg", 0)
Borderlands:save()
end
function EndDrawHopscotchx150Img()
Borderlands:set("drawHopscotchx150Img", 0)
Borderlands:save()
end
function EndDrawLeapFrogImg()
Borderlands:set("drawLeapFrogImg", 0)
Borderlands:save()
end
function EndDrawTiredLegsImg()
Borderlands:set("drawTiredLegsImg", 0)
Borderlands:save()
end
function EndDrawGetALifeImg()
Borderlands:set("drawGetALifeImg", 0)
Borderlands:save()
end
function EndPiggyBankImg()
Borderlands:set("drawPiggyBankImg", 0)
Borderlands:save()
end
--coin counter
function onNPCKill(_, killedNPC, killReason)
if(killedNPC.id == 10 or killedNPC.id == 33 or killedNPC.id == 88 or killedNPC.id == 138 or killedNPC.id == 251 or killedNPC.id == 252 or killedNPC.id == 252)then
y = tonumber(Borderlands:get("coincounter"))
Borderlands:set("coincounter", y + 1)
Borderlands:save()
end
--secret counter
if(killedNPC.id == 196) then
y = tonumber(Borderlands:get("secretcounter"))
Borderlands:set("secretcounter", y + 1)
Borderlands:save()
end
end
--secret area counter
function onEvent(eventname)
if eventname == area1 then
if Borderlands:get("area1") == 1 then
z = tonumber(Borderlands:get("areacounter"))
Borderlands:set("areacounter", z + 1)
Borderlands:save()
end
end
if eventname == area2 then
if Borderlands:get("area2") == 1 then
z = tonumber(Borderlands:get("areacounter"))
Borderlands:set("areacounter", z + 1)
Borderlands:save()
end
end
if eventname == area3 then
if Borderlands:get("area3") == 1 then
z = tonumber(Borderlands:get("areacounter"))
Borderlands:set("areacounter", z + 1)
Borderlands:save()
end
end
if eventname == area4 then
if Borderlands:get("area4") == 1 then
z = tonumber(Borderlands:get("areacounter"))
Borderlands:set("areacounter", z + 1)
Borderlands:save()
end
end
if eventname == area5 then
if Borderlands:get("area5") == 1 then
z = tonumber(Borderlands:get("areacounter"))
Borderlands:set("areacounter", z + 1)
Borderlands:save()
end
end
if eventname == area6 then
if Borderlands:get("area6") == 1 then
z = tonumber(Borderlands:get("areacounter"))
Borderlands:set("areacounter", z + 1)
Borderlands:save()
end
end
end
Why is normalmode:show(true) always called instead of timetrialsmode:show(true)?
Enjl wrote:I prefer having my values for debugging not spaz around on the screen but I guess this could be useful for some people.
Yup I did this because sometime too much value on the screen instead of scene can be hard to debug if you are lost in the code
with this you are sure is the good npc (and with less lines )
Contained Within NPC+0x138 FIELD_WORD
1 = spawning from top of block
2 = spawning from below block
3 = unknown (moves downward)
4 = spawning from a warp-type generator
208 = inside Mother Brain jar
Generator Spawning Direction NPC+0x144 FIELD_WORD The direction this NPC is being spawned from a warp-type generator
Spawn flag? NPC+0x14C FIELD_WORD This is 1 for a single tick when the NPC spawns or respawns by appearing on the screen. Does not apply to NPCs spawned by generators.
Block Collision Index? NPC+0x150 FIELD_WORD For NPCs that can be treated as blocks by other NPCs (but not necessarily players). Starts at around 40-80 and indexes with each NPC, left to right. Is 0 for NPCs not treated as blocks by other NPCs.
I used 0x138 and 0x144 to create what looks like a normal generator but can't be blocked by NPCs or players. You have to set the fields back to 0 manually to stop them when they're "done spawning", I'm not clear how that works with a real generator yet.
Contained Within NPC+0x138 FIELD_WORD
1 = spawning from top of block
2 = spawning from below block
3 = unknown (moves downward)
4 = spawning from a warp-type generator
208 = inside Mother Brain jar
Generator Spawning Direction NPC+0x144 FIELD_WORD The direction this NPC is being spawned from a warp-type generator
Spawn flag? NPC+0x14C FIELD_WORD This is 1 for a single tick when the NPC spawns or respawns by appearing on the screen. Does not apply to NPCs spawned by generators.
Block Collision Index? NPC+0x150 FIELD_WORD For NPCs that can be treated as blocks by other NPCs (but not necessarily players). Starts at around 40-80 and indexes with each NPC, left to right. Is 0 for NPCs not treated as blocks by other NPCs.
I used 0x138 and 0x144 to create what looks like a normal generator but can't be blocked by NPCs or players. You have to set the fields back to 0 manually to stop them when they're "done spawning", I'm not clear how that works with a real generator yet.
Thanks for that one , I tried with my script to debug on how a generator work but apparently the tools npc who use the player like the one who hold the canon is not a generator on what the code say :S its weird.
I can remake a videos on what how a generator work with my script I posted before.
But any one know how to search those offsets code in cheats engine ? If some one can tell what is those memory offsets I can make advance the research more far.
Thanks
Edit :
There is the video about generator and the code
Yes, I know about those values, what I don't know is how the game knows when the NPC being spawned from the warp-type generator is "finished" and stops it. There's nothing that looks like a timer. I can't identify offsets 0x140-0x142, and setting either to 0 causes the NPC to act like it's finished spawning. It looks like it might be a reference to the generator NPC it's attached to.
Quantumenace wrote:Yes, I know about those values, what I don't know is how the game knows when the NPC being spawned from the warp-type generator is "finished" and stops it. There's nothing that looks like a timer. I can't identify offsets 0x140-0x142, and setting either to 0 causes the NPC to act like it's finished spawning. It looks like it might be a reference to the generator NPC it's attached to.
function ForceGenerators(section, npcs)
local group = {}
if npcs ~= nil then group = NPC.get(npcs, section) else group = NPC.get(-1, section) end
for k,v in pairs(group) do
if v:mem(0x64, FIELD_WORD) ~= 0 then
v:mem(0x74,FIELD_WORD,-1)
end
end
end
By that post, I meant has anyone found a way to alter a player's fastest running speed, which is currently locked at around 6 (varies depending on the character).
I downloaded the latest version, and even though I chose "full installation," it won't run because MSVCP140.dll and VCRUNTIME140.dll weren't included in the download.
There's a file called vcredist_x86.exe or something like that included. Run it.
EDIT: Is there any way I can draw the default graphics using Graphics.drawImage? That would make things a lot easier than having to make a bunch of graphic files that are literally just duplicates of already existing graphics.
Okay, sorry if this is a silly question. This is coming from someone who doesn't know anything about LunaLua, but:
Is it possible to use Lunalua to make link keep his running momentum if he attacks while running? I know he keeps his momentum if he attacks in midair, but if he attacks on the ground, he completely stops moving. Is there any way to prevent this? (And, possibly make the sword range larger?)
For some reason lunalua likes to show me every single god damn frame even when disable frame skip isnt checked. Is there a way to fix this? (right now lua runs slower than normal smbx)
Lua version: 7.2.2 (Luna Loader)
Windows: 7
RAM: 1.25 gigs (about half is used normally)
Open gl: No support
Direct X: No support
Did you get a message bpx about missing features of opengl? Because if you say than your computer doesn't support opengl, you should have got a message box and the rendering system should automatically go back to the original renderer.
Kevsoft wrote:Did you get a message bpx about missing features of opengl? Because if you say than your computer doesn't support opengl, you should have got a message box and the rendering system should automatically go back to the original renderer.
The box shows up every time I start lua and tells me that its using the normal renderer, but the game in general runs slower, but ive noticed that it doesnt skip frames, or at least doesnt skip as many as normal. Also on some levels or episodes, the lag I get causes said level or episode to be become unplayable. ive also noticed that checking disable sound and manually removing any music makes it run slightly faster. (But still not normal speed)
EDIT: i just checked and whenever i use lunalua, my cpu bar goes up to the max. Maybe thats the problem?
I know that to adjust/find the player's power-up you can use player.Powerup. Is there something like that you can use for a ride (Yoshi, boot, etc.) or is there a memory value I can use? I need to test to see if the player is wearing a boot (or if one is spawned works too).