Page 35 of 47
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Thu Feb 04, 2016 1:43 pm
by underFlo
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
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Thu Feb 04, 2016 1:52 pm
by MidiGuyDP
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?
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Thu Feb 04, 2016 2:24 pm
by TDK
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
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Thu Feb 04, 2016 3:07 pm
by MidiGuyDP
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)
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Thu Feb 04, 2016 11:15 pm
by HenryRichard
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?
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Fri Feb 05, 2016 8:35 am
by MidiGuyDP
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?
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Fri Feb 05, 2016 1:59 pm
by FanofSMBX
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.
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Fri Feb 05, 2016 2:18 pm
by Emral
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
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Fri Feb 05, 2016 4:49 pm
by Nat The Porcupine
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)?
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Fri Feb 05, 2016 5:05 pm
by TDK
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
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Sun Feb 07, 2016 9:38 am
by litchh
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?
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Sun Feb 07, 2016 9:52 am
by TDK
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
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Sun Feb 07, 2016 2:12 pm
by RudeGuy
I was wondering, is it possible to make a layer always stay in front of the default one? If so, how?
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Sun Feb 07, 2016 2:17 pm
by Emral
By placing the objects on the layer after placing the objects on the default layer, and NOT saving the level in the legacy editor.
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Sun Feb 07, 2016 2:27 pm
by Ness-Wednesday
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?
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Sun Feb 07, 2016 4:42 pm
by HenryRichard
Unfortunately you can't do it with SMB3 overhaul without modifying it. However, other HUDs do it in ways were you can.
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Sun Feb 07, 2016 4:59 pm
by lotus006
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?
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
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Sun Feb 07, 2016 7:24 pm
by MidiGuyDP
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.

Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Mon Feb 08, 2016 3:33 pm
by TDK
I'm wondering, is it possible to have the background scroll using LunaLua?
Re: LunaLua Offical Thread - SMBX Usermod Framework
Posted: Mon Feb 08, 2016 3:43 pm
by underFlo
TheDinoKing432 wrote:I'm wondering, is it possible to have the background scroll using LunaLua?
http://wohlsoft.ru/pgewiki/ParalX.lua should work