Post here for help and support regarding LunaLua and SMBX2's libraries and features.
Moderator: Userbase Moderators
|
|
|
|
-
MrDoubleA
- Edward

- Posts: 394
- Joined: Mon Aug 20, 2018 7:02 am
- Flair: How much munchers?
Postby MrDoubleA » Tue Mar 02, 2021 8:49 am
Goldenemerl64 wrote: ↑Tue Mar 02, 2021 6:59 am
I'm having problems with Activating auto-scroll on a Collectable Trigger.
Code: Select all local autoscroll = require("autoscroll")
function onEvent(Fast)
if eventName == "Fast" then
autoscroll.scrollRight(3.0)
elseif eventName == "Fast" then
autoscroll.scrollRight(3.0)
end
end
am I doing it correctly?
onEvent does not work like that. "eventName" at the top doesn't mean "replace this", you're supposed to keep it as eventName.
|
|
|
|
|
|
|
|
|
-
Lucario
- Blooper

- Posts: 172
- Joined: Thu Dec 10, 2020 11:54 am
- Flair: A beginner Mario-level modder that also uses SMBX.
- Pronouns: He/him/
Postby Lucario » Tue Mar 02, 2021 9:50 am
General help, right? Well, what can I do to code a Piranha Creeper. I mean, I'll have to do stalk's AI and Piranha Creeper's AI, and I don't know how to make an AI!
|
|
|
|
|
|
|
|
|
-
MrDoubleA
- Edward

- Posts: 394
- Joined: Mon Aug 20, 2018 7:02 am
- Flair: How much munchers?
Postby MrDoubleA » Tue Mar 02, 2021 12:41 pm
Lucario wrote: ↑Tue Mar 02, 2021 9:50 am
General help, right? Well, what can I do to code a Piranha Creeper. I mean, I'll have to do stalk's AI and Piranha Creeper's AI, and I don't know how to make an AI!
I'm working on one, but this is REALLY not something you should start into as a beginner.
|
|
|
|
|
|
|
|
|
-
Goldenemerl64
- Fighter Fly

- Posts: 38
- Joined: Tue Jul 07, 2020 3:50 pm
Postby Goldenemerl64 » Tue Mar 02, 2021 9:57 pm
MrDoubleA wrote: ↑Tue Mar 02, 2021 8:49 am
Goldenemerl64 wrote: ↑Tue Mar 02, 2021 6:59 am
I'm having problems with Activating auto-scroll on a Collectable Trigger.
Code: Select all local autoscroll = require("autoscroll")
function onEvent(Fast)
if eventName == "Fast" then
autoscroll.scrollRight(3.0)
elseif eventName == "Fast" then
autoscroll.scrollRight(3.0)
end
end
am I doing it correctly?
onEvent does not work like that. "eventName" at the top doesn't mean "replace this", you're supposed to keep it as eventName.
ooooh, Ok then. Thanks!
|
|
|
|
|
|
|
|
|
-
BlueStaggo
- Koopa

- Posts: 18
- Joined: Sat Feb 20, 2021 8:18 am
- Pronouns: he/him
-
Contact:
Postby BlueStaggo » Sat Mar 06, 2021 8:04 am
I would like to be big every time I either play my episode for the first time or die, just like in Super Mario 3D World. Anybody know how to do that? I've been using a variable with SaveData to keep track of whether the player has died or not. I want this to be an episode-wide feature.
|
|
|
|
|
|
|
|
|
-
LunarCatUSA
- Monty Mole

- Posts: 115
- Joined: Sat Mar 06, 2021 9:56 am
- Flair: Soda-Butler
Postby LunarCatUSA » Sat Mar 06, 2021 2:01 pm
Hello there, I would like to be able to script a quiz game. For this game, there are 4 blocks. One block has the right answer, and three blocks give the wrong answer. Here’s how it would work:
- Make a variable that’s the player score and set it to 0 initially.
- Make a variable that’s the player’s miss score and set it to 0 initially.
- Make the boxes increment to these scores depending on right or wrong. (Should this be done via “hit” and event?)
- How to display a message via script. (In this case, the question)
- 10 questions and it would help if I could know how to randomize their order.
- If the player gets a right answer, it adds 1 to score.
- If the player gets a wrong answer, it adds 1 to miss score.
- If the player has more points than miss points, they win.
- If the player has less than or equal points to miss points, they die instantly.
I’m very new to Lua so it would help if you all could give tips and some understanding to this variable and message display system and how it all connects to what’s in game.
|
|
|
|
|
|
|
|
|
-
MrDoubleA
- Edward

- Posts: 394
- Joined: Mon Aug 20, 2018 7:02 am
- Flair: How much munchers?
Postby MrDoubleA » Sat Mar 06, 2021 3:00 pm
BlueStag wrote: ↑Sat Mar 06, 2021 8:04 am
I would like to be big every time I either play my episode for the first time or die, just like in Super Mario 3D World. Anybody know how to do that? I've been using a variable with SaveData to keep track of whether the player has died or not. I want this to be an episode-wide feature.
Code: Select all SaveData.startedEpisode = SaveData.startedEpisode or false
function onStart()
if not SaveData.startedEpisode then
for _,p in ipairs(Player.get()) do
p.powerup = PLAYER_BIG
end
SaveData.startedEpisode = true
end
end
function onExitLevel(exitType)
if exitType == 0 then
-- Is everybody dead?
local allDead = true
for _,p in ipairs(Player.get()) do
if not p:mem(0x13C,FIELD_BOOL) then -- not dead
allDead = false
break
end
end
if allDead then
-- Make everybody big
for _,p in ipairs(Player.get()) do
p.powerup = PLAYER_BIG
end
end
end
end
Here (should be multiplayer compatible).
|
|
|
|
|
|
|
|
|
-
LunarCatUSA
- Monty Mole

- Posts: 115
- Joined: Sat Mar 06, 2021 9:56 am
- Flair: Soda-Butler
Postby LunarCatUSA » Wed Mar 10, 2021 7:58 am
So let’s say the player’s controls are dropped in-game. I wanted for them to press some button on their keyboard to trigger something. Is there a Lua command or code for that?
|
|
|
|
|
|
|
|
|
-
LunarCatUSA
- Monty Mole

- Posts: 115
- Joined: Sat Mar 06, 2021 9:56 am
- Flair: Soda-Butler
Postby LunarCatUSA » Thu Mar 11, 2021 2:25 pm
Okay quick question:
My program seems to think there’s an index present I deleted from the code sometime ago. I guess there’s some index present in the cache unused. How would I delete it? Or clear the code cache entirely?
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9890
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Thu Mar 11, 2021 2:26 pm
There's no such a thing as a "code cache"
|
|
|
|
|
|
|
|
|
-
LunarCatUSA
- Monty Mole

- Posts: 115
- Joined: Sat Mar 06, 2021 9:56 am
- Flair: Soda-Butler
Postby LunarCatUSA » Thu Mar 11, 2021 2:28 pm
Well it seems to think the index I got rid of is still there so I don’t know. I didn’t know if it had a cache present like MatLab.
Added in 14 minutes 20 seconds:
Oh nevermind, I just had to make a clear table. Nothing wrong with memory.
|
|
|
|
|
|
|
|
|
-
LunarCatUSA
- Monty Mole

- Posts: 115
- Joined: Sat Mar 06, 2021 9:56 am
- Flair: Soda-Butler
Postby LunarCatUSA » Sat Mar 13, 2021 4:32 pm
If I wanted an npc to be killed a certain way that would trigger an event, how would I got about it? Like say I wanted an npc to be killed by spin jumping to avoid triggering an event, is there a certain way to define a death from spin-jumping verses a normal death by stomping?
|
|
|
|
|
|
|
|
|
-
timocomsmbx2345
- Foo

- Posts: 853
- Joined: Sat Feb 06, 2016 1:44 pm
-
Contact:
Postby timocomsmbx2345 » Thu Mar 25, 2021 3:15 pm
I was attempting to make a custom npc for a long while now, where it was like, npc-147, but with more varied veggies. I have already made my own custom veggie without replacing an existing one, but I don't know how to make a new npc-147-like npc for it.
Added in 4 hours 51 minutes 23 seconds:
timocomsmbx2345 wrote: ↑Thu Mar 25, 2021 3:15 pm
I was attempting to make a custom npc for a long while now, where it was like, npc-147, but with more varied veggies. I have already made my own custom veggie without replacing an existing one, but I don't know how to make a new npc-147-like npc for it.
Ok but seriously, I have wasted 12 hours trying to know what I did wrong, and all I've been getting was an error about ")"
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9890
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Sat Mar 27, 2021 8:38 am
timocomsmbx2345 wrote: ↑Thu Mar 25, 2021 8:06 pm
Ok but seriously, I have wasted 12 hours trying to know what I did wrong, and all I've been getting was an error about ")"
This indicates a syntax error. Programming applications such as vscode or notepad++ should highlight them for you.
|
|
|
|
|
|
|
|
|
-
timocomsmbx2345
- Foo

- Posts: 853
- Joined: Sat Feb 06, 2016 1:44 pm
-
Contact:
Postby timocomsmbx2345 » Sat Mar 27, 2021 10:11 am
Enjl wrote: ↑Sat Mar 27, 2021 8:38 am
timocomsmbx2345 wrote: ↑Thu Mar 25, 2021 8:06 pm
Ok but seriously, I have wasted 12 hours trying to know what I did wrong, and all I've been getting was an error about ")"
This indicates a syntax error. Programming applications such as vscode or notepad++ should highlight them for you.
I didn't even realize there was a highlight feature, plus I never knew how to turn that on in notepad++.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9890
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Sat Mar 27, 2021 12:03 pm
timocomsmbx2345 wrote: ↑Sat Mar 27, 2021 10:11 am
Enjl wrote: ↑Sat Mar 27, 2021 8:38 am
timocomsmbx2345 wrote: ↑Thu Mar 25, 2021 8:06 pm
Ok but seriously, I have wasted 12 hours trying to know what I did wrong, and all I've been getting was an error about ")"
This indicates a syntax error. Programming applications such as vscode or notepad++ should highlight them for you.
I didn't even realize there was a highlight feature, plus I never knew how to turn that on in notepad++.
It should just do it for lua files automatically. If not, you can use the "Language" dropdown and select "Lua".
|
|
|
|
|
|
|
|
|
-
LunarCatUSA
- Monty Mole

- Posts: 115
- Joined: Sat Mar 06, 2021 9:56 am
- Flair: Soda-Butler
Postby LunarCatUSA » Sun Mar 28, 2021 1:42 pm
Anyway I can alter the graphical pixel size of the small/1 heart Mario? I’m trying to make a horror-themed episode and instead of shrinking, the character will retain the size, yet looked tired and depressed on their lowest health level. Any script I should look for? Or a txt file I should make?
|
|
|
|
|
|
|
|
|
-
Murphmario
- 2025 Egg Hunter

- Posts: 2389
- Joined: Fri Dec 20, 2013 7:07 pm
- Pronouns: he/him
Postby Murphmario » Wed Apr 14, 2021 1:35 am
Is there a tutorial for using NPCUtils getTotalFramesByFramestyle anywhere? I feel like that'd help me out a lot.
|
|
|
|
|
|
|
|
|
-
MrDoubleA
- Edward

- Posts: 394
- Joined: Mon Aug 20, 2018 7:02 am
- Flair: How much munchers?
Postby MrDoubleA » Wed Apr 14, 2021 2:49 am
Murphmario wrote: ↑Wed Apr 14, 2021 1:35 am
Is there a tutorial for using NPCUtils getTotalFramesByFramestyle anywhere? I feel like that'd help me out a lot.
You just do npcutils.getToyalFramesByFramestyle(v), and it gives you the total frames. I don't think am entire tutorial is necessary lol
|
|
|
|
|
|
|
|
|
-
TheGameyFireBro105
- Eerie

- Posts: 747
- Joined: Thu Jan 09, 2020 6:09 pm
- Flair: Good at remakes
- Pronouns: he/him
Postby TheGameyFireBro105 » Fri Apr 23, 2021 10:11 am
Can I use Lua code to have auto scroll outside the main area? I'm going for the basic SMB3 Normal scroll speed, like that seen in the 1st airship and the tanks. I have no knowledge of lua, aside from how to make a level use the code.
|
|
|
|
|
Return to “LunaLua Help”
Users browsing this forum: No registered users and 1 guest
|