Need help with lua? - LunaLua General Help

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?
User avatar
h2643
Ludwig von Koopa
Ludwig von Koopa
Posts: 2896
Joined: Sat Dec 21, 2013 7:23 am
Flair: Украинец
Current Project: RL
Chat Username: h/hnumbers

Re: Need help with lua? - LunaLua General Help

Postby h2643 » Tue Jun 28, 2016 12:28 pm

There's a boss in 2k16 VVinter Redemption that has a health bar, so yes.

PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Tue Jun 28, 2016 12:32 pm

Mario_and_Luigi_55 wrote:Would it be possible to make a health bar like on this picture:
Image
for both player and a boss?
They both involve using a counter that decreases every time the boss or Mario is hurt and drawing images (Graphics.drawImageWP) to the screen of the counters. What I use to replicate Super Mario Galaxy's HUD in my Super Mario Galaxy Modder API is the same idea, if you want to check that out as an example

User avatar
Mario_and_Luigi_55
Mega Mole
Mega Mole
Posts: 270
Joined: Sat Feb 27, 2016 12:01 pm
Current Project: Super Mario Bros Adventure

Re: Need help with lua? - LunaLua General Help

Postby Mario_and_Luigi_55 » Tue Jun 28, 2016 12:37 pm

PixelPest wrote:
Mario_and_Luigi_55 wrote:Would it be possible to make a health bar like on this picture:
Image
for both player and a boss?
They both involve using a counter that decreases every time the boss or Mario is hurt and drawing images (Graphics.drawImageWP) to the screen of the counters. What I use to replicate Super Mario Galaxy's HUD in my Super Mario Galaxy Modder API is the same idea, if you want to check that out as an example
OK. Thanks
Image
Image

My best levels:
Goomba Lands - 5/10
Stars of the trees - 5.5/10
Koopa Cave - 3.42
Green Grass Hill - 3.42
Grassy Valley - 5.47

PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Tue Jun 28, 2016 3:42 pm

If I'm doing:

Code: Select all

for i = 1, #table do
Is there any way to find out which row of the table satisfies table ? Been wondering this for a while but haven't asked and can't find it anywhere

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

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Tue Jun 28, 2016 3:56 pm

PixelPest wrote:If I'm doing:

Code: Select all

for i = 1, #table do
Is there any way to find out which row of the table satisfies table ? Been wondering this for a while but haven't asked and can't find it anywhere

Row of the table? Your code is a loop which goes over each element in your table. Frame table[1] to table[#table]. What kind of rows are you talking about?
The ABC of Creation
________________________________________________________
Image

User avatar
WerewolfGD
Wart
Wart
Posts: 3265
Joined: Tue Dec 02, 2014 2:28 am
Flair: Legalize Awooo!
Current Project: Howling
Chat Username: Alagirez
Contact:

Re: Need help with lua? - LunaLua General Help

Postby WerewolfGD » Tue Jun 28, 2016 8:29 pm

HenryRichard wrote:You have to put calledEvent between the first pair of parenthesis.
Like this?

Code: Select all

function onEvent(calledEvent)
	if calledEvent =="KILLPlayer" then
		player:kill()
	end
end
Yea... I'm back, but with different view.

Known also as Camacho or Harvey36Dice.
Also a furry

Image
Awooo!
If you want to talk with me, go here : Alagirez#2056

User avatar
HenryRichard
Ludwig von Koopa
Ludwig von Koopa
Posts: 2846
Joined: Mon Dec 23, 2013 12:09 pm
Flair: Is this where I type my password?
Contact:

Re: Need help with lua? - LunaLua General Help

Postby HenryRichard » Tue Jun 28, 2016 8:30 pm

yes
Jesus is my savior.

User avatar
Reign
Ripper II
Ripper II
Posts: 320
Joined: Tue Jan 21, 2014 4:22 am
Current Project: Yet untitled.

Re: Need help with lua? - LunaLua General Help

Postby Reign » Wed Jun 29, 2016 2:44 am

Enjl wrote:There's a player offset for link carrying a key. You can keep track of when he picks it up and when he loses it.
http://wohlsoft.ru/pgewiki/SMBX_Player_Offsets
Thank you so much, got it to work with Link! Probably not the most effective way of coding it but it works.
Spoiler: show
function onTick()
if player:mem(0x12,FIELD_WORD) < 0 then
key=1
end

if (player:mem(0x12,FIELD_WORD) == 0) and (key == 1) then
triggerEvent("Exit level")
key=2
end

end
In addition I noticed that for the other characters, throwing the key to lava or to a pit does not trigger the death-event, only using it on a door does. So I can use this code for the Link levels and the death-trigger for the other characters. 8-)
Episodes released:

seiteom
Goomba
Goomba
Posts: 4
Joined: Mon Jun 27, 2016 5:59 pm

Re: Need help with lua? - LunaLua General Help

Postby seiteom » Fri Jul 01, 2016 8:59 am

S1eth wrote:
seiteom wrote:
I wish S1eths code was still available. Anyway, if we look past the problem that all npcs are assigned 3 health points by default by the HealthPoint API, it is also true that setNPCHealth cannot be called within the onLoop function. If you call it in the onLoad function it works well however, and healthPoint.setNPCHealth(1, 1) will make Goombas die after only one hit.

Hope this helps someone!
https://www.mediafire.com/?ue6293oz6dm7id3
Thank you so much S1eth! I have now got it to work. It should be added though that the user still have to use HealthPoint.MakeNPCNormal(id) to return all npcs' health to normal. Now however, that function does not remove all the npcs from the array that HealthPoint uses to keep track of all modifications, but rather set them to nil. If I had any suggestion, it would be to call MakeNPCNormal from inside the HealthPoint itself, or simply set all npcs to nil initially.

Again, thank you S1eth!

User avatar
Quantumenace
Ripper II
Ripper II
Posts: 308
Joined: Mon Dec 28, 2015 2:17 am

Re: Need help with lua? - LunaLua General Help

Postby Quantumenace » Mon Jul 11, 2016 3:26 pm

I tried updating Lunalua on my 2.0 beta version recently and I keep getting this annoying error every time I start a game, load a world in game (or sometimes a level), or load a level in the legacy editor:

Errors while loading sound files
Some audio files failed to load:
C:\...\SMBX2\sound\fireball.mp3

All those sound files are .ogg. I tried converting an mp3 of the fireball sound but it still gives the error. Everything in the game appears to work, it's just irritating.
I followed the instructions on the first post, are there other Lunalua files I need to replace?

S1eth
Spiny
Spiny
Posts: 54
Joined: Sat Apr 23, 2016 10:44 am

Re: Need help with lua? - LunaLua General Help

Postby S1eth » Wed Jul 13, 2016 5:53 am

Quantumenace wrote:I tried updating Lunalua on my 2.0 beta version recently and I keep getting this annoying error every time I start a game, load a world in game (or sometimes a level), or load a level in the legacy editor:

Errors while loading sound files
Some audio files failed to load:
C:\...\SMBX2\sound\fireball.mp3

All those sound files are .ogg. I tried converting an mp3 of the fireball sound but it still gives the error. Everything in the game appears to work, it's just irritating.
I followed the instructions on the first post, are there other Lunalua files I need to replace?
In your SMBX folder, open sounds.ini. Look for file="sound/fireball.mp3" and change that to ogg

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

Re: Need help with lua? - LunaLua General Help

Postby Enjl » Wed Jul 13, 2016 7:27 am

S1eth wrote:
Quantumenace wrote:I tried updating Lunalua on my 2.0 beta version recently and I keep getting this annoying error every time I start a game, load a world in game (or sometimes a level), or load a level in the legacy editor:

Errors while loading sound files
Some audio files failed to load:
C:\...\SMBX2\sound\fireball.mp3

All those sound files are .ogg. I tried converting an mp3 of the fireball sound but it still gives the error. Everything in the game appears to work, it's just irritating.
I followed the instructions on the first post, are there other Lunalua files I need to replace?
In your SMBX folder, open sounds.ini. Look for file="sound/fireball.mp3" and change that to ogg
In the sounds.ini, the line already says .ogg. To fix the error specified, you'll have to uncomment the lines related to the fireball sound, because for whatever reason someone left semicolons in front of them.
The ABC of Creation
________________________________________________________
Image

User avatar
Quantumenace
Ripper II
Ripper II
Posts: 308
Joined: Mon Dec 28, 2015 2:17 am

Re: Need help with lua? - LunaLua General Help

Postby Quantumenace » Wed Jul 13, 2016 1:40 pm

Thanks!

User avatar
Reign
Ripper II
Ripper II
Posts: 320
Joined: Tue Jan 21, 2014 4:22 am
Current Project: Yet untitled.

Re: Need help with lua? - LunaLua General Help

Postby Reign » Fri Jul 15, 2016 12:09 pm

I'm trying to get CinematX to work.

According to this (http://wohlsoft.ru/pgewiki/CinematX.lua - possibly outdated) article, you are supposed to just have these files installed

textblox.lua
GraphX.lua
Eventu.lua
Colliders.lua
Npcconfig.lua
Inputs.lua

And you are supposed to have this line in your lunalua.dll -file which I do.

cinematX = loadSharedAPI("cinematX")

And this happens, the default message UI is not replaced and instead there are two numbers displayed on top of the player and on top of an NPC that has a message. What could be causing this? I even reinstalled Lunalua to try to fix it. The graphic files are in the CinematX -folder.

Image
Episodes released:

PixelPest
Link
Link
Posts: 7116
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Current Project: Boom Boom Evolution
Chat Username: PixelPest
Contact:

Re: Need help with lua? - LunaLua General Help

Postby PixelPest » Fri Jul 15, 2016 5:53 pm

Reign wrote:I'm trying to get CinematX to work.

According to this (http://wohlsoft.ru/pgewiki/CinematX.lua - possibly outdated) article, you are supposed to just have these files installed

textblox.lua
GraphX.lua
Eventu.lua
Colliders.lua
Npcconfig.lua
Inputs.lua

And you are supposed to have this line in your lunalua.dll -file which I do.

cinematX = loadSharedAPI("cinematX")

And this happens, the default message UI is not replaced and instead there are two numbers displayed on top of the player and on top of an NPC that has a message. What could be causing this? I even reinstalled Lunalua to try to fix it. The graphic files are in the CinematX -folder.

Image
Please correct me if I'm wrong, but I'm pretty sure CinematX is (or was at the release of SMBX 2.0 Beta) really heavy WIP, so maybe some aspects of it won't work. You can always take a look at the example episode though

User avatar
Reign
Ripper II
Ripper II
Posts: 320
Joined: Tue Jan 21, 2014 4:22 am
Current Project: Yet untitled.

Re: Need help with lua? - LunaLua General Help

Postby Reign » Sat Jul 16, 2016 2:04 am

Yeah, that's possible. :) I might just use the default message boxes instead, but which episode do you actually mean?
Episodes released:

MECHDRAGON777
Pink Yoshi Egg
Pink Yoshi Egg
Posts: 6234
Joined: Fri Dec 20, 2013 6:40 pm
Flair: Nuclear Queen of Reversion.
Current Project: http://www.supermariobrosx.org/forums/v ... 9&start=10
Chat Username: 鬼人 正邪
Contact:

Re: Need help with lua? - LunaLua General Help

Postby MECHDRAGON777 » Sat Jul 16, 2016 3:04 am

Reign wrote:Yeah, that's possible. :) I might just use the default message boxes instead, but which episode do you actually mean?
If you have 2.0, their is a little test episode that came with it...

ImageImageImage

Image

User avatar
Reign
Ripper II
Ripper II
Posts: 320
Joined: Tue Jan 21, 2014 4:22 am
Current Project: Yet untitled.

Re: Need help with lua? - LunaLua General Help

Postby Reign » Sat Jul 16, 2016 5:14 am

I was using PGE+Luna-modified SMBX. Seems the fault might have been in that since I get the same error opening the example episode. I'll try to move on to SMBX 2 now then, however I already found some issues with that too... so moving on to complain in another thread.
Episodes released:

User avatar
Quantix
Ripper II
Ripper II
Posts: 328
Joined: Tue Jan 26, 2016 5:04 pm

Re: Need help with lua? - LunaLua General Help

Postby Quantix » Sat Jul 16, 2016 9:43 am

A question: is there a way to make all graphics of a certain type transparent with Lua?
viewtopic.php?f=69&p=286856#p286855

Generic Quote Collection:
Spoiler: show
Skant wrote:The egg will fuck you if you don't catch it
rockythechao wrote:f6 is an over-the-counter generic run-of-the-mill store-brand bootleg knockoff f5
some people wrote:The021stYoshiFromThe021stCentury: Who would win, a tophat wearing a tophat, or hoeloe wearing hoeloe?
Hoeloe: yes
glitch4: f6
rockythecomet: that's a trick question
rockythecomet: a top hat wearing a hoeloe
Waffles & Stuff (timocomlita) wrote:No matter what you do, it's impossible to get rid of the impossible.
Petrifying wrote:Piss off with your sex doll SMBX 2.0
Enjl wrote:it puts a twist on classic 4 step level design which i like to call "2 and a half steps backwards design"

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: Need help with lua? - LunaLua General Help

Postby underFlo » Sat Jul 16, 2016 12:56 pm

Do you mean sprites you draw with Lua or built-in graphics like NPCs?
im a girl yo


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests