(shouting)

LunaDLL/LunaLUA help thread

The second SMBX collab!
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4219
Joined: 12 years ago
Location: Nova Scotia

Re: LunaDLL/LunaLUA help thread

Post by SAJewers »

Mikkofier wrote:How does one change the amount of hits that it takes to kill a 'boss' npc?
http://engine.wohlnet.ru/pgewiki/How_To ... t_commands
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
7NameSam
hey
Posts: 248
Joined: 9 years ago
Pronouns: they/them

Re: LunaDLL/LunaLUA help thread

Post by 7NameSam »

Hey, is there any way to turn off the cinematX HUD in a level that uses cinematX?
User avatar
Rednaxela
Maker of Shenanigans
Posts: 897
Joined: 10 years ago
Pronouns: they/them
https://rednaxela.talkhaus.com

Re: LunaDLL/LunaLUA help thread

Post by Rednaxela »

7NameSam wrote:Hey, is there any way to turn off the cinematX HUD in a level that uses cinematX?
If you're using an old version of cinematX, no.
If you use a new enough version of cinematX, this is off by default actually, but you can turn it back on by calling cinematX.config with "true" as the third argument.

Take a look at line 1679 of cinematX.lua's current version.
Rixithechao
https://www.youtube.com/watch?v=BODxOghVmko
Posts: 1864
Joined: 10 years ago
First name: Mack
https://rixithechao.talkhaus.com/

Re: LunaDLL/LunaLUA help thread

Post by Rixithechao »

Alternatively, you can just set cinematX.useHUDBox to false in the newer versions.
config() is going to be deprecated. The absolute latest version, which I haven't committed to github yet, has a better config function that uses named arguments. Same thing with configDialog() and startDialog().
Delightful Adventure Enhanced is out now!

Image

There's an official ASMT Discord server! Check it out to discuss Demo games and follow their development! thread, invite link

(Entry requires verification, either with a connected Youtube/Twitter/Twitch/etc account or manually by the server staff.)


Itch.io (albums and eventually games), Youtube (dofur pass and I guess other videos)
User avatar
Duker
I post u2be tags I guess
Posts: 272
Joined: 14 years ago
Location: The Comment Section

Re: LunaDLL/LunaLUA help thread

Post by Duker »

So I gotta be missing something with loadAnimatedImage...
Using Graphics.loadImage("Example.gif") works (and I can draw the first frame of the gif using both drawImage and placeSprite) but Graphics.loadAnimatedImage("Example.gif") gives me an seemingly empty table, what the heck? Tested two different animated gifs with the same result

I could also be missing some easier way to import custom animation without repurposing npcs...


Edit: I missed that loadAnimatedImage returns multiple values, doh.
Edit2: But still doesn't change that the table I get is completely empty GAAAAH FRUSTRATING.
Last edited by Duker 8 years ago, edited 2 times in total.
fart.
User avatar
Axon
Posts: 29
Joined: 11 years ago
Location: At a place.

Re: LunaDLL/LunaLUA help thread

Post by Axon »

I'm trying to use multipoints and I'm noticing that npcs aren't already spawned when I reenter the level after getting a multipoint. What's happening?
User avatar
Hoeloe
A2XT person
Posts: 1022
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Post by Hoeloe »

Axon wrote:I'm trying to use multipoints and I'm noticing that npcs aren't already spawned when I reenter the level after getting a multipoint. What's happening?
You have an old version of multipoints I'm guessing. This was a bug before version 3.0.10. 3.0.11 is the most recent version.
Image
Image
Image
Image
Image
User avatar
Karatekid5
Welcome to the resort!
Posts: 78
Joined: 14 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL/LunaLUA help thread

Post by Karatekid5 »

In my level I was able to turn the detonators into pseudo P-switches, and they have a little custom tune that plays when the switch is pressed. Would it be possible to lower the volume of the background music while this happens? Both the start and the end of the P-Switch time are activated via SMBX events, so onEvent triggers could be easily utilized.
Yoshi Ambassador!
Image
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4219
Joined: 12 years ago
Location: Nova Scotia

Re: LunaDLL/LunaLUA help thread

Post by SAJewers »

Note that we have plans to imeplement ASMT's ticking P-switch thingy, so you may not need to do it yourself.
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
Karatekid5
Welcome to the resort!
Posts: 78
Joined: 14 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL/LunaLUA help thread

Post by Karatekid5 »

SAJewers wrote:Note that we have plans to imeplement ASMT's ticking P-switch thingy, so you may not need to do it yourself.
After looking around some of the LunaLUA tutorials, I found out how to change the music volume with LUA! ^_^ Though, I don't know what the default volume level is for SMBX music.
Yoshi Ambassador!
Image
User avatar
Wohlstand
Moondust and TheXTech developer
Posts: 186
Joined: 10 years ago
First name: Vitaly
Pronouns: he/him/his
Location: Moscow, Russia

Re: LunaDLL/LunaLUA help thread

Post by Wohlstand »

Karatekid5 wrote:
SAJewers wrote:Note that we have plans to imeplement ASMT's ticking P-switch thingy, so you may not need to do it yourself.
After looking around some of the LunaLUA tutorials, I found out how to change the music volume with LUA! ^_^ Though, I don't know what the default volume level is for SMBX music.
Default SMBX Music volume is 0.4 (400/1000 by MCI volume scale), so: 128*0.4=51.2 -> 51 - value for a music volume function.
User avatar
Karatekid5
Welcome to the resort!
Posts: 78
Joined: 14 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL/LunaLUA help thread

Post by Karatekid5 »

Wohlstand wrote:Default SMBX Music volume is 0.4 (400/1000 by MCI volume scale), so: 128*0.4=51.2 -> 51 - value for a music volume function.
Excellent, it works perfectly! Thank you! :)
Yoshi Ambassador!
Image
User avatar
ztarwuff
What the heck is a flair and why am I being asked to write one for my profile?
Posts: 553
Joined: 11 years ago
Location: Not a great mental space TBH.

Re: LunaDLL/LunaLUA help thread

Post by ztarwuff »

Does anybody have a functioning Multipoints Lua code I can look at? I just don't understand the tutorial on the PGEwiki and searching this thread isn't bringing anything up. I've tried using the search terms checkpoints, check point, multipoint, but to no avail.

Also, is there a way of forcing a layer to display above another? Ever since I converted a bunch of layers to PNG, they display strangely both in the SMBX Editor and the PGE editor.
User avatar
Hoeloe
A2XT person
Posts: 1022
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Post by Hoeloe »

ztarwuff wrote:Does anybody have a functioning Multipoints Lua code I can look at? I just don't understand the tutorial on the PGEwiki and searching this thread isn't bringing anything up. I've tried using the search terms checkpoints, check point, multipoint, but to no avail.

Also, is there a way of forcing a layer to display above another? Ever since I converted a bunch of layers to PNG, they display strangely both in the SMBX Editor and the PGE editor.
There are a few A2XT levels that use multipoints. Descent of Nine and What's About Railways? both use it.

As for making a layer display above another, that's sort of not what SMBX layers are. "Layer" is a pretty poor term to be honest, as they're more like named groups. You can display Lua-drawn graphics with a specific order using the "WP" drawing commands, but otherwise you're stuck with using foreground objects.
Image
Image
Image
Image
Image
User avatar
ztarwuff
What the heck is a flair and why am I being asked to write one for my profile?
Posts: 553
Joined: 11 years ago
Location: Not a great mental space TBH.

Re: LunaDLL/LunaLUA help thread

Post by ztarwuff »

Hoeloe wrote:There are a few A2XT levels that use multipoints. Descent of Nine and What's About Railways? both use it.
Ah, that's great. I'll have a look at those two. Thank you.
As for making a layer display above another, that's sort of not what SMBX layers are. "Layer" is a pretty poor term to be honest, as they're more like named groups. You can display Lua-drawn graphics with a specific order using the "WP" drawing commands, but otherwise you're stuck with using foreground objects.
They're all foreground objects. I'll concentrate on multipoints for now.

EDIT: Whilst i'm at it, I might as well review your level.
User avatar
Axon
Posts: 29
Joined: 11 years ago
Location: At a place.

Re: LunaDLL/LunaLUA help thread

Post by Axon »

Does anyone know how to do autoscrolling with LunaLua? I know exactly how to do it with LunaDLL Autocode (use the PushScreenBoundary function), but I'm not sure what the equivalent in LunaLua is. I tried getting the boundary and setting the border values, but nothing sticks. For example, this:

Code: Select all

function onLoop()
	local sec = Section.get(1);
	Text.print("before: "..tostring(sec.boundary.right),0,64);
	sec.boundary.right = -19922;
	Text.print("after: "..tostring(sec.boundary.right),0,80);
end
doesn't actually change the right border position. I feel like I'm missing something obvious...
I'm using LunaLua v0.7.2.2.
User avatar
Rednaxela
Maker of Shenanigans
Posts: 897
Joined: 10 years ago
Pronouns: they/them
https://rednaxela.talkhaus.com

Re: LunaDLL/LunaLUA help thread

Post by Rednaxela »

Axon wrote:I feel like I'm missing something obvious...
I'm guessing the mistake is most likely that you're wanting to set this in what the editors call "Section 1". Getting the first section in LunaLua is Section.get(0), not Section.get(1)
User avatar
Axon
Posts: 29
Joined: 11 years ago
Location: At a place.

Re: LunaDLL/LunaLUA help thread

Post by Axon »

Rednaxela wrote:
Axon wrote:I feel like I'm missing something obvious...
I'm guessing the mistake is most likely that you're wanting to set this in what the editors call "Section 1". Getting the first section in LunaLua is Section.get(0), not Section.get(1)
No, that's not it; when I use Section.get(0), I get an error message telling me to use a number between 1 and 21. Even then, I feel the code should work regardless of the section the player is in.
User avatar
ztarwuff
What the heck is a flair and why am I being asked to write one for my profile?
Posts: 553
Joined: 11 years ago
Location: Not a great mental space TBH.

Re: LunaDLL/LunaLUA help thread

Post by ztarwuff »

I'm not entirely sure what's happening but my third Lua Checkpoint isn't triggering in my level: Gravity Falls. Would anybody be able to help me in figuring out why?

Granted, there's an axe in the third location, but there's an axe in all three locations. (It's there to reset the layers).

Code: Select all

multipoints = loadAPI("multipoints");

--Section 5 Checkpoint Bottom of Vertical Shaft
multipoints.addLuaCheckpoint(-119935, -120063, 4);
--Section  9 Empty Room
multipoints.addLuaCheckpoint(-39952, -40062, 8);
--Section 12 Before Boss
multipoints.addLuaCheckpoint(-20065, -19937, 11);
User avatar
GenesisJames
Music reviewer and drawer of cute girls.
Posts: 529
Joined: 11 years ago
Location: United States

Re: LunaDLL/LunaLUA help thread

Post by GenesisJames »

I'm having some trouble getting my filter to work. SAJewers gave me the code, and I put it in a text file, but when I play the level through the editor, it doesn't seem to make me that character. Anybody know what I might be doing wrong?
User avatar
Axon
Posts: 29
Joined: 11 years ago
Location: At a place.

Re: LunaDLL/LunaLUA help thread

Post by Axon »

Louiejub wrote:I'm having some trouble getting my filter to work. SAJewers gave me the code, and I put it in a text file, but when I play the level through the editor, it doesn't seem to make me that character. Anybody know what I might be doing wrong?
I don't know what your specific code is, but something like this should work to force a character:

Code: Select all

function onLoad()
	Player(1).character = CHARACTER_PEACH;
end
Or alternatively, if the previous code gives you an annoying invalid-player-pointer window thing:

Code: Select all

local iniDone = false;
function onLoop()
	if (not iniDone) then
		Player(1).character = CHARACTER_PEACH;
		iniDone = true;
	end
end
User avatar
GenesisJames
Music reviewer and drawer of cute girls.
Posts: 529
Joined: 11 years ago
Location: United States

Re: LunaDLL/LunaLUA help thread

Post by GenesisJames »

Axon wrote:
Louiejub wrote:I'm having some trouble getting my filter to work. SAJewers gave me the code, and I put it in a text file, but when I play the level through the editor, it doesn't seem to make me that character. Anybody know what I might be doing wrong?
I don't know what your specific code is, but something like this should work to force a character:

Code: Select all

function onLoad()
	Player(1).character = CHARACTER_PEACH;
end
Or alternatively, if the previous code gives you an annoying invalid-player-pointer window thing:

Code: Select all

local iniDone = false;
function onLoop()
	if (not iniDone) then
		Player(1).character = CHARACTER_PEACH;
		iniDone = true;
	end
end
This was the code that SAJewers gave me:

Code: Select all

function onLoad()
   if (player.isValid) then
      player.character = CHARACTER_TOAD;
   end

end
It could be very possible that I'm not putting it in the right place or something, but I put my txt file in the general folder where the level is and the folder where the music is, and neither of them worked. :|
I'll try your examples tomorrow.
User avatar
Rednaxela
Maker of Shenanigans
Posts: 897
Joined: 10 years ago
Pronouns: they/them
https://rednaxela.talkhaus.com

Re: LunaDLL/LunaLUA help thread

Post by Rednaxela »

Louiejub wrote:It could be very possible that I'm not putting it in the right place or something, but I put my txt file in the general folder where the level is and the folder where the music is, and neither of them worked. :|
I'll try your examples tomorrow.
If you level file is "worlds\episodeFolder\myLevel.lvl", this should be in the file "worlds\episodeFolder\myLevel\lunadll.lua"
The fact that you say "txt file" makes me wonder if you have a .txt extension when you should have a .lua extension perhaps also.
User avatar
GenesisJames
Music reviewer and drawer of cute girls.
Posts: 529
Joined: 11 years ago
Location: United States

Re: LunaDLL/LunaLUA help thread

Post by GenesisJames »

Rednaxela wrote:
Louiejub wrote:It could be very possible that I'm not putting it in the right place or something, but I put my txt file in the general folder where the level is and the folder where the music is, and neither of them worked. :|
I'll try your examples tomorrow.
If you level file is "worlds\episodeFolder\myLevel.lvl", this should be in the file "worlds\episodeFolder\myLevel\lunadll.lua"
The fact that you say "txt file" makes me wonder if you have a .txt extension when you should have a .lua extension perhaps also.
How would I make it a lua extension? That's probably it.
User avatar
Axon
Posts: 29
Joined: 11 years ago
Location: At a place.

Re: LunaDLL/LunaLUA help thread

Post by Axon »

Louiejub wrote: This was the code that SAJewers gave me:

Code: Select all

function onLoad()
   if (player.isValid) then
      player.character = CHARACTER_TOAD;
   end

end
Try replacing the two "player" with two "Player(1)", maybe.

edit:
Louiejub wrote: How would I make it a lua extension?
Open notepad, paste the code and it should give you the option to choose the extension you want when you "Save As".
Post Reply