pge projectsmw centralmario fan games galaxy

happy birthday talkhaus!!!

LunaDLL/LunaLUA help thread

The second SMBX collab!
User avatar
FrozenQuills
ok flair 2017
Posts: 711
Joined: 2 years ago
Location: my own skull, obviously

Re: LunaDLL/LunaLUA help thread

Postby FrozenQuills » 1 year ago

7NameSam wrote:I'm sorry, but I'm unfamiliar with Fader Libraries, and google doesn't give me any good results.
I just did something similar to this for one of my levels.
If you want a simple way to do it, make an 800x800 PNG image that's all black, then have this in the lua file:

Code: Select all

local black = Graphics.loadImage("black.png");
function onLoop()
  Graphics.drawImage(black,0,0,0.6);
end
Change 0.6 to whatever opacity you want. You can also use onLoopSection# where # is a section number to make it happen only for a section.
Image
Image
Image
SMBX Tileset Compiler and Separator
MaGLX2 Level Commentaries (updated up to 169th place) + My entry
The boss entry that made me eat a shoe.
Image

5th place counter: 4
(SMBX Forums CC11, SMBX Forums CC12, Endgame Madness Contest, SMWC Kaizo Contest 2016)

User avatar
Karatekid5
Welcome to the resort!
Posts: 33
Joined: 7 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL/LunaLUA help thread

Postby Karatekid5 » 1 year ago

Rockythechao wrote:It should be just the name of the function, so routine=scene_1, though if you want it to play as a cutscene, I suggest using scene=scene_1 instead.
I want it to be regular NPC dialogue, so I kept the routine tag. I added a line to the routine to print text to the screen, and when I press up the printed text appears, so talking to the NPC seems to be triggering the routine. Though, when I press up the NPC's CinematX dialogue still doesn't appear/activate.

Current code:

Code: Select all

cinematX = loadSharedAPI("cinematX")

cinematX.configExt ({hudBox=false, overrideNpcText=true, imageUi=false, textbloxSub=true})

function scene_1 ()
   Text.print("The routine is running",12,12)
   cinematX.startDialogExt (bellossom1, Bellossom, "Hello there! Welcome to the Starlight Resort!")
   cinematX.waitForDialog()
end
Yoshi Ambassador!
Image

User avatar
Rockythechao
Shapemorph the titlecard into the video, Hoeloe
Posts: 457
Joined: 3 years ago
First name: Michael
Pronouns: he/him/his
Location: Yes

Re: LunaDLL/LunaLUA help thread

Postby Rockythechao » 1 year ago

startDialogExt is just the text and a table of named arguments. Try this:

Code: Select all

cinematX = loadSharedAPI("cinematX")

cinematX.configExt ({hudBox=false, overrideNpcText=true, imageUi=false, textbloxSub=true})

function scene_1 ()
   local belActor1 = cinematX.getActorFromKey ("bellossom1")
   Text.print("The routine is running",12,12)
   cinematX.startDialogExt ("Hello there! Welcome to the Starlight Resort!", {actor=belActor1, name="Bellossom"})
   cinematX.waitForDialog()
end
I am fairly involved in A2XT's development as a content creator and programmer, but I am not the project lead nor am I responsible for half the things people keep attributing to me lol

Useful posts, discussions & resources for SMBX and A2XT

My art & audio thread
Tumblr, SoundCloud

Image

User avatar
Karatekid5
Welcome to the resort!
Posts: 33
Joined: 7 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL/LunaLUA help thread

Postby Karatekid5 » 1 year ago

I gave that code a try, the printed text still appears but the actor dialogue still doesn't initiate.

Here's the NPC's tags:

Code: Select all

{key=bellossom1, name=Bellossom, routine=scene_1}
Yoshi Ambassador!
Image

S1eth
Posts: 285
Joined: 2 years ago

Re: LunaDLL/LunaLUA help thread

Postby S1eth » 1 year ago

7NameSam wrote:
Wohlstand wrote:
7NameSam wrote:How do you use a PNG? I want to use one to make the screen darker in a section.
For this case you don't need for PNG BGO's, you can apply fader library and set black screen with half alpha-channel. However you still can make some foreground BGO with semitransparency and save it into PNG format (LunaLUA-SMBX supports mask-less true-transparency PNG images)
I'm sorry, but I'm unfamiliar with Fader Libraries, and google doesn't give me any good results.
http://engine.wohlnet.ru/pgewiki/Fade.lua

This wiki page explains how to use it. You'll want the "Simple Color Overlay" code.
Image

User avatar
gameguy888
Man, I dunno.
Posts: 17
Joined: 2 years ago
Contact:

Re: LunaDLL/LunaLUA help thread

Postby gameguy888 » 1 year ago

Rednaxela wrote:
Duker wrote:Stuff
More stuff
Thanks for the help! I got things working.
Words go here sometimes.

User avatar
Duker
The man with the fairy
Posts: 50
Joined: 7 years ago
Location: The Cold North

Re: LunaDLL/LunaLUA help thread

Postby Duker » 1 year ago

So I tried recreating the arrow-platform from SMB3 that change direction every time you land on it. The logic was simple but I'm having a weird issue where the player fall through the platform if it goes 2 or so blocks from the start position to either the left or the right.

http://imgur.com/7n85RRr

Code: Select all

local Testavator
local IsTouched = false

function onLoad()
	Testavator = Block.get(137)[1]
end
function onLoop()
	if(Testavator:collidesWith(player) == 1) then
		if(not IsTouched) then
			IsTouched = true
			if(CurrentMove == "right") then
				CurrentMove = "up1"
			elseif(CurrentMove == "up1") then
				CurrentMove = "left"
			elseif(CurrentMove == "left") then
				CurrentMove = "up2"
			elseif(CurrentMove == "up2") then
				CurrentMove = "right"
			end
		end
		if(CurrentMove == "right") then
			Testavator.x = Testavator.x+2
			player.x = player.x+2
		elseif(CurrentMove == "up1" or CurrentMove == "up2") then
			Testavator.y = Testavator.y-2
			player.y = player.y-2
		elseif(CurrentMove == "left") then
			Testavator.x = Testavator.x-2
			player.x = player.x-2
		end
			
	elseif(Testavator:collidesWith(player) == 0) then			
		IsTouched = false
	end
end
Kinda ugly code I know but it's just a quick proof of concept

What's also weird is that not the entire platform become fall-through, only the part going beyond some arbitrary point. Placing the platform somewhere else moves the fall-through point too.

Edit: Tried using an NPC platform (id 105 to be precise) instead and it works much better:

Code: Select all

	local tTestavator = NPC.get(105, -1)[1]

	if(tTestavator.ai1 == 1) then
			tTestavator.speedY = -0.065 --Should ideally be 0 but then the platform slowly loses altitude for whatever reason
		if(not IsTouched) then
			IsTouched = true
			if(CurrentMove == "right") then
				CurrentMove = "up1"
			elseif(CurrentMove == "up1") then
				CurrentMove = "left"
			elseif(CurrentMove == "left") then
				CurrentMove = "up2"
			elseif(CurrentMove == "up2") then
				CurrentMove = "right"
			end
		end
		if(CurrentMove == "right") then
			tTestavator.speedX = 1.5
		elseif(CurrentMove == "up1" or CurrentMove == "up2") then
			tTestavator.speedY = -1.5
		elseif(CurrentMove == "left") then
			tTestavator.speedX = -1.5
		end
	elseif(tTestavator.ai1 == 0) then
		IsTouched = false
		tTestavator.speedX = 0
	end
Occasionally I bring chipmunkcow into the mortal timespace: https://www.youtube.com/playlist?list=P ... D-ruRHC4ei

User avatar
Xirix
The British Palindrome
Posts: 378
Joined: 8 years ago

Re: LunaDLL/LunaLUA help thread

Postby Xirix » 1 year ago

With LunaLua is it now possible to change the graphics size of background objects, or is that still limited?

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 2 years ago

Re: LunaDLL/LunaLUA help thread

Postby Kevsoft » 1 year ago

Good suggestion!

No it is not possible yet, but I will add it to the Wishlist.

User avatar
gameguy888
Man, I dunno.
Posts: 17
Joined: 2 years ago
Contact:

Re: LunaDLL/LunaLUA help thread

Postby gameguy888 » 1 year ago

Is there a way to keep drawing an image even if the player pauses or opens a message box?
Words go here sometimes.

User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 2 years ago

Re: LunaDLL/LunaLUA help thread

Postby Kevsoft » 1 year ago

onHUDDraw-Event

S1eth
Posts: 285
Joined: 2 years ago

Re: LunaDLL/LunaLUA help thread

Postby S1eth » 1 year ago

I was trying to test a level using the particles.lua API (in the editor, smbx 2.0 beta) and got this error message (handled in pcall --> "could not open particle descriptor file"). After a few tests, I saw that using io.open always causes this error for me.

Code: Select all

 [string "mainV2.lua"]:140: attempt to call upvalue 'nativeIsSamePath' (a nil value) 
What causes this and how do I avoid it?
Image

User avatar
Hoeloe
One of them Lua people
Posts: 822
Joined: 5 years ago
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Postby Hoeloe » 1 year ago

S1eth wrote:I was trying to test a level using the particles.lua API (in the editor, smbx 2.0 beta) and got this error message (handled in pcall --> "could not open particle descriptor file"). After a few tests, I saw that using io.open always causes this error for me.

Code: Select all

 [string "mainV2.lua"]:140: attempt to call upvalue 'nativeIsSamePath' (a nil value) 
What causes this and how do I avoid it?
This is an error caused by mainv2.lua being newer than lunadll.dll. You need to download the latest version of lunadll from the Github.
Image
Image
Image
Image

ShadowStarX
Posts: 3
Joined: 1 year ago
Location: Hungary

Re: LunaDLL/LunaLUA help thread

Postby ShadowStarX » 1 year ago

Hi!
Can I get some scripts, I need 2 of them:

1) Cyan and orange lasers from Undertale
If you don't know how they work: if the player is moving and interacts with the cyan lasers, he/she will get hurt, but he/she won't get hurt if stand still. Vice versa with the orange lasers.

2) Glued floor
Basically, if Mario is on the floor, he can only jump, but he cannot move by walking or running.

And an important side-info: if possible, I'd prefer NON SMBX 2.0 LunaLUA. (I have a lot of issues with that)

User avatar
Sturg
Gets his freak on with VGM
Posts: 521
Joined: 6 years ago
First name: sturgyman
Location: - :noiƚɒɔo⅃
Contact:

Re: LunaDLL/LunaLUA help thread

Postby Sturg » 1 year ago

ShadowStarX wrote: 2) Glued floor
Basically, if Mario is on the floor, he can only jump, but he cannot move by walking or running.
Actually you can do this fairly simply without Lua by placing a quicksand tile over a solid block.
Image
Image
Image
Image
now let me into your cool gang

User avatar
WestonSmith
Bunny
Posts: 147
Joined: 4 years ago

Re: LunaDLL/LunaLUA help thread

Postby WestonSmith » 1 year ago

Just downloaded the latest editor and lua today. Trying to get some features to work, figured out a few on my own, but definitely have questions.

(1) For particles, its super easy to make effects follow a whole screen, but how do I place something in a particular x/y location? Example, setting a small_fire effect on a tile right above a background object to mimic a torch?

(2) I've seen a raocoin tracker in pyro's videos (i.e. a silhouette appears after you grab a raocoin), but I have no idea how to get it working. Furthermore, I can't find the folder with the silhouette graphic in it (which I'd like the ability to modify).

(3) How do I use the new launcher?

(4) Is CinematX compatible with the SMB3 overhaul mod? I'm asking because I figure the SMB3 HUD would conflict with the CInematX dialogue box.

As a general question, is there any sort of example pack available for all these nifty mods? I can figure a lot of stuff out on my own given something to work off of (script / code isn't completely foreign to me), but by gosh is it ever confusing without an example.

User avatar
Hoeloe
One of them Lua people
Posts: 822
Joined: 5 years ago
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Postby Hoeloe » 1 year ago

WestonSmith wrote:(1) For particles, its super easy to make effects follow a whole screen, but how do I place something in a particular x/y location? Example, setting a small_fire effect on a tile right above a background object to mimic a torch?

(2) I've seen a raocoin tracker in pyro's videos (i.e. a silhouette appears after you grab a raocoin), but I have no idea how to get it working. Furthermore, I can't find the folder with the silhouette graphic in it (which I'd like the ability to modify).

1. When creating an emitter, the first two arguments are x and y coordinates. Use those to place an emitter in the world, rather than have it follow the camera.

2. The raocoin tracker is custom code in the lunaworld.lua file for the episode. The silhouette graphic is also there. If you're making something for A2XT, you can override the silhouette graphic by creating a file called "raocoin_taken.png" in your level folder.
Image
Image
Image
Image

User avatar
7NameSam
hey
Posts: 210
Joined: 2 years ago
Pronouns: he/him/his

Re: LunaDLL/LunaLUA help thread

Postby 7NameSam » 1 year ago

Help, I can't get the onKillNPC function to work, specifically when calling for a specific npc killed?

Code: Select all

function onNPCKill(eventObj,killedNPC,killReason)
	if killedNPC == 1 then
		Level.exit()
	end
end
WON'T WORK.gif
WON'T WORK.gif (107.66 KiB) Viewed 1386 times
I'm using smbx 2.0 in the gif, and killReason works, So I'm not sure what I'm doing wrong.
Image

User avatar
Hoeloe
One of them Lua people
Posts: 822
Joined: 5 years ago
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Postby Hoeloe » 1 year ago

7NameSam wrote:Help, I can't get the onKillNPC function to work, specifically when calling for a specific npc killed?

Code: Select all

function onNPCKill(eventObj,killedNPC,killReason)
	if killedNPC == 1 then
		Level.exit()
	end
end
WON'T WORK.gif
I'm using smbx 2.0 in the gif, and killReason works, So I'm not sure what I'm doing wrong.
The "killedNPC" variable is an NPC object, not the ID of the NPC. You need to check the NPCs ID.
Image
Image
Image
Image

User avatar
WestonSmith
Bunny
Posts: 147
Joined: 4 years ago

Re: LunaDLL/LunaLUA help thread

Postby WestonSmith » 1 year ago

Just wanted to give a quick thanks to Hoeloe. Got the particles working just fine.

Also a big thanks to everyone involved with building these nifty Lua shenanigans. You folks are brilliant.

User avatar
Ivy
Posts: 1952
Joined: 3 years ago
Contact:

Re: LunaDLL/LunaLUA help thread

Postby Ivy » 1 year ago

just to clarify, hoeloe means you have to add ".id" to the end of your killedNPC when comparing it to the id in question
3DS FC: 2793-0650-7690 | Switch: SW-2766-9108-9399 | Steam: ivysaur1996 (that ivy guy)
Many thanks to GlitchedGhost and Rockythechao for the amazing paper Demo animation!

__a
Posts: 1
Joined: 1 year ago

Re: LunaDLL/LunaLUA help thread

Postby __a » 1 year ago

EXAMPLE CODE of 'pnpc.lua':
I believe it works perfectly. Not sure if the code is perfect, though.
This may help new users of lunalua to understand 'pnpc.lua'.
(see attachment)
Attachments
__pnpc example.zip
(3.23 KiB) Downloaded 17 times

User avatar
Hoeloe
One of them Lua people
Posts: 822
Joined: 5 years ago
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Postby Hoeloe » 1 year ago

__a wrote:EXAMPLE CODE of 'pnpc.lua':
I believe it works perfectly. Not sure if the code is perfect, though.
This may help new users of lunalua to understand 'pnpc.lua'.
(see attachment)
You know you don't need to manually create a hitbox for the player. You can just use the player in place of a collider and the library will do that automatically. The same is true of NPCs. Line 86 can just be:

Code: Select all

if(colliders.collide(player, v)) then
Also your "round" function is flawed. You return the rounded remainder, so it will only ever return 0 or 1. I'm also not sure why you define "npc.dir" when you then put it inside the "data" table and only ever refer to it from there.

I wouldn't recommend using this code to learn from, as it's rather messy, using outdated functions like "findnpcs", and contains a lot of unnecessary code.
Image
Image
Image
Image

User avatar
7NameSam
hey
Posts: 210
Joined: 2 years ago
Pronouns: he/him/his

Re: LunaDLL/LunaLUA help thread

Postby 7NameSam » 1 year ago

How do you use pnpc.lua?
Image

User avatar
FrozenQuills
ok flair 2017
Posts: 711
Joined: 2 years ago
Location: my own skull, obviously

Re: LunaDLL/LunaLUA help thread

Postby FrozenQuills » 1 year ago

So I'm trying to detect whether the player is in the air (so detecting if it has jumped doesn't work for this)
The closest thing I could find is player memory offset 0x146 which is zero if the player is in the air or on an NPC.
Is there a way to detect that the player is only in the air and not on an NPC? Thanks.

EDIT: Willhart told me to also check 0x176 which is the sprite being stood on, so this is resolved now.
EDIT2: Turns out detecting something in the air is a bit harder than just checking that since jumping while on a sprite IMMEDIATELY sets 0x176 to zero, so I can't check if the player is in the air in one frame for my purposes. I used a previous state buffer for 0x176 to solve this.
Image
Image
Image
SMBX Tileset Compiler and Separator
MaGLX2 Level Commentaries (updated up to 169th place) + My entry
The boss entry that made me eat a shoe.
Image

5th place counter: 4
(SMBX Forums CC11, SMBX Forums CC12, Endgame Madness Contest, SMWC Kaizo Contest 2016)


Return to “A2XT”

Who is online

Users browsing this forum: No registered users and 2 guests

cron