LunaLua Offical Thread - SMBX Usermod Framework

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?

Shall I steam some LunaLua live development?

Yes
200
92%
No
17
8%
 
Total votes: 217
User avatar
Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 7784
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Enjl » Thu Feb 04, 2016 3:55 am

Use textblox for custom fonts.
ImageImageImageImage
ImageImageImageImageImageImage

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Thu Feb 04, 2016 4:15 am

Enjl wrote:Use textblox for custom fonts.
I wanted to test it in the early day but its in red the api i cant download it :(

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Enjl » Thu Feb 04, 2016 4:33 am

Textblox is natively included in lunalua 0.7.3 I think.
ImageImageImageImage
ImageImageImageImageImageImage

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Thu Feb 04, 2016 4:36 am

Enjl wrote:Textblox is natively included in lunalua 0.7.3 I think.
I made a search in the wiki about Textblox and no result :(
but CinematX have some use with this but no info about this :(

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Enjl » Thu Feb 04, 2016 4:40 am

After a search on the wiki you SHOULD have stumbled across the cinematx github. https://github.com/rockythechao/cinematX
On the cinematX page it's guaranteed that graphX and textblox are up to date. For examples on how you can use textblox, look no further than xmem.lua.
ImageImageImageImage
ImageImageImageImageImageImage

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Thu Feb 04, 2016 4:51 am

Enjl wrote:After a search on the wiki you SHOULD have stumbled across the cinematx github. https://github.com/rockythechao/cinematX
On the cinematX page it's guaranteed that graphX and textblox are up to date. For examples on how you can use textblox, look no further than xmem.lua.
Thanks I just found :)
I looked into this but I'm not sure how to just use text I dont want to use box :(

User avatar
underFlo
Mario
Mario
Posts: 4481
Joined: Mon Jul 14, 2014 10:44 am
Flair: sup im lesbiab
Current Project: actually nothing i lied to you
Chat Username: underFlo
Contact:

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby underFlo » Thu Feb 04, 2016 5:26 am

textblox.print (int x, int y, object text, font)
im a girl yo

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby lotus006 » Thu Feb 04, 2016 5:38 am

Spinda wrote:textblox.print (int x, int y, object text, font)
where did you found this ?

crap I just found this after you :( Thanks :)

If found this also in textblox.lua

Code: Select all

function textblox.print (text, xPos,yPos, fontObj, t_halign, t_valign, w, alpha)
or

Code: Select all

textblox.printExt (text, {x=xPos, y=yPos, font=fontObj, halign=t_halign, valign=t_valign, width, opacity=alpha})

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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby MidiGuyDP » Thu Feb 04, 2016 11:14 am

Heyo. I had a little question I figured it would be faster to ask here then to look around.

I've been wondering, has anyone here made a Time Trail style timer?

Like one that would start at 0:00.00 (minute:second.milliseconds) at the beginning of the level, then stop once the player would get ANY kind of goal.

In other words, a way to turn the level into a time trail. :)

User avatar
TDK
Kamikaze Koopa
Kamikaze Koopa
Posts: 1382
Joined: Wed Nov 11, 2015 12:26 pm

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby TDK » Thu Feb 04, 2016 1:09 pm

MidiGuyDP wrote:Heyo. I had a little question I figured it would be faster to ask here then to look around.

I've been wondering, has anyone here made a Time Trail style timer?

Like one that would start at 0:00.00 (minute:second.milliseconds) at the beginning of the level, then stop once the player would get ANY kind of goal.

In other words, a way to turn the level into a time trail. :)
To make a time trial timer:

Step 1: In the editor, make an event called 'end' for when the player get the exit.
Step 2: Use this:

Code: Select all

local t = 0
local finish = false

function onLoop()
	if not finish then
		t = t + 1
	end
	local minute = tostring(math.floor(t/3900))
	local second = tostring(math.floor((t/65)) % 60)
	local cent = tostring(math.floor((100 * t/65)) %100)	
	Text.print(minute..":"..second..":"..cent ,0,10)
end

function onEvent(event)
	if event == "end" then
		finish = true
	end
end

User avatar
underFlo
Mario
Mario
Posts: 4481
Joined: Mon Jul 14, 2014 10:44 am
Flair: sup im lesbiab
Current Project: actually nothing i lied to you
Chat Username: underFlo
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
im a girl yo

MidiGuyDP
Bit
Bit
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?

User avatar
TDK
Kamikaze Koopa
Kamikaze Koopa
Posts: 1382
Joined: Wed Nov 11, 2015 12:26 pm

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
Bit
Bit
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)

User avatar
HenryRichard
Ludwig von Koopa
Ludwig von Koopa
Posts: 2845
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?
Image

I'm on Soundcloud | My graphics pack!

Jesus is my savior.

MidiGuyDP
Bit
Bit
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?

User avatar
FanofSMBX
Bowser
Bowser
Posts: 3834
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.

I believe in Jesus Christ as my Lord and Savior. If you do, put this in your signature.
My graphics pack!
Supporting forums:

Spoiler: show
SMBX Galaxy forum by Pivot40Channel
http://smbxgalaxy.prophpbb.com/
Come to the SMBX+ forums by illias3000. There is a whole forum category dedicated to the boss rush series with official rushes, submit bosses, and fan boss rushes! It is still open but AirSeus Forums is now open:
http://nsmbx.prophpbb.com/
AirSeus Forums the new home of the Boss Rush series:
http://smbxairseusforums.prophpbb.com/
Spoiler: show
First to discover:
Spark
Eerie
Grinder
Rainbow Shell
Birdo
Boom Boom
Image
Image
Image
Image
Image
KINGBOWSER112 RULES!


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

Re: LunaLua Offical Thread - SMBX Usermod Framework

Postby Enjl » 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
ImageImageImageImage
ImageImageImageImageImageImage

User avatar
Nat The Porcupine
Swooper
Swooper
Posts: 122
Joined: Tue Nov 10, 2015 2:55 pm
Current Project: Nothing ATM

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)?

User avatar
TDK
Kamikaze Koopa
Kamikaze Koopa
Posts: 1382
Joined: Wed Nov 11, 2015 12:26 pm

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


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 3 guests