(shouting)

LunaDLL/LunaLUA help thread

The second SMBX collab!
User avatar
Karatekid5
Welcome to the resort!
Posts: 78
Joined: 14 years ago
Location: Pennsylvania
Contact:

Re: LunaDLL/LunaLUA help thread

Post by Karatekid5 »

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: 291
Joined: 9 years ago

Re: LunaDLL/LunaLUA help thread

Post by S1eth »

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: 28
Joined: 9 years ago

Re: LunaDLL/LunaLUA help thread

Post by gameguy888 »

Rednaxela wrote:
Duker wrote:Stuff
More stuff
Thanks for the help! I got things working.
Words go here sometimes.
User avatar
Duker
I post u2be tags I guess
Posts: 272
Joined: 13 years ago
Location: The Comment Section

Re: LunaDLL/LunaLUA help thread

Post by Duker »

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
fart.
User avatar
Xirix
The British Palindrome
Posts: 519
Joined: 14 years ago

Re: LunaDLL/LunaLUA help thread

Post by Xirix »

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: 9 years ago

Re: LunaDLL/LunaLUA help thread

Post by Kevsoft »

Good suggestion!

No it is not possible yet, but I will add it to the Wishlist.
User avatar
gameguy888
Man, I dunno.
Posts: 28
Joined: 9 years ago

Re: LunaDLL/LunaLUA help thread

Post by gameguy888 »

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: 9 years ago

Re: LunaDLL/LunaLUA help thread

Post by Kevsoft »

onHUDDraw-Event
S1eth
Posts: 291
Joined: 9 years ago

Re: LunaDLL/LunaLUA help thread

Post by S1eth »

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
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Post by Hoeloe »

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
Image
ShadowStarX
Posts: 8
Joined: 8 years ago
Location: Hungary

Re: LunaDLL/LunaLUA help thread

Post by ShadowStarX »

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: 709
Joined: 13 years ago
First name: sturgyman
Location: - :noiƚɒɔo⅃
Contact:

Re: LunaDLL/LunaLUA help thread

Post by Sturg »

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.
ImageImage
Image ImageImage
RIP FISH NIPPLE BANNER
User avatar
WestonSmith
Bunny
Posts: 188
Joined: 11 years ago

Re: LunaDLL/LunaLUA help thread

Post by WestonSmith »

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
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Post by Hoeloe »

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
Image
User avatar
7NameSam
hey
Posts: 248
Joined: 9 years ago
Pronouns: they/them

Re: LunaDLL/LunaLUA help thread

Post by 7NameSam »

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 8564 times
I'm using smbx 2.0 in the gif, and killReason works, So I'm not sure what I'm doing wrong.
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Post by Hoeloe »

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
Image
User avatar
WestonSmith
Bunny
Posts: 188
Joined: 11 years ago

Re: LunaDLL/LunaLUA help thread

Post by WestonSmith »

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: 2387
Joined: 10 years ago
Pronouns: any
Contact:
https://ivy.talkhaus.com/

Re: LunaDLL/LunaLUA help thread

Post by Ivy »

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 (ivy)
__a
Posts: 1
Joined: 8 years ago

Re: LunaDLL/LunaLUA help thread

Post by __a »

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 119 times
User avatar
Hoeloe
A2XT person
Posts: 1016
Joined: 12 years ago
Pronouns: she/her
Location: Spaaace

Re: LunaDLL/LunaLUA help thread

Post by Hoeloe »

__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
Image
User avatar
7NameSam
hey
Posts: 248
Joined: 9 years ago
Pronouns: they/them

Re: LunaDLL/LunaLUA help thread

Post by 7NameSam »

How do you use pnpc.lua?
User avatar
FrozenQuills
hehe haha 2024
Posts: 843
Joined: 9 years ago
Location: my skull

Re: LunaDLL/LunaLUA help thread

Post by FrozenQuills »

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
avatar by crayonchewer!
Image
Image
Image
SMBX Tileset Compiler and Separator
The boss entry that made me eat a shoe.

5th place counter: 5
(SMBX Forums CC11, SMBX Forums CC12, Endgame Madness Contest, SMWC Kaizo Contest 2016, SMWC 24hr Contest 2018)
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4200
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL/LunaLUA help thread

Post by SAJewers »

Rednaxela wrote:
SAJewers wrote:any updates on the ticking P-switch thingy?
Ahhh right. Sorry about that. Life has been a bit hectic recently and that item slipped off my radar for a bit.
Once I get time for it, it's probably a quick 1-evening type of task.

Any target date of when you want it for? I know things are in the level review stage right now right? I'll try to not let it slip off my radar in any case.
ping
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
User avatar
Kevsoft
LunaLua Master Developer
Posts: 83
Joined: 9 years ago

Re: LunaDLL/LunaLUA help thread

Post by Kevsoft »

The P-Switch can already be controlled with Misc.doPSwitch().
User avatar
SAJewers
ASMBXT Level Wrangler/A2XT Project Coordinator /AAT Level Designer
Posts: 4200
Joined: 11 years ago
Location: Nova Scotia

Re: LunaDLL/LunaLUA help thread

Post by SAJewers »

OK, so what's the code that needs to be used?
ImageImageImageImageImage | Image | Image
Sharenite | RetroAchievements | NameMC | IGDB
Post Reply