This is the place for discussion and support for LunaLua and related modifications and libraries.
Moderator: Userbase Moderators
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?
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Tue Jan 16, 2018 12:51 pm
In order for shadows to work, you have to specify what actually casts shadows. That's the shadow geometry.
|
|
|
|
|
|
|
|
|
-
Taycamgame
- Gold Yoshi Egg

- Posts: 1483
- Joined: Mon Jun 19, 2017 11:35 am
- Flair: Stargard
-
Contact:
Postby Taycamgame » Tue Jan 16, 2018 2:10 pm
So for example, a block could be given properties that makes it cast a shadow? What about NPC's? It would be really cool to see that shadows could be blocked by walls, that would make for a cool "security camera" scenario.
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Tue Jan 16, 2018 2:41 pm
Shadows will be done based on priority rendering. You won't be able to set it on a per-block or per-npc basis, but it needs a new feature in the base engine for this to work.
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Tue Jan 16, 2018 6:26 pm
PixelPest wrote:Notxarb wrote:How can I check whether the player is alive?
Code: Select all player:mem(0x13A, FIELD_WORD) == 0
I tried this and it didn't work, but the memory list on
https://wohlsoft.ru/pgewiki/SMBX_Player_Offsets
says that the player death state memory address is 0x13C. I tried both, but neither worked. Am I supposed to replace FIELD_WORD or something?
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Tue Jan 16, 2018 6:37 pm
Notxarb wrote:PixelPest wrote:Notxarb wrote:How can I check whether the player is alive?
Code: Select all player:mem(0x13A, FIELD_WORD) == 0
I tried this and it didn't work, but the memory list on
https://wohlsoft.ru/pgewiki/SMBX_Player_Offsets
says that the player death state memory address is 0x13C. I tried both, but neither worked. Am I supposed to replace FIELD_WORD or something?
Can you show your code? I know where the memory list is an you use 0x13A to test the player being alive because 0x13A is the death animation timer. If it's greater than zero the player is no longer alive, while 0x13C only triggers after the player death animation is finished
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Tue Jan 16, 2018 7:17 pm
Code: Select all Text.print(player:mem(0x13A, FIELD_WORD),150,80)
I specifically used this in an onTick loop to always update the number. It was 0, but after I jumped out of bounds and died, it was still zero. I was trying to make my own level timer and have it detect if I'm already dead, but it doesn't, so I can be killed more than once sometimes.
EDIT: It turns out that 0x13E was actually the death animation timer.
What function can I use that happens when the pause key is pressed?
Yes, this needs to be a function.
EDIT: Nevermind...
If I want to make a "Time's Up!" graphic and display it when the time runs out, where should I put that graphic and how can I access it in an lua script?
Also, is there no way to make music play faster?
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Tue Jan 16, 2018 9:57 pm
Notxarb wrote:If I want to make a "Time's Up!" graphic and display it when the time runs out, where should I put that graphic and how can I access it in an lua script?
Also, is there no way to make music play faster?
My mistake it was 0x13E. Sorry.
To load a graphics use the Graphics.loadImage function with the argument being the file path. You can place the file in your custom graphics folder along with your lunadll.lua file and your file path will just be the name of your file. Then draw it with Graphics.drawImageWP at a priority of 5 (HUD priority). You also could possibly just use Text.printWP or textblox.lua as well depending on how complicated you want the text to be instead of loading an image file. There's no way to modify music files rn but you can just use a program outside of SMBX to change the speed of the music file and then load and play it in LunaLua
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Tue Jan 16, 2018 10:23 pm
PixelPest wrote:Notxarb wrote:If I want to make a "Time's Up!" graphic and display it when the time runs out, where should I put that graphic and how can I access it in an lua script?
Also, is there no way to make music play faster?
My mistake it was 0x13E. Sorry.
To load a graphics use the Graphics.loadImage function with the argument being the file path. You can place the file in your custom graphics folder along with your lunadll.lua file and your file path will just be the name of your file. Then draw it with Graphics.drawImageWP at a priority of 5 (HUD priority). You also could possibly just use Text.printWP or textblox.lua as well depending on how complicated you want the text to be instead of loading an image file. There's no way to modify music files rn but you can just use a program outside of SMBX to change the speed of the music file and then load and play it in LunaLua
Ok thanks. Also, I suspected I'd have to do that to the music, but that means I'll have to have nearly twice as many songs, and believe me I will be having LOTS of songs in my episode.
If you think about it, do you think you could make artificial 4-players by cloning player 1 and 2 and having player 3 and 4 control those clones?
Also, will 4-players be added in Beta 4? When will Beta 4 come out?
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Tue Jan 16, 2018 10:27 pm
We all know how you can travel across any adjacent paths on the world map. Could you use lua scripts to program individual paths so that Mario can only travel across connected parts of paths?
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Tue Jan 16, 2018 10:41 pm
Notxarb wrote:If you think about it, do you think you could make artificial 4-players by cloning player 1 and 2 and having player 3 and 4 control those clones?
Also, will 4-players be added in Beta 4? When will Beta 4 come out?
That wouldn't be easy and probably end up pretty ugly if you tried it. I don't think it's planned for Beta4 but it's been discussed for the future iirc. Beta4 will be released before April this year if all goes as planned.
Notxarb wrote:We all know how you can travel across any adjacent paths on the world map. Could you use lua scripts to program individual paths so that Mario can only travel across connected parts of paths?
I don't understand. Mario can only travel across connected paths. Maybe be more specific as to what you want to happen? Are you adding paths?
|
|
|
|
|
|
|
|
|
-
The Dwarven Digger
- Lakitu

- Posts: 484
- Joined: Sun Oct 30, 2016 11:17 am
- Pronouns: they/them
Postby The Dwarven Digger » Wed Jan 17, 2018 2:42 am
Is there a way of making a brick block with an item inside that still breaks when hit? So it acts like a standard brick block except when broken, an item appears in its location, preferably with a bit of upwards velocity so you don't just instantly hit/collect that item, but have some time to see what it is and get out of the way if you want or need to.
|
|
|
|
|
|
|
|
|
-
Quantumenace
- Chain Chomp

- Posts: 308
- Joined: Mon Dec 28, 2015 2:17 am
Postby Quantumenace » Wed Jan 17, 2018 2:55 am
You could give the block an event that does nothing on being destroyed, and use onEvent() to detect it and spawn the powerup.
|
|
|
|
|
|
|
|
|
-
The Dwarven Digger
- Lakitu

- Posts: 484
- Joined: Sun Oct 30, 2016 11:17 am
- Pronouns: they/them
Postby The Dwarven Digger » Wed Jan 17, 2018 3:00 am
Quantumenace wrote:You could give the block an event that does nothing on being destroyed, and use onEvent() to detect it and spawn the powerup.
Ok, I'm assuming I'd need a different event for each block I want to use, since that's what tells it where to spawn the powerup.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9887
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Wed Jan 17, 2018 6:25 am
Notxarb wrote:We all know how you can travel across any adjacent paths on the world map. Could you use lua scripts to program individual paths so that Mario can only travel across connected parts of paths?
Oof... If you wanna rewrite the entire overworld movement system and give every path an identity for where it connects... Be wary that this limits custom graphics for paths or at least makes it more of a hassle to use nonstandard ones. The easy solution is to space out your paths well so that paths bleeding into each other can't happen.
|
|
|
|
|
|
|
|
|
-
Taycamgame
- Gold Yoshi Egg

- Posts: 1483
- Joined: Mon Jun 19, 2017 11:35 am
- Flair: Stargard
-
Contact:
Postby Taycamgame » Wed Jan 17, 2018 11:28 am
I think he meant that if you have a crossroad of paths, how would you make only one way open rather than them all (assuming that the crossroad intersection isn't a level)?
|
|
|
|
|
|
|
|
|
-
Quantumenace
- Chain Chomp

- Posts: 308
- Joined: Mon Dec 28, 2015 2:17 am
Postby Quantumenace » Wed Jan 17, 2018 4:25 pm
The Dwarven Digger wrote:Ok, I'm assuming I'd need a different event for each block I want to use, since that's what tells it where to spawn the powerup.
Here's something I wrote just to see if it would work. It automatically handles the NPC contents of the block types listed in the shatterableBlocks table. Note however that P-switches will turn them into coins and they'll lose the contents data as a result.
Code: Select all local shatterableBlocks = {4,60}
function onStart()
for k,v in ipairs(Block.get(shatterableBlocks)) do
v:mem(0x50,FIELD_WORD,0)
end
end
function onTickEnd()
for k,v in ipairs(Block.get(shatterableBlocks)) do
if v:mem(0x08,FIELD_WORD) > 1000 and v.isHidden and tostring(v.layerName) == "Destroyed Blocks" then
local n = NPC.spawn(v:mem(0x08,FIELD_WORD)-1000, v.x+0.5*v.width, v.y+0.5*v.height, player.section, false, true)
n.speedY = -6
v:mem(0x08,FIELD_WORD,0)
end
end
end
|
|
|
|
|
|
|
|
|
-
The Dwarven Digger
- Lakitu

- Posts: 484
- Joined: Sun Oct 30, 2016 11:17 am
- Pronouns: they/them
Postby The Dwarven Digger » Wed Jan 17, 2018 4:32 pm
Quantumenace wrote:The Dwarven Digger wrote:Ok, I'm assuming I'd need a different event for each block I want to use, since that's what tells it where to spawn the powerup.
Here's something I wrote just to see if it would work. It automatically handles the NPC contents of the block types listed in the shatterableBlocks table. Note however that P-switches will turn them into coins and they'll lose the contents data as a result.
Code: Select all local shatterableBlocks = {4,60}
function onStart()
for k,v in ipairs(Block.get(shatterableBlocks)) do
v:mem(0x50,FIELD_WORD,0)
end
end
function onTickEnd()
for k,v in ipairs(Block.get(shatterableBlocks)) do
if v:mem(0x08,FIELD_WORD) > 1000 and v.isHidden and tostring(v.layerName) == "Destroyed Blocks" then
local n = NPC.spawn(v:mem(0x08,FIELD_WORD)-1000, v.x+0.5*v.width, v.y+0.5*v.height, player.section, false, true)
n.speedY = -6
v:mem(0x08,FIELD_WORD,0)
end
end
end
Thanks! I won't be using P-switches in the same levels as this mechanic, so that aspect isn't a problem. I'll make sure I mention you in the credits for my episode.
|
|
|
|
|
|
|
|
|
-
The Dwarven Digger
- Lakitu

- Posts: 484
- Joined: Sun Oct 30, 2016 11:17 am
- Pronouns: they/them
Postby The Dwarven Digger » Wed Jan 17, 2018 5:17 pm
It doesn't appear to be working when I test it, is there anything else I need to add or do? Or does the code not run while testing? (I'm using the 2.0 standard tester, not the experimental PGE one)
|
|
|
|
|
|
|
|
|
-
Quantumenace
- Chain Chomp

- Posts: 308
- Joined: Mon Dec 28, 2015 2:17 am
Postby Quantumenace » Wed Jan 17, 2018 5:58 pm
The shatterableBlocks table needs to have a list of the block types you're using for this. Otherwise I don't know why it wouldn't be working unless the file isn't being run or you have duplicate onStart or onTickEnd or something. Are the blocks with contents still acting like "?" blocks?
Edit: It spawns the NPC in the same section as player 1, which might cause issues in 2-player. It takes a little work to determine which section a block is actually in.
|
|
|
|
|
|
|
|
|
-
Novarender
- Tweeter

- Posts: 145
- Joined: Sat Aug 06, 2016 6:59 pm
- Flair: Whoa
Postby Novarender » Wed Jan 17, 2018 8:33 pm
Taycamgame wrote:I think he meant that if you have a crossroad of paths, how would you make only one way open rather than them all (assuming that the crossroad intersection isn't a level)?
No, Enjl was right, and PixelPest was confused. On the main map, you can cross between any adjacent placed paths, regardless of whether they're connected graphically. Just for fun, I was wondering if we could program it so that you can't cross graphically unconnected paths, but as I thought, it wouldn't be worth it.
Also, I felt the same about the 4-players.
Can we add new animations to the character spritesheets and access them for new animations? If so, what are the dimensions of at least mario's animations? Can we resize the spritesheet and have it still work?
If we can, can we add new spritesheets to the player folder for new powerups, if so, is there a limit to how many spritesheets we have?
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 1 guest
|