Need help with lua? - LunaLua General Help

This is the place for discussion and support for LunaLua and related modifications and libraries.
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?
User avatar
Daring Tombstone
Swooper
Swooper
Posts: 115
Joined: Mon Aug 28, 2017 10:57 pm
Flair: Sad I didn't fight Jirachi
Current Project: Something Maybe
Chat Username: Chaperone

Re: Need help with lua? - LunaLua General Help

Postby Daring Tombstone » Tue Jun 26, 2018 8:30 pm

Hoeloe wrote: If it spawns in via generator, the mouser doesn't exist when onStart is called. onStart is only run once when the level starts. If the mouser doesn't exist at that point, obviously it won't be affected.
Ah okay. I wasn't aware setting npc codes wouldn't work in this scenario. I was in the mindset that it would just set the hits even if it didn't exist at that particular moment. Thank you for pointing that out. Hope you all have a great day.
Happy Dance
Image
Check out my completed episode
Spoiler: show
Image
Check out my halloween level
Spoiler: show
Image

User avatar
DarvinosBobaFett
Koopa Troopa
Koopa Troopa
Posts: 24
Joined: Tue Jun 26, 2018 8:26 pm
Current Project: Super Mario The Chaos,Huge Of Darkness 1.4.4(38A) Progress is 15% Before Post the Fourm.
Chat Username: KingBill666

Re: Need help with lua? - LunaLua General Help

Postby DarvinosBobaFett » Thu Jun 28, 2018 6:12 am

How About a Parallex in a Background for lua?
Playing San Andreas Or Something.
Muh Grand Theft Auto: San Anderas Quotes
All We Had To Do Follow The Damn Train CJ!-Big Smoke-
After 4 Months of No Active Seems Like Aren't Active the Forums :(

I am currently Paricipating Projects or i Supporter:
Image
Image
Image
Image
Image[/spoiler]
Bruh i do someting make a custom graphics or levels.
(Due To Delaying Of Mistaken Time!!!)
Going My Home Is Fun!!!

User avatar
Daring Tombstone
Swooper
Swooper
Posts: 115
Joined: Mon Aug 28, 2017 10:57 pm
Flair: Sad I didn't fight Jirachi
Current Project: Something Maybe
Chat Username: Chaperone

Re: Need help with lua? - LunaLua General Help

Postby Daring Tombstone » Tue Jul 10, 2018 6:26 pm

DarvinosBobaFett wrote:
Thu Jun 28, 2018 6:12 am
How About a Parallex in a Background for lua?
I know this is 2 weeks late but no one seemed to answer and I'm not exactly a lua expert. I haven't done paralax myself but you can use the paralX API which is included in the latest smbx beta 3 editor. It also comes with a level that showcases the paralX feature called "Willhart-Shogon" that's in the "HONK" worlds folder that has the lua code you can study to have a parallax affect in your level.
Happy Dance
Image
Check out my completed episode
Spoiler: show
Image
Check out my halloween level
Spoiler: show
Image

User avatar
not rockythechao
Pokey
Pokey
Posts: 215
Joined: Sat Dec 12, 2015 1:00 am
Current Project: A2XT2 and a few others

Re: Need help with lua? - LunaLua General Help

Postby not rockythechao » Thu Jul 12, 2018 5:19 am

It's worth noting that the shogun level along with all of Willhart's other contributions will be removed in beta 4 (long story short, he's an unrepentant stalker) but the paralX library is also getting replaced with one that allows defining parallax backgrounds via ini files.
Some people just cannot avoid the ads on MediaFire, even with both common sense and popup blockers. It's always a good idea to provide an alternate download link with an ad-free file host such as Dropbox or Google Drive.

I do music, graphics, lua, birthdays, bachelor parties, bar mitzvahs, long walks on the beach, driving through the scenic countryside with my fabulous mutlicolored mustache flowing in the wind, living life on the edge and not playing by the rules, awkwardly standing in the corner of the room with my GBC during important company meetings, all my own stunts and baking cookies with criminally-high quantities of butter
Spoiler: show
Spinda wrote:gdi rocky
Waddle Derp wrote:rocky what the fuck
rockythechao wrote:gfdi me
Bread wrote:rocky
what did you do
ROCKY
Enjl wrote:you're walking a rocky road
Quantix wrote:jesus christ rocky
rockythechao wrote:the sin is indeed mine

User avatar
Teemster2
Mega Mole
Mega Mole
Posts: 297
Joined: Sat Jan 18, 2014 11:56 am

Re: Need help with lua? - LunaLua General Help

Postby Teemster2 » Thu Jul 12, 2018 10:19 am

not rockythechao wrote:
Thu Jul 12, 2018 5:19 am
It's worth noting that the shogun level along with all of Willhart's other contributions will be removed in beta 4 (long story short, he's an unrepentant stalker) but the paralX library is also getting replaced with one that allows defining parallax backgrounds via ini files.
I thought his stuff was already removed. Not a big loss here. I do wish Horikawa would come back and be more active on the project. I doubt Will is still around (Nobody wants him here) and even if he is what can he really do to her over the internet? Maybe she just had burnout. I don't really know. The dev teams needs all of the help they can get right now and losing a key player and lead dev from the team sucks. Sorry for going off topic.
I want to say thank you to God for every day he gives me on this planet and for the chance to be in a better place when I die.

User avatar
not rockythechao
Pokey
Pokey
Posts: 215
Joined: Sat Dec 12, 2015 1:00 am
Current Project: A2XT2 and a few others

Re: Need help with lua? - LunaLua General Help

Postby not rockythechao » Fri Jul 13, 2018 12:50 pm

Willhart's contributions have already been removed from the smbx2 dev repository, it's just that Beta 4 isn't ready for a public release yet.
Some people just cannot avoid the ads on MediaFire, even with both common sense and popup blockers. It's always a good idea to provide an alternate download link with an ad-free file host such as Dropbox or Google Drive.

I do music, graphics, lua, birthdays, bachelor parties, bar mitzvahs, long walks on the beach, driving through the scenic countryside with my fabulous mutlicolored mustache flowing in the wind, living life on the edge and not playing by the rules, awkwardly standing in the corner of the room with my GBC during important company meetings, all my own stunts and baking cookies with criminally-high quantities of butter
Spoiler: show
Spinda wrote:gdi rocky
Waddle Derp wrote:rocky what the fuck
rockythechao wrote:gfdi me
Bread wrote:rocky
what did you do
ROCKY
Enjl wrote:you're walking a rocky road
Quantix wrote:jesus christ rocky
rockythechao wrote:the sin is indeed mine

User avatar
Sewpah
Volcano Lotus
Volcano Lotus
Posts: 552
Joined: Wed Jul 09, 2014 10:07 pm
Current Project: A 2.0 Beta 3 Project, and other stuff
Chat Username: ChadWardenBeBallin

Re: Need help with lua? - LunaLua General Help

Postby Sewpah » Mon Jul 30, 2018 4:15 pm

I'm trying to create a power-up that replaces an iceball (npc-265) with a mushroom block (npc-154), and when I'm trying to test the level, it just states an error saying "unexpected symbol near '265'" and runs the level like normal without the powerup. And when I tried to fix the code, nothing happens. The iceballs are still intact. Is this code outdated or something or am I doing something wrong?:

Code: Select all

NPCMemSet,265,0xE2,154,0,0,w
Image
Spoiler: show
Image
Image
Image
Image
Video Game Licenses:
Image
Image

Stuff I support:
-The Invasion 3: Shadow Star
Image

User avatar
Daring Tombstone
Swooper
Swooper
Posts: 115
Joined: Mon Aug 28, 2017 10:57 pm
Flair: Sad I didn't fight Jirachi
Current Project: Something Maybe
Chat Username: Chaperone

Re: Need help with lua? - LunaLua General Help

Postby Daring Tombstone » Mon Jul 30, 2018 7:08 pm

Sewpah wrote:
Mon Jul 30, 2018 4:15 pm
I'm trying to create a power-up that replaces an iceball (npc-265) with a mushroom block (npc-154), and when I'm trying to test the level, it just states an error saying "unexpected symbol near '265'" and runs the level like normal without the powerup. And when I tried to fix the code, nothing happens. The iceballs are still intact. Is this code outdated or something or am I doing something wrong?:

Code: Select all

NPCMemSet,265,0xE2,154,0,0,w
With your code I pasted it into a text file named lunadll and it worked for me with the SMBX2 beta 3 version. The problem I had though was that it firing mushroom blocks as big as the snowball itself, so I had to make a npc-265 text file that change the height and width of the snowball to 32x32. It works but I'm sure there's another way of doing this code that I'm not aware of (since my lunalua skills are bad).

Speaking of my lunalua skills. I'm attempting to make a blooper fly through the air (like they sometimes did in SMB1) without being in water using this.

Code: Select all

function onTick()
	for k,v in pairs(NPC.get(235)) do
		v:mem (0x1C, FIELD_WORD,2)
	end
end
The blooper acts like it's in water (it floats towards the ground gently rather than just falling) but it doesn't do anything other than sit. Is there something else I should add or is it just not possible to do this without several walls of script?
Happy Dance
Image
Check out my completed episode
Spoiler: show
Image
Check out my halloween level
Spoiler: show
Image

User avatar
Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 7575
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Tue Jul 31, 2018 3:38 am

It's not possible to do that without rewriting the blooper. The blooper does its own underwater checks just before it executes its behaviour, overwriting your attempts. The same goes for wanting to make Boos move while the player faces them.
ImageImageImageImage
ImageImageImageImageImageImage

User avatar
Sewpah
Volcano Lotus
Volcano Lotus
Posts: 552
Joined: Wed Jul 09, 2014 10:07 pm
Current Project: A 2.0 Beta 3 Project, and other stuff
Chat Username: ChadWardenBeBallin

Re: Need help with lua? - LunaLua General Help

Postby Sewpah » Tue Jul 31, 2018 3:12 pm

Daring Tombstone wrote:
Mon Jul 30, 2018 7:08 pm
Sewpah wrote:
Mon Jul 30, 2018 4:15 pm
I'm trying to create a power-up that replaces an iceball (npc-265) with a mushroom block (npc-154), and when I'm trying to test the level, it just states an error saying "unexpected symbol near '265'" and runs the level like normal without the powerup. And when I tried to fix the code, nothing happens. The iceballs are still intact. Is this code outdated or something or am I doing something wrong?:

Code: Select all

NPCMemSet,265,0xE2,154,0,0,w
With your code I pasted it into a text file named lunadll and it worked for me with the SMBX2 beta 3 version. The problem I had though was that it firing mushroom blocks as big as the snowball itself, so I had to make a npc-265 text file that change the height and width of the snowball to 32x32. It works but I'm sure there's another way of doing this code that I'm not aware of (since my lunalua skills are bad).
Oh, I was putting it in a .lua file rather than a .txt file. Thanks!
Image
Spoiler: show
Image
Image
Image
Image
Video Game Licenses:
Image
Image

Stuff I support:
-The Invasion 3: Shadow Star
Image

User avatar
Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 7575
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Tue Jul 31, 2018 4:21 pm

Sewpah wrote:
Tue Jul 31, 2018 3:12 pm
Daring Tombstone wrote:
Mon Jul 30, 2018 7:08 pm
Sewpah wrote:
Mon Jul 30, 2018 4:15 pm
I'm trying to create a power-up that replaces an iceball (npc-265) with a mushroom block (npc-154), and when I'm trying to test the level, it just states an error saying "unexpected symbol near '265'" and runs the level like normal without the powerup. And when I tried to fix the code, nothing happens. The iceballs are still intact. Is this code outdated or something or am I doing something wrong?:

Code: Select all

NPCMemSet,265,0xE2,154,0,0,w
With your code I pasted it into a text file named lunadll and it worked for me with the SMBX2 beta 3 version. The problem I had though was that it firing mushroom blocks as big as the snowball itself, so I had to make a npc-265 text file that change the height and width of the snowball to 32x32. It works but I'm sure there's another way of doing this code that I'm not aware of (since my lunalua skills are bad).
Oh, I was putting it in a .lua file rather than a .txt file. Thanks!
Yeah uh. That's lunadll code. Not lunalua. Deprecated since 2016. Here's the lua alternative if you're interested. It's a bit longer but also more comprehensible:

Code: Select all

function onTickEnd()
	for _,npc in ipairs(NPC.get(265, player.section) do
		npc:transform(154)
	end
end
Grabs all ID 265 NPCs in the player's section and transforms them into NPC 154.
With minor alterations to this code you can do a lot more. "npc" has all of these instance variables and they can be manipulated.
https://wohlsoft.ru/pgewiki/NPC_(class)
ImageImageImageImage
ImageImageImageImageImageImage

User avatar
Daring Tombstone
Swooper
Swooper
Posts: 115
Joined: Mon Aug 28, 2017 10:57 pm
Flair: Sad I didn't fight Jirachi
Current Project: Something Maybe
Chat Username: Chaperone

Re: Need help with lua? - LunaLua General Help

Postby Daring Tombstone » Tue Jul 31, 2018 10:08 pm

I figured lunadll was depreciated so thanks for correcting me in that. Also thanks for the blooper situation and being a part of my lua noobness.
Happy Dance
Image
Check out my completed episode
Spoiler: show
Image
Check out my halloween level
Spoiler: show
Image

User avatar
IttaBaby
Koopa Troopa
Koopa Troopa
Posts: 25
Joined: Sat Apr 08, 2017 8:19 pm
Chat Username: IttaBaby

Re: Need help with lua? - LunaLua General Help

Postby IttaBaby » Tue Aug 14, 2018 8:36 pm

I used to know how to have enemies spawn different projectiles than usual, but somehow can't anymore? Either due to forgetfulness or changing times.
Another thing is, I have a lot of trouble with everyone's explanations because of how I learn. I'm much better at dissecting and understanding an example. May I have help?

User avatar
Snowy_Desert
Blooper
Blooper
Posts: 196
Joined: Fri Mar 16, 2018 2:09 pm
Flair: The Icy Pharaoh
Current Project: Funky no CGFX episode.
Chat Username: This is a mystery.

Re: Need help with lua? - LunaLua General Help

Postby Snowy_Desert » Tue Aug 28, 2018 2:06 pm

How can i replace sounds?
Signatures are boring, they doesn't do anything.

User avatar
Notxarb
Swooper
Swooper
Posts: 101
Joined: Sat Aug 06, 2016 6:59 pm
Flair: Hi
Current Project: MMX (Mario Maker X) -> including [Super Mario 64X], [Super Mario Universe], [Super Mario Acclivity]
Chat Username: Novarender

Re: Need help with lua? - LunaLua General Help

Postby Notxarb » Sat Sep 15, 2018 5:08 pm

How can I make normal bullet bills (ones shot from a bill blaster) die upon contact of a block, like the ones shot from the Billy Gun?
I believe and I accept Jesus Christ as my Lord and Savior. If you do, put this in your signature.

Ten points to you if you can figure out what my name is.

Look, I'm not telling you what to do but STOP READING THIS SENTENCE

Hagrid: "You're a wizard, Harry!"
Harry: "You're a hairy wizard!"

User avatar
FireyPaperMario
Peach
Peach
Posts: 5081
Joined: Sat Sep 27, 2014 1:39 pm
Flair: 90's kid born in late 1993 ^_^
Current Project: As of now: SEGA Mega Drive/Genesis GFXs in SMBX
Chat Username: Shin FireyPaperMario
Contact:

Re: Need help with lua? - LunaLua General Help

Postby FireyPaperMario » Sat Sep 22, 2018 2:05 pm

I had this thought on a "LunaLua" script power-up quite recently while I was working my 2 paid jobs in real life:

I wonder if it's possible to make a type of shield power-up* that won't make you die or lose your current power-up form when you take damage from a enemy and/or hazard (Y'all know, a extra hit! :P ). If anyone HAVEN'T made this Lua-Power-Up, I might go make this Lua code once i get a new W10 Laptop!

*Like in the Mega Drive/Genesis masterpiece, Sonic the Hedgehog! ^_^"

User avatar
Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 7575
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Sat Sep 22, 2018 3:41 pm

MarioRPGExpert93 wrote:
Sat Sep 22, 2018 2:05 pm
I had this thought on a "LunaLua" script power-up quite recently while I was working my 2 paid jobs in real life:

I wonder if it's possible to make a type of shield power-up* that won't make you die or lose your current power-up form when you take damage from a enemy and/or hazard (Y'all know, a extra hit! :P ). If anyone HAVEN'T made this Lua-Power-Up, I might go make this Lua code once i get a new W10 Laptop!

*Like in the Mega Drive/Genesis masterpiece, Sonic the Hedgehog! ^_^"
Certainly possible. Good luck.
ImageImageImageImage
ImageImageImageImageImageImage

User avatar
FireyPaperMario
Peach
Peach
Posts: 5081
Joined: Sat Sep 27, 2014 1:39 pm
Flair: 90's kid born in late 1993 ^_^
Current Project: As of now: SEGA Mega Drive/Genesis GFXs in SMBX
Chat Username: Shin FireyPaperMario
Contact:

Re: Need help with lua? - LunaLua General Help

Postby FireyPaperMario » Sat Sep 22, 2018 4:12 pm

Enjl wrote:
Sat Sep 22, 2018 3:41 pm
Certainly possible. Good luck.
Why thank you very much, ^_^

User avatar
marquise
Goomba
Goomba
Posts: 3
Joined: Sat Sep 29, 2018 5:20 pm
Flair: Family man
Chat Username: marquise

Re: Need help with lua? - LunaLua General Help

Postby marquise » Sat Sep 29, 2018 5:31 pm

I’ve made a custom sprite for the dry bones npc which has 7 frames, this causes the the collapse frames to not work. Is it possible to get the frames working with some sort of lua code ?

User avatar
Daring Tombstone
Swooper
Swooper
Posts: 115
Joined: Mon Aug 28, 2017 10:57 pm
Flair: Sad I didn't fight Jirachi
Current Project: Something Maybe
Chat Username: Chaperone

Re: Need help with lua? - LunaLua General Help

Postby Daring Tombstone » Thu Nov 01, 2018 3:43 pm

Messing with the LsBreathMeter API and wanted to have it where if a player hits a resprited axe (a bubble) it would give air back to the player using onNPCKill. However if the axe(bubble) goes offscreen it dies and gives the player air anyways. Can I set it where it only gives air back if the player kills it?
Happy Dance
Image
Check out my completed episode
Spoiler: show
Image
Check out my halloween level
Spoiler: show
Image


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest