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

- Posts: 180
- Joined: Sat Nov 03, 2018 6:22 pm
- Flair: u fucking wot
- Pronouns: he/him
-
Contact:
Postby SPEEDIE » Sat Nov 23, 2019 11:56 am
I want to make a death counter on the top left part of the screen, it starts at 0, and when you die, it adds up, I want it to show in on every level (the total deaths on the entire episode)
I tried some stuff I found on pgewiki but it didn't work.
|
|
|
|
|
|
|
|
|
-
Bulby_VR
- Fighter Fly

- Posts: 33
- Joined: Wed Aug 07, 2019 11:18 am
Postby Bulby_VR » Sat Nov 23, 2019 1:02 pm
Would changing defines on the fly negatively affect performance, or is that impossible?
Added in 1 minute 52 seconds:
Nevermind, there's no point if your thing is compatible with 2 player
|
|
|
|
|
|
|
|
|
-
Bulby_VR
- Fighter Fly

- Posts: 33
- Joined: Wed Aug 07, 2019 11:18 am
Postby Bulby_VR » Tue Nov 26, 2019 8:22 am
What are the default defines for new characters? I see bowser’s jump height is much lower, but what else changes?
|
|
|
|
|
|
|
|
|
-
MarioLover64
- Spike

- Posts: 259
- Joined: Fri Apr 26, 2019 6:09 pm
Postby MarioLover64 » Sat Dec 14, 2019 5:43 pm
How do I make a fade out effect?
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9890
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Sun Dec 15, 2019 1:49 am
Bulby_VR wrote: ↑Tue Nov 26, 2019 8:22 am
What are the default defines for new characters? I see bowser’s jump height is much lower, but what else changes?
I don't know them off the top of my head, but each character script has an initialisation function that runs when the player turns into that character. In that function, all character-specific global fields are set.
MarioLover64 wrote: ↑Sat Dec 14, 2019 5:43 pm
How do I make a fade out effect?
Put this in onDraw and manually control OPACITY (from 0 to 1). Priority 5 is hud priority. https://wohlsoft.ru/pgewiki/LunaLua_Render_Priority
Graphics.drawScreen{color = Color.black .. OPACITY, priority = 5}
|
|
|
|
|
|
|
|
|
-
Locus
- Fighter Fly

- Posts: 35
- Joined: Sun Mar 17, 2019 12:47 pm
- Pronouns: he/him
Postby Locus » Sun Dec 15, 2019 5:56 am
https://imgur.com/a/AuE1nko
I seem to have a problem with my parallaxing background. The water is moving but when I move left it somehow stops until I stand still again. If anyone could help me solve this issue this would be appreciated.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9890
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Sun Dec 15, 2019 5:58 am
Looks like an optical illusion. The water still moves at the same speed, you're just "moving it back" by moving the camera at a rate at which the parallaxing effect cancels out the movement of the water. Double the water speed to see the impact of the effect more clearly.
|
|
|
|
|
|
|
|
|
-
Locus
- Fighter Fly

- Posts: 35
- Joined: Sun Mar 17, 2019 12:47 pm
- Pronouns: he/him
Postby Locus » Sun Dec 15, 2019 6:08 am
https://i.imgur.com/4bVnlKE.mp4
This time I doubled the speed and this is the result. It's like you said, making it more obvious to notice that it "stops".
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9890
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Sun Dec 15, 2019 6:14 am
Yes, the optical illusion is more obvious here. You can greatly increase the layer's depth to reduce the impact camera movement has on the layer.
|
|
|
|
|
|
|
|
|
-
cato
- Volcano Lotus

- Posts: 564
- Joined: Thu Aug 24, 2017 3:06 am
- Flair: Koishi enjoyer
-
Contact:
Postby cato » Thu Dec 26, 2019 10:09 am
How do I print text function like the SMBX textbox, while appearing characters frame by frame?
Edit: I think I have a bigger problem.
How do I make something like:
if you play the level for the first time, it gives you text A on level start
then if you play the level after getting something, it gives you text B on level start
then if you replay the level for neither the first time nor the second time, nothing happens.
I tried:
Code: Select all firstime = true
secondtime = false // will turn into true later
function onStart()
if firstime == false and secondtime == false then return end
if firstime == true then
Text.showMessageBox("A")
firstime = false
end
if secondtime == true then
Text.showMessageBox("B")
secondtime = false
end
end
but still can't grasp the logical error that I have since firstime is always true every time the code is executed, yet I needed something to show that it is the player's first time in the level.
|
|
|
|
|
|
|
|
|
-
RudeGuy
- Bowser

- Posts: 4994
- Joined: Fri Dec 27, 2013 7:36 am
- Flair: local guy
Postby RudeGuy » Fri Dec 27, 2019 8:11 am
You need to use the SaveData library to save variables between different runs of a level.
|
|
|
|
|
|
|
|
|
-
Murphmario
- 2025 Egg Hunter

- Posts: 2389
- Joined: Fri Dec 20, 2013 7:07 pm
- Pronouns: he/him
Postby Murphmario » Sat Dec 28, 2019 4:56 pm
I'm trying to make an NPC that uses the AI of a Paratroopa, but I'm having two problems.
1. How do I make it face Mario without having to make it not be able to move?
2. The more major issue I'm having right now; how do I have the normal Paratroopa options show up in the editor? I copied from the Paratroopa's item code, and that didn't work.
Edit: I just decided to move onto another NPC, and now I need help with tracking the player's Y position. player.y isn't working.
|
|
|
|
|
|
|
|
|
-
FireyPaperMario
- Toad

- Posts: 6206
- Joined: Sat Sep 27, 2014 1:39 pm
- Flair: 90's kid born in late 1993 ^_^"
- Pronouns: He/Him
-
Contact:
Postby FireyPaperMario » Tue Jan 07, 2020 12:12 pm
I got this Lunalua script idea for the enemy npcs from some Japanese Super Mario Bros. 1 ROM Hack that based off the god-awful famicom Transformers game, Convoy no Nazo, where the enemies fire a small projectile at you every set of seconds. Is that possible?!?
The ROM hack is called "The Mystery of Luigi/Luigi no Nazo" if any of y'all were wondering
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9890
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Tue Jan 07, 2020 3:28 pm
FireyPaperMario wrote: ↑Tue Jan 07, 2020 12:12 pm
I got this Lunalua script idea for the enemy npcs from some Japanese Super Mario Bros. 1 ROM Hack that based off the god-awful famicom Transformers game, Convoy no Nazo, where the enemies fire a small projectile at you every set of seconds. Is that possible?!?
The ROM hack is called "The Mystery of Luigi/Luigi no Nazo" if any of y'all were wondering
This thread is for people who are stuck in their code and need help in figuring out where the problem lies or how to continue. I'm willing to help once you run into such a situation, but I think the question above can be easily answered by looking at the PAL build's existing enemy roster and considering similarities between what's already been made and what you would like to make. From your description, I don't know anything about what you're actually trying to do, so please examine what already exists to determine whether the concept is possible.
(In general, pretty much anything is possible, as long as you aren't deliberately trying to break some boundary).
|
|
|
|
|
|
|
|
|
-
Chilly14
- Snifit

- Posts: 236
- Joined: Thu Jul 18, 2019 10:28 pm
- Flair: wash your hands and stay at home
- Pronouns: he/him
Postby Chilly14 » Wed Jan 08, 2020 8:29 pm
I mostly succeeded in having a Venus Fire Trap to shoot two or more fireballs with help from 1AmPlayer. However, it doesn't work properly with multiple Venus Fire Traps onscreen:
Three of the Venus Fire Traps almost constantly shoot fireballs instead of just two, while one of them briefly hides after shooting a single fireball. Plus, it's random on which one hides and which ones don't. Is there a way to fix this?
Current Code:
Code: Select all for _,v in ipairs(NPC.get(245,player.section)) do
local v = pnpc.wrap(v)
local data = v.data
if v.ai1 == 0 and v.ai2 == 1 then
maxfireballs = 2
end
if v.ai1 == 50 and v.ai2 == 2 then
v.ai1 = 0
v.ai2 = 2
maxfireballs = maxfireballs - 1
end
if v.ai2 == 2 and maxfireballs == 0 then
v.ai1 = 51
maxfireballs = -1
end
end
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Thu Jan 09, 2020 4:10 pm
The problem is that you're manipulating one variable with all your NPCs. You need to save the variables you want inside the data table you define, otherwise every NPC is going to share the same variable.
|
|
|
|
|
|
|
|
|
-
Chilly14
- Snifit

- Posts: 236
- Joined: Thu Jul 18, 2019 10:28 pm
- Flair: wash your hands and stay at home
- Pronouns: he/him
Postby Chilly14 » Thu Jan 09, 2020 4:46 pm
Hoeloe wrote: ↑Thu Jan 09, 2020 4:10 pm
The problem is that you're manipulating one variable with all your NPCs. You need to save the variables you want inside the data table you define, otherwise every NPC is going to share the same variable.
Uhhh...what do you mean by "saving the variables you want inside the data table you define?"
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Fri Jan 10, 2020 2:15 am
Chilly14 wrote: ↑Thu Jan 09, 2020 4:46 pm
Hoeloe wrote: ↑Thu Jan 09, 2020 4:10 pm
The problem is that you're manipulating one variable with all your NPCs. You need to save the variables you want inside the data table you define, otherwise every NPC is going to share the same variable.
Uhhh...what do you mean by "saving the variables you want inside the data table you define?"
You make a variable called "data" here, and then never use it. This line basically just allows you to use data as a shorthand for v.data, which is the NPCs internal storage table. If you want each NPC to measure things individually, you have to store the data inside its storage table, not just floating in space.
|
|
|
|
|
|
|
|
|
-
Chilly14
- Snifit

- Posts: 236
- Joined: Thu Jul 18, 2019 10:28 pm
- Flair: wash your hands and stay at home
- Pronouns: he/him
Postby Chilly14 » Fri Jan 10, 2020 3:05 pm
Hoeloe wrote: ↑Fri Jan 10, 2020 2:15 am
Chilly14 wrote: ↑Thu Jan 09, 2020 4:46 pm
Hoeloe wrote: ↑Thu Jan 09, 2020 4:10 pm
The problem is that you're manipulating one variable with all your NPCs. You need to save the variables you want inside the data table you define, otherwise every NPC is going to share the same variable.
Uhhh...what do you mean by "saving the variables you want inside the data table you define?"
You make a variable called "data" here, and then never use it. This line basically just allows you to use data as a shorthand for v.data, which is the NPCs internal storage table. If you want each NPC to measure things individually, you have to store the data inside its storage table, not just floating in space.
Okay, I'll try to figure it out.
|
|
|
|
|
|
|
|
|
-
Murphmario
- 2025 Egg Hunter

- Posts: 2389
- Joined: Fri Dec 20, 2013 7:07 pm
- Pronouns: he/him
Postby Murphmario » Sat Jan 11, 2020 3:58 pm
Once again having issues. Got the player.Y thing to work, but I'm getting this syntax error.

I tried to just change where the "end" is located, but then none of the of the code works, including the separate onNPCKill (which I referenced from Enjl's video).
Edit: I have an older NPC, and player.x = v.x doesn't seem to be working anymore. Is there a possible workaround?
Edit 2: Sorry for so many questions, but I'm now focusing on a different NPC. I'm now wondering how to fix "attempt to index local tbl (a number value)."
|
|
|
|
|
Return to “LunaLua Help”
Users browsing this forum: No registered users and 1 guest
|