I don't know if there's a better way of doing it since I haven't messed with LunaDLL or LunaLua a whole lot yet but isn't there a block collision checking function? You could just have it check if the player is colliding with any blocks below them and disable the jump button if that's true.WestonSmith wrote:I know LunaDLL can shut out the jump button, but is it possible to stop the player from jumping while still allowing Kood to float?
Example: Kood walks of the cliff. He can hold the jump button to float to the next ledge. However, at no point does he gain any vertical motion.
Odd question, and I doubt this one is doable, but thought I'd check in with an expert.
LunaDLL/LunaLUA help thread
Re: LunaDLL help thread
- WestonSmith
- Bunny
- Posts: 191
- Joined: 11 years ago
Re: LunaDLL help thread
Thank you! Code works perfect.
- Sturg
- Gets his freak on with VGM
- Posts: 710
- Joined: 13 years ago
- First name: sturgyman
- Location: - :noiƚɒɔo⅃
- Contact:
Re: LunaDLL help thread
I've suddenly been getting this error repetitively trying to open smbx but to no avail:
RIP FISH NIPPLE BANNER
Re: LunaDLL help thread
Try a fresh install?Sturg wrote:I've suddenly been getting this error repetitively trying to open smbx but to no avail:
Re: LunaDLL help thread
Hey, How can I make things loop from the bottom of the screen to the top of the screen using luna?
Putting down a bunch of warps is too much work.
Putting down a bunch of warps is too much work.
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: LunaDLL help thread
Well, it's a matter of checking if the y-coordinate is above a certain number, and if so moving them up.7NameSam wrote:Hey, How can I make things loop from the bottom of the screen to the top of the screen using luna?
Putting down a bunch of warps is too much work.
To do so for the player only, for all sections, would be something like:
Code: Select all
function onLoop()
local sectBottom = player.sectionObj.boundary.bottom
local sectTop = player.sectionObj.boundary.top
-- If the top of the player is below the bottom of the section...
if (player.y > sectBottom ) then
-- Move the (top of the) player 48px above the top of the screen
player.y = sectTop - 48
end
end
- Attachments
-
- FallingForever.zip
- (1.08 KiB) Downloaded 66 times
Re: LunaDLL help thread
Yep works like a charm!
thanks for that.
also, is it possible to do it the other way around? (move through top of screen, and come out the bottom of it)
Edit: and is it possible to do both at the same time?
thanks for that.
also, is it possible to do it the other way around? (move through top of screen, and come out the bottom of it)
Edit: and is it possible to do both at the same time?
Last edited by 7NameSam 8 years ago, edited 1 time in total.
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: LunaDLL help thread
Just reverse top/bottom handling there. So replace "player.y > sectBottom" with "player.y < sectTop - 48", and "player.y = sectTop - 48" with "player.y = sectBottom"7NameSam wrote:also, is it possible to do it the other way around? (move through top of screen, and come out the bottom of it)
Re: LunaDLL help thread
How do you do Autoscrolling with Luna?
- SAJewers
- ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
- Posts: 4219
- Joined: 12 years ago
- Location: Nova Scotia
Re: LunaDLL help thread
is there a way to make all NPCs not move when powering up or down? I'm made part of a level, but it's a bit difficult because NPCs like the crab will continue to move when the powerup/down animation occurs.
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: LunaDLL help thread
So, took a little new research about offset 0x128, but think I got something:SAJewers wrote:is there a way to make all NPCs not move when powering up or down? I'm made part of a level, but it's a bit difficult because NPCs like the crab will continue to move when the powerup/down animation occurs.
Code: Select all
-- Check if the player has invincibility frames
if (player:mem(0x140, FIELD_WORD) ~= 0) or (player:mem(0x128, FIELD_FLOAT) ~= 0) then
-- If so, freeze time
mem(0xB2C8B4, FIELD_WORD, -1)
else
-- Otherwise, unfreeze time
mem(0xB2C8B4, FIELD_WORD, 0)
end
Let me know how that goes :)
It's a matter of manipulating the section boundary, which can be done like:7NameSam wrote:How do you do Autoscrolling with Luna?
Code: Select all
-- Move the left boundary 5 to the right, and set the right boundary to the left plus 800
local bounds = player.sectionObj.boundary
bounds.left = bounds.left + 5
bounds.right = bounds.left + 800
player.sectionObj.boundary = bounds
Also, right now I'm making a little helper library to make fancier autoscroll effects easier. (Going to use it to clean up some things in the relay level)
Re: LunaDLL help thread
Is it possible to fix the issue when after a while of scrolling the background does the solitare thing?Rednaxela wrote:It's a matter of manipulating the section boundary, which can be done like:7NameSam wrote:How do you do Autoscrolling with Luna?This code would go in your onLoop or similar.Code: Select all
-- Move the left boundary 5 to the right, and set the right boundary to the left plus 800 local bounds = player.sectionObj.boundary bounds.left = bounds.left + 5 bounds.right = bounds.left + 800 player.sectionObj.boundary = bounds
Also, right now I'm making a little helper library to make fancier autoscroll effects easier. (Going to use it to clean up some things in the relay level)
- SAJewers
- ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
- Posts: 4219
- Joined: 12 years ago
- Location: Nova Scotia
Re: LunaDLL help thread
While that works, NPCs will stay frozen until the end of invincibility frames, rather than just the duration of the powerup/down animation.
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: LunaDLL help thread
Yes, put all that in an "if" statement so that it stops scrolling before you leave the original section boundaries set by the editor, or instead of an "if" statement you could use math.max to set a maximum value for bounds.left to get set to.7NameSam wrote:Is it possible to fix the issue when after a while of scrolling the background does the solitare thing?
Oh, I thought that's what you wanted.SAJewers wrote:While that works, NPCs will stay frozen until the end of invincibility frames, rather than just the duration of the powerup/down animation.
If you want just the animation without the extra invincibility frames, replace this:
Code: Select all
if (player:mem(0x140, FIELD_WORD) ~= 0) or (player:mem(0x128, FIELD_FLOAT) ~= 0) then
Code: Select all
if (player:mem(0x128, FIELD_FLOAT) ~= 0) then
EDIT: 0x128 also applies to character change animations.
Re: LunaDLL help thread
I don't know luaRednaxela wrote:Yes, put all that in an "if" statement so that it stops scrolling before you leave the original section boundaries set by the editor, or instead of an "if" statement you could use math.max to set a maximum value for bounds.left to get set to.7NameSam wrote:Is it possible to fix the issue when after a while of scrolling the background does the solitare thing?
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: LunaDLL help thread
Heh, well... if you want a quick snippet...7NameSam wrote:I don't know lua
This applies to the first section.
Code: Select all
local originalRightEdge = nil
function onLoop()
if originalRightEdge == nil then
local bounds = Section(0).boundary
originalRightEdge = bounds.right
bounds.right = bounds.left + 800
end
local bounds = Section(0).boundary
bounds.right = math.min(bounds.right + 5, originalRightEdge)
bounds.left = bounds.right - 800
Section(0).boundary = bounds
end
Re: LunaDLL help thread
No, it just instantly moves the screen to the end of the sectionRednaxela wrote:Heh, well... if you want a quick snippet...7NameSam wrote:I don't know lua
This applies to the first section.Untested, but I think it ought to work.Code: Select all
local originalRightEdge = nil function onLoop() if originalRightEdge == nil then local bounds = Section(0).boundary originalRightEdge = bounds.right bounds.right = bounds.left + 800 end local bounds = Section(0).boundary bounds.right = math.min(bounds.right + 5, originalRightEdge) bounds.left = bounds.right - 800 Section(0).boundary = bounds end
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: LunaDLL help thread
Whoops, add an extra "Section(0).boundary = bounds" right before the first "end" line7NameSam wrote:No, it just instantly moves the screen to the end of the section
Re: LunaDLL help thread
Is there some kind of Lua thing you can do so you don't become big when you get a checkpoint?
Re: LunaDLL help thread
Technically yes, but it requires a bit of trickery.7NameSam wrote:Is there some kind of Lua thing you can do so you don't become big when you get a checkpoint?
First you need to check if you just collected the checkpoint - searching for all checkpoint NPCs, storing the number you find, and then checking to see if that's decreased, will do that.
Second, you need to cancel the "get big" animation. I forgot the exact memory location, but there's a memory map on the Lua wiki which should point you in the right direction.
If that doesn't solve it, you may also need to set the powerup state to small (if and only if you weren't big before collecting the checkpoint).
That should more or less do what you need.
Re: LunaDLL help thread
So how would I go about setting mother brain's hits using LunaLUA? I'm guessing it involves setting a specific NPC memory address, do we have a reference list that might tell me it?
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: LunaDLL help thread
Reference list hereIgnoritus wrote:So how would I go about setting mother brain's hits using LunaLUA? I'm guessing it involves setting a specific NPC memory address, do we have a reference list that might tell me it?
In particular offset 0x148 with a type of FIELD_FLOAT
So can play around with things like
Code: Select all
npc:mem(0x148, FIELD_FLOAT, 10)
Re: LunaDLL help thread
Thanks, now my dreams of making mother brain take three times as many hits can be realized. :DRednaxela wrote:Reference list hereIgnoritus wrote:So how would I go about setting mother brain's hits using LunaLUA? I'm guessing it involves setting a specific NPC memory address, do we have a reference list that might tell me it?
In particular offset 0x148 with a type of FIELD_FLOAT
So can play around with things likeCode: Select all
npc:mem(0x148, FIELD_FLOAT, 10)
- snoruntpyro
- cutest girl 2023
- Posts: 884
- Joined: 9 years ago
- Pronouns: she/her
- Contact:
Re: LunaDLL help thread
Is there any way to deactivate SMBX's despawning code? In other words, always have all NPCs active?
- Rednaxela
- Maker of Shenanigans
- Posts: 897
- Joined: 10 years ago
- Pronouns: they/them
- https://rednaxela.talkhaus.com
Re: LunaDLL help thread
Something like the following would work, but note that it may cause slowdown if there are too many NPCs in the level:Pyro wrote:Is there any way to deactivate SMBX's despawning code? In other words, always have all NPCs active?
Code: Select all
for i,npc in pairs(npcs()) do
-- Make sure it's not a generator (0x64), and that it is something that's supposed
-- to respawn were it to despawn (0xDC is the ID something would respawn as,
-- or 0 if it's meant to disappear permanently when offscreen)
if (npc:mem(0x64, FIELD_WORD) == 0) and (npc:mem(0xDC, FIELD_WORD) ~= 0) then
-- 0x12A is the countdown till despawning happens. Keep resetting this timer if the above criteria pass
npc:mem(0x12A, FIELD_WORD, 120)
end
end