Need help with lua? - LunaLua General Help

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?
Novarender
Tweeter
Tweeter
Posts: 145
Joined: Sat Aug 06, 2016 6:59 pm
Flair: Whoa

Re: Need help with lua? - LunaLua General Help

Postby Novarender » Wed Jan 17, 2018 9:02 pm

Can you force something inanimate to become animated? For example, can I force a dummy sprite to become animated on the world map using lua?

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Wed Jan 17, 2018 10:31 pm

You would probably have to redraw the sprite. Also if you wanted to, you could probably make an table of all of the path tiles and the directions you can travel on them and then force the player to only travel one of those directions to achieve what you're trying to do

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9887
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Need help with lua? - LunaLua General Help

Postby Emral » Thu Jan 18, 2018 2:41 am

Notxarb wrote:
Taycamgame wrote: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?
You can find 0x114 on this sheet which determines the sprite index of the player on his sheet:
https://wohlsoft.ru/pgewiki/SMBX_Player_Offsets
It links to this spritesheet which shows the boxes and ids of every frame on the sheet. Frames are direction-dependent, though both 0 and 50 can be used for direction-independent frames, as they have no counterpart:
[rimg]http://i.imgur.com/1dnW3g3.png[/rimg]
It's not currently possible to resize this sheet, and there is a lot more going into making new powerups than providing a spritesheet for them (player.powerup, mapping npcs to grant powerup effects, perhaps adding more 0x122 powerup animations or finding an external way to do the same)

Hoeloe
Phanto
Phanto
Posts: 1465
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Thu Jan 18, 2018 6:07 am

Enjl wrote: both 0 and 50 can be used for direction-independent frames, as they have no counterpart
Not strictly speaking true. 50 does have a counterpart but it is guaranteed to be invisible, since it's not on the sheet.

Taycamgame
Gold Yoshi Egg
Gold Yoshi Egg
Posts: 1483
Joined: Mon Jun 19, 2017 11:35 am
Flair: Stargard
Contact:

Re: Need help with lua? - LunaLua General Help

Postby Taycamgame » Thu Jan 18, 2018 6:56 am

Enjl wrote:
Notxarb wrote:
Taycamgame wrote: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?
You can find 0x114 on this sheet which determines the sprite index of the player on his sheet:
https://wohlsoft.ru/pgewiki/SMBX_Player_Offsets
It links to this spritesheet which shows the boxes and ids of every frame on the sheet. Frames are direction-dependent, though both 0 and 50 can be used for direction-independent frames, as they have no counterpart:
[rimg]http://i.imgur.com/1dnW3g3.png[/rimg]
It's not currently possible to resize this sheet, and there is a lot more going into making new powerups than providing a spritesheet for them (player.powerup, mapping npcs to grant powerup effects, perhaps adding more 0x122 powerup animations or finding an external way to do the same)
Sorry, what is that sprite sheet supposed to be used for? Can't you just slap any graphic anywhere on it?

Hoeloe
Phanto
Phanto
Posts: 1465
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Thu Jan 18, 2018 7:42 am

Taycamgame wrote: Sorry, what is that sprite sheet supposed to be used for? Can't you just slap any graphic anywhere on it?
It shows you where on the player sprite sheets each frame index looks at.

The Dwarven Digger
Lakitu
Lakitu
Posts: 484
Joined: Sun Oct 30, 2016 11:17 am
Pronouns: they/them

Re: Need help with lua? - LunaLua General Help

Postby The Dwarven Digger » Thu Jan 18, 2018 11:03 am

Quantumenace wrote: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.
There's no duplicate onStart or onTickEnd, I'm testing with only one player, and the blocks are still acting like "?" blocks, even though they're in the shatterableBlocks table. So the only reason seems to be that it isn't running the code while testing. But even then, it's called luna.lua and it's in the same folder as the custom graphics, so I have no idea why it's not working apart from not being implemented into the tester, which I'm pretty sure it should be.

The0x539
Eerie
Eerie
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm

Re: Need help with lua? - LunaLua General Help

Postby The0x539 » Thu Jan 18, 2018 1:41 pm

The Dwarven Digger wrote:
Quantumenace wrote: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.
There's no duplicate onStart or onTickEnd, I'm testing with only one player, and the blocks are still acting like "?" blocks, even though they're in the shatterableBlocks table. So the only reason seems to be that it isn't running the code while testing. But even then, it's called luna.lua and it's in the same folder as the custom graphics, so I have no idea why it's not working apart from not being implemented into the tester, which I'm pretty sure it should be.
The file needs to be named lunadll.lua (or lunaworld.lua for episode-wide level code) in Beta 3 and earlier.

Novarender
Tweeter
Tweeter
Posts: 145
Joined: Sat Aug 06, 2016 6:59 pm
Flair: Whoa

Re: Need help with lua? - LunaLua General Help

Postby Novarender » Thu Jan 18, 2018 4:54 pm

Does anyone know who's working on Beta 4? Is there anyway we can tell them that they need to add a feature to speed/slow music?

Also, how can I make a coin enter freefall? E.g. dropping after a POW block strikes

Quantumenace
Chain Chomp
Chain Chomp
Posts: 308
Joined: Mon Dec 28, 2015 2:17 am

Re: Need help with lua? - LunaLua General Help

Postby Quantumenace » Fri Jan 19, 2018 12:22 am

Setting a coin's .ai1 field to 1 makes it fall, at least for the SMB3 coin.

The0x539
Eerie
Eerie
Posts: 751
Joined: Fri Jan 22, 2016 8:02 pm

Re: Need help with lua? - LunaLua General Help

Postby The0x539 » Fri Jan 19, 2018 2:23 am

Notxarb wrote:a feature to speed/slow music?
this is, as I understand it, pretty difficult to implement

Hoeloe
Phanto
Phanto
Posts: 1465
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Fri Jan 19, 2018 8:30 am

The0x539 wrote:
Notxarb wrote:a feature to speed/slow music?
this is, as I understand it, pretty difficult to implement
It requires a complete overhaul of the audio system, possibly away from SDL.

This is on the table in the far future, but it's the far future.

Novarender
Tweeter
Tweeter
Posts: 145
Joined: Sat Aug 06, 2016 6:59 pm
Flair: Whoa

Re: Need help with lua? - LunaLua General Help

Postby Novarender » Fri Jan 19, 2018 3:35 pm

PixelPest wrote:You would probably have to redraw the sprite.
What do you mean by that? Would I have to include a separate graphic and draw it repeatedly?

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9887
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Need help with lua? - LunaLua General Help

Postby Emral » Fri Jan 19, 2018 4:32 pm

Notxarb wrote:Can you force something inanimate to become animated? For example, can I force a dummy sprite to become animated on the world map using lua?
Since we're talking world map here in particular... that's tougher than doing it for levels.
For levels, you can use Graphics.drawImageToSceneWP to draw your custom sprite in the same location as the SMBX-drawn inanimate objects, at the priority at which you want it.
https://wohlsoft.ru/pgewiki/LunaLua_glo ... _functions
For the world map, you cooould do this too, but we don't have a priority system in place for the map currently, so it would render above everything, even the HUD.
For Level Contest Japan, I've made a hack that lets me sorta circumvent that:
https://www.youtube.com/watch?v=GaJAMsfKc2o
There are many sprites here drawn with Graphics.drawImageToSceneWP, but you'll notice that nothing draws over the HUD and pause menu. This is because I manually redraw those at a higher priority. The custom sprites would still overlap with the player, but I've tried my best to avoid this from being noticeable on this overworld.
So... for levels, rather simple. For the map, a massive hack.

The Dwarven Digger
Lakitu
Lakitu
Posts: 484
Joined: Sun Oct 30, 2016 11:17 am
Pronouns: they/them

Re: Need help with lua? - LunaLua General Help

Postby The Dwarven Digger » Fri Jan 19, 2018 4:48 pm

Enjl wrote:
Notxarb wrote:Can you force something inanimate to become animated? For example, can I force a dummy sprite to become animated on the world map using lua?
Since we're talking world map here in particular... that's tougher than doing it for levels.
For levels, you can use Graphics.drawImageToSceneWP to draw your custom sprite in the same location as the SMBX-drawn inanimate objects, at the priority at which you want it.
https://wohlsoft.ru/pgewiki/LunaLua_glo ... _functions
For the world map, you cooould do this too, but we don't have a priority system in place for the map currently, so it would render above everything, even the HUD.
For Level Contest Japan, I've made a hack that lets me sorta circumvent that:
https://www.youtube.com/watch?v=GaJAMsfKc2o
There are many sprites here drawn with Graphics.drawImageToSceneWP, but you'll notice that nothing draws over the HUD and pause menu. This is because I manually redraw those at a higher priority. The custom sprites would still overlap with the player, but I've tried my best to avoid this from being noticeable on this overworld.
So... for levels, rather simple. For the map, a massive hack.
We need to be able to use .txt files to edit block and BGO graphics in the same way we can with NPCs.

Hoeloe
Phanto
Phanto
Posts: 1465
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

Re: Need help with lua? - LunaLua General Help

Postby Hoeloe » Fri Jan 19, 2018 4:53 pm

The Dwarven Digger wrote: We need to be able to use .txt files to edit block and BGO graphics in the same way we can with NPCs.
This will be possible for BGOs in Beta 4, but not Blocks just yet.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9887
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Need help with lua? - LunaLua General Help

Postby Emral » Fri Jan 19, 2018 5:11 pm

Hoeloe wrote:
The Dwarven Digger wrote: We need to be able to use .txt files to edit block and BGO graphics in the same way we can with NPCs.
This will be possible for BGOs in Beta 4, but not Blocks just yet.
In all fairness you can already resize blocks by just... making their sprites bigger. Animations and block types would be neat, but yeah. Currently impossible. Size is already a great help in many cases, at least!

Novarender
Tweeter
Tweeter
Posts: 145
Joined: Sat Aug 06, 2016 6:59 pm
Flair: Whoa

Re: Need help with lua? - LunaLua General Help

Postby Novarender » Fri Jan 19, 2018 8:48 pm

Do global variables save to the save file automatically? If not, how can we save variables to the save file?

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9887
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Need help with lua? - LunaLua General Help

Postby Emral » Fri Jan 19, 2018 8:51 pm

Notxarb wrote:Do global variables save to the save file automatically? If not, how can we save variables to the save file?
https://wohlsoft.ru/pgewiki/Data_(class)
We're streamlining the system and making it easier to use with the next release, but for now, gotta use this.
It's essentially a table which you write and read from with :set and :get, using :save to save stuff to the file.

Novarender
Tweeter
Tweeter
Posts: 145
Joined: Sat Aug 06, 2016 6:59 pm
Flair: Whoa

Re: Need help with lua? - LunaLua General Help

Postby Novarender » Fri Jan 19, 2018 8:59 pm

[Deleted comment]
Last edited by Novarender on Wed May 30, 2018 5:50 pm, edited 1 time in total.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari