LunaLua Offical Thread - SMBX Usermod Framework

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?

Shall I steam some LunaLua live development?

Yes
200
92%
No
17
8%
 
Total votes: 217
underFlo
Wart
Wart
Posts: 4456
Joined: Mon Jul 14, 2014 10:44 am
Flair: sup im lesbiab
Pronouns: They/She
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby underFlo » Thu Feb 04, 2016 1:43 pm

If you want this to be 100% exact, replace the 65 in the code with (1000/15.6) since that's the actual FPS SMBX runs at. As such, 3900 should be 60000/15.6

MidiGuyDP
Tweeter
Tweeter
Posts: 147
Joined: Fri Jan 17, 2014 2:28 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby MidiGuyDP » Thu Feb 04, 2016 1:52 pm

Cool. I got it in. Works great, thank you! :)

Though had another question about it, I would like to have it so that it shows the Zeroes for in the seconds and milliseconds section. At the moment, it's doing stuff like "1,2,3,4,5,6,7,8,9,10" though I'm looking for "01,02,03,04,05,06,07,08,09,10").

What would I need to add to make it do that?

TDK
Phanto
Phanto
Posts: 1440
Joined: Wed Nov 11, 2015 12:26 pm
Flair: Retired

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby TDK » Thu Feb 04, 2016 2:24 pm

MidiGuyDP wrote:Cool. I got it in. Works great, thank you! :)

Though had another question about it, I would like to have it so that it shows the Zeroes for in the seconds and milliseconds section. At the moment, it's doing stuff like "1,2,3,4,5,6,7,8,9,10" though I'm looking for "01,02,03,04,05,06,07,08,09,10").

What would I need to add to make it do that?
To do that you would need to change the code:
E.g. for the centiseconds you would change this line:

Code: Select all

local cent = tostring(math.floor((100 * t/65)) %100)
To this:

Code: Select all

local cent = math.floor((100 * t/65)) %100	
if cent < 10 then
	cent = "0"..tostring(cent)
else
	cent = tostring(cent)
end

MidiGuyDP
Tweeter
Tweeter
Posts: 147
Joined: Fri Jan 17, 2014 2:28 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby MidiGuyDP » Thu Feb 04, 2016 3:07 pm

Thanks, that worked wonders.

There's one more thing I need to know. I'd like to make the timer move to another part of the screen when the goal is obtained. Also would be awesome if I could make it bigger too.

I've been trying to Text.print it to a different location for when the goal event happens, I'm not sure how to go about doing it. Gonna keep trying though. :)

EDIT: Also, is there a function to make checkpoints not work, in other words force the player to start from the beginning all the time (Since the timer will start at 0 even if you start from a check point, though another remedy to that would be just to remove check points, but eh)

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Thu Feb 04, 2016 11:15 pm

idk something like

Code: Select all

function onStart()
	for k, check in pairs (NPC.get(192, -1)) do
		check:kill()
	end
end
will kill them. But why wouldn't you just remove the checkpoints from the level in the first place?

MidiGuyDP
Tweeter
Tweeter
Posts: 147
Joined: Fri Jan 17, 2014 2:28 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby MidiGuyDP » Fri Feb 05, 2016 8:35 am

Thanks for the code. It'll save me the trouble of looking for the checkpoints to delete them. ;)

EDIT: Alrighty, there's one more function I want to get in there, though I'm having difficulty. I basically want to make the life count always reset to like 3 or something so that game overs don't happen after losing all lives doing time trail attempts.

I thought perhaps I could use this example

Code: Select all

function onLoad()
    player:mem(0xF0, FIELD_WORD, 1)
end
And change it to this:

Code: Select all

function onLoad()
    player:mem(0x00B2C5AC, FIELD_FLOAT, 3)
end
Which is the memory address for the life count.

Though while I don't have any errors, it doesn't seem to do the trick, Am I close?

FanofSMBX
Ludwig von Koopa
Ludwig von Koopa
Posts: 3878
Joined: Sun Dec 22, 2013 12:01 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby FanofSMBX » Fri Feb 05, 2016 1:59 pm

Can you make Mario and Luigi's hammers have different graphics (not sizes, just graphics)? Someone wants me to make a Wario that throws garlic and a Waluigi that throws eggplants.

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Emral » Fri Feb 05, 2016 2:18 pm

FanofSMBX wrote:Can you make Mario and Luigi's hammers have different graphics (not sizes, just graphics)? Someone wants me to make a Wario that throws garlic and a Waluigi that throws eggplants.
It's a bit tricky, but definitely possible. The way I'd do it is put both graphics on the same spritesheet and override the animation frames so I can give them my own. So the garlic would be the first 4, the eggplant the other 4.

To override the animation frames and replace them with your own sequence, make a timer which counts up so that every 8 frames it's a round number. If you then say...
v.animationTimer = 500 --some large number to hinder SMBX from changing the frame
v.animationFrame = math.floor(counter)%4 --goes from 0 to 3

Of course, this only works for one player/sprite. I am not 100% sure what the best way to check for the player which throws the hammer is. I'd do a very elaborate check for position, direction, player character, powerup and hammer cooldown timer, and then set something like this accordingly:
if it's determined that wario threw the hammer:
v.ai5 (use ai fields or pnpc) = 0
if it's determined that waluigi threw it:
v.ai5 = 4
v.animationFrame = math.floor(counter)%4 + v.ai5 --0-3 for wario, 4-7 for waluigi

Nat The Porcupine
Monty Mole
Monty Mole
Posts: 123
Joined: Tue Nov 10, 2015 2:55 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Nat The Porcupine » Fri Feb 05, 2016 4:49 pm

I'm curious... is there any way to prevent the player's spin jump from killing an enemy, causing the player to simply bounce off of the enemy (i.e. when the player spin jumps off of a spiny)?

TDK
Phanto
Phanto
Posts: 1440
Joined: Wed Nov 11, 2015 12:26 pm
Flair: Retired

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby TDK » Fri Feb 05, 2016 5:05 pm

Nat The Porcupine wrote:I'm curious... is there any way to prevent the player's spin jump from killing an enemy, causing the player to simply bounce off of the enemy (i.e. when the player spin jumps off of a spiny)?
Use this to make enemies immune to spin jumping:

Code: Select all

function onNPCKill(event,npc,reason)
	if reason == 8 then
		event.cancelled = true
	end
end
If you want to make a certain enemy immune (e.g. a goomba) to spin jumping then change the second line to:

Code: Select all

if reason == 8 and (npc.id == 1) then
And if you want to do the same, but for multiply enemies (e.g. a goomba and a koopa), then use this for the second line instead:

Code: Select all

if reason == 8 and (npc.id == 1 or npc.id == 4) then

litchh
Eerie
Eerie
Posts: 719
Joined: Sun Dec 29, 2013 6:10 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby litchh » Sun Feb 07, 2016 9:38 am

Did anyone try to make shooting NPCs (Snifits, Venus Fire Traps, Hammer Bros, etc.) throw their projectiles several times at once like SMB3 Venus Fire Trap from world2 and later?

TDK
Phanto
Phanto
Posts: 1440
Joined: Wed Nov 11, 2015 12:26 pm
Flair: Retired

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby TDK » Sun Feb 07, 2016 9:52 am

MidiGuyDP wrote:Thanks for the code. It'll save me the trouble of looking for the checkpoints to delete them. ;)

EDIT: Alrighty, there's one more function I want to get in there, though I'm having difficulty. I basically want to make the life count always reset to like 3 or something so that game overs don't happen after losing all lives doing time trail attempts.

I thought perhaps I could use this example

Code: Select all

function onLoad()
    player:mem(0xF0, FIELD_WORD, 1)
end
And change it to this:

Code: Select all

function onLoad()
    player:mem(0x00B2C5AC, FIELD_FLOAT, 3)
end
Which is the memory address for the life count.

Though while I don't have any errors, it doesn't seem to do the trick, Am I close?
When I tried that code, SMBX crashed, so I changed it to this (which seems to do the trick):

Code: Select all

function onLoad()
    mem(0x00B2C5AC, FIELD_FLOAT, 3)
end

RudeGuy
Bowser
Bowser
Posts: 4994
Joined: Fri Dec 27, 2013 7:36 am
Flair: local guy

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby RudeGuy » Sun Feb 07, 2016 2:12 pm

I was wondering, is it possible to make a layer always stay in front of the default one? If so, how?

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Emral » Sun Feb 07, 2016 2:17 pm

By placing the objects on the layer after placing the objects on the default layer, and NOT saving the level in the legacy editor.

Ness-Wednesday
Purple Yoshi Egg
Purple Yoshi Egg
Posts: 1658
Joined: Sun Jun 28, 2015 3:50 pm
Flair: Diverse Scouts
Pronouns: He/Him

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Ness-Wednesday » Sun Feb 07, 2016 2:27 pm

What if I wanted to change the graphic for a level (and only that level) for one of the features, let's say....
Change the smb3 overhaul's graphics into something like this?
Spoiler: show
Image

HenryRichard
Reznor
Reznor
Posts: 2843
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby HenryRichard » Sun Feb 07, 2016 4:42 pm

Unfortunately you can't do it with SMB3 overhaul without modifying it. However, other HUDs do it in ways were you can.

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Sun Feb 07, 2016 4:59 pm

Ness-Wednesday wrote:What if I wanted to change the graphic for a level (and only that level) for one of the features, let's say....
Change the smb3 overhaul's graphics into something like this?
Spoiler: show
Image

look at your post, I changed stuff sorry for my mistake, I wanna think you wanted to disable the hud :(

http://www.smbxgame.com/forums/v ... 03#p196203

MidiGuyDP
Tweeter
Tweeter
Posts: 147
Joined: Fri Jan 17, 2014 2:28 am

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby MidiGuyDP » Sun Feb 07, 2016 7:24 pm

TheDinoKing432 wrote:
MidiGuyDP wrote:Thanks for the code. It'll save me the trouble of looking for the checkpoints to delete them. ;)

EDIT: Alrighty, there's one more function I want to get in there, though I'm having difficulty. I basically want to make the life count always reset to like 3 or something so that game overs don't happen after losing all lives doing time trail attempts.

I thought perhaps I could use this example

Code: Select all

function onLoad()
    player:mem(0xF0, FIELD_WORD, 1)
end
And change it to this:

Code: Select all

function onLoad()
    player:mem(0x00B2C5AC, FIELD_FLOAT, 3)
end
Which is the memory address for the life count.

Though while I don't have any errors, it doesn't seem to do the trick, Am I close?
When I tried that code, SMBX crashed, so I changed it to this (which seems to do the trick):

Code: Select all

function onLoad()
    mem(0x00B2C5AC, FIELD_FLOAT, 3)
end
Many thanks for that. Though I actually got that part down a while ago. Next time I update the Time Trail files, I plan to include that. ;)

TDK
Phanto
Phanto
Posts: 1440
Joined: Wed Nov 11, 2015 12:26 pm
Flair: Retired

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby TDK » Mon Feb 08, 2016 3:33 pm

I'm wondering, is it possible to have the background scroll using LunaLua?

underFlo
Wart
Wart
Posts: 4456
Joined: Mon Jul 14, 2014 10:44 am
Flair: sup im lesbiab
Pronouns: They/She
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby underFlo » Mon Feb 08, 2016 3:43 pm

TheDinoKing432 wrote:I'm wondering, is it possible to have the background scroll using LunaLua?
http://wohlsoft.ru/pgewiki/ParalX.lua should work


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari