Page 1 of 2

SMB3 Flame Chomp (Custom LunaLua API)

Posted: Thu Mar 03, 2016 6:15 pm
by Valtteri
This is my first LunaLua API. Rednaxela from Talkhaus was a great help. Kevsoft also helped me getting started with LunaLua.

It behaves very closely to SMB3. It chases the player. It has four fireballs and it will shoot each out towards the player. Once it's shot all four, it will explode. It can be killed in all ways except Ice Flower.



To use:
  • Extract the files from the download below to your level folder, create a "lunadll.lua" host file and put the following code in it:

    Code: Select all

    local flameChomp=loadAPI("flamechomp")
    function onStart()
        flameChomp.setSections({0})
    end
  • It replaces the SMB3 brown Paragoomba. You can place it in the editor normally (set it to Chase).
  • To have it spawn automatically throughout the level (like normal), you must create an event called "Flame Chomp" and have it activate at some point in the level. Place an NPC that will activate the event at the point where you want them to begin spawning. Make the event happen automatically at Level Start if you want them to begin spawning immediately.
  • setSections takes a table of numbers that represent the sections you want the Flame Chomp to automatically spawn in. The number must be the section number minus one. The above code only makes them spawn in section 1 for example. To make them spawn in sections 1, 5 and 6 for example, the code would look like this:

    Code: Select all

    local flameChomp=loadAPI("flamechomp")
    function onStart()
        flameChomp.setSections({0,4,5})
    end
Notes:
  • You can use the normal SMB3 Goomba normally despite the Flame Chomp replacing the brown Paragoomba!
http://www.mediafire.com/download/7u9c5x76rhh9r3k/

Re: SMB3 Flame Chomp (LunaLua API)

Posted: Thu Mar 03, 2016 6:23 pm
by CopyLeft
I won't be using this any time soon, but this could work quite well for quite a few levels.
Nicely done!

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Thu Mar 03, 2016 7:49 pm
by HenryRichard
I think you can do Misc.doBombExplosion(x, y, 3) to make an explosion instead of dummying out the SMB3 bob-oms. This is pretty sweet though, I'll definitely be using this.

I just don't know what's going wrong...

Posted: Thu Mar 03, 2016 9:52 pm
by CraftedPbody
I've been trying to get Valtteri's Flame Chomp working... I can't do it... I've put

Code: Select all

local flameChomp=loadAPI("flamechomp")
function onStart()
    flameChomp.setSections({0})
end
into a lunadll.lua folder. I've Updated my lunalua to the latest Nightly Dev and the latest version. I've even made a change from "loadAPI" to "API.load". I have no idea how to get this working... Any suggestions? I've been getting this error : Image

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Thu Mar 03, 2016 10:10 pm
by TLtimelord
Valtteri you made my day.

You can effin guarantee I'll be using this.

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Fri Mar 04, 2016 7:30 am
by Valtteri
HenryRichard wrote:I think you can do Misc.doBombExplosion(x, y, 3) to make an explosion instead of dummying out the SMB3 bob-oms. This is pretty sweet though, I'll definitely be using this.
Thanks for pointing this out! I have now edited my code so it will utilize this function instead of spawning an exploding Bob-omb. I updated the download already. Bob-ombs are now compatible with the API!

Re: I just don't know what's going wrong...

Posted: Fri Mar 04, 2016 10:21 am
by RudeGuy
I think the error is that you've put a 0 in setSections. Try putting a number from 1 to 21 there,

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Fri Mar 04, 2016 1:21 pm
by Quantumenace
Nice! I'll have to look at this for pointers for my own NPC APIs. They're working well, but yours look neater somehow.

I think I saw the chomp go off the bottom of the section, which kills it. It's something I had to prevent with my own flying NPC. Just a thought.

Re: I just don't know what's going wrong...

Posted: Fri Mar 04, 2016 2:34 pm
by CraftedPbody
RudeGuy07 wrote:I think the error is that you've put a 0 in setSections. Try putting a number from 1 to 21 there,
Image

I just tried that and it's still not working... Thanks for trying to help though!

UPDATE: I just put in the new version of Valtteri's Flame Chomp. I got a different error; two different errors actually... A "Divide by zero" error and another error :
Image

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Fri Mar 04, 2016 3:51 pm
by Valtteri
CraftedPbody wrote:UPDATE: I just put in the new version of Valtteri's Flame Chomp. I got a different error; two different errors actually... A "Divide by zero" error and another error :
Please redownload it. http://www.mediafire.com/download/7u9c5x76rhh9r3k/

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Fri Mar 04, 2016 4:00 pm
by CraftedPbody
It's working now!

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Tue Mar 22, 2016 12:50 pm
by Nat The Porcupine
When I first saw this in action, my jaw literally hit the floor (I was lying on the ground, so...). This has inspired me to bring a few of the enemies from SMB3 to SMBX myself. I actually just finished an API for the Fire Snake this morning. Can't wait to see what you do next ;)

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Mon Mar 28, 2016 3:24 pm
by timocomsmbx2345
Wait, if the Flame Chomp replaces the Para-goomba, does that mean it will turn into a goomba when stomped?

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Mon Mar 28, 2016 3:28 pm
by PixelPest
timocomsmbx2345 wrote:Wait, if the Flame Chomp replaces the Para-goomba, does that mean it will turn into a goomba when stomped?
No. It doesn't

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Thu Mar 31, 2016 9:03 am
by timocomsmbx2345
One more thing! Where do you get the checkpoint flag?

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Thu Mar 31, 2016 9:09 am
by Valtteri
timocomsmbx2345 wrote:One more thing! Where do you get the checkpoint flag?
At the moment it only exists in my level which you can download here. http://www.smbxgame.com/forums/v ... 63&t=13399

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Wed Sep 28, 2016 1:33 pm
by PlumberGraduate
It just says "'=' expected near 'Â' at line 36" for me. :(

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Wed Sep 28, 2016 2:42 pm
by aero

Code: Select all

if(v.part=="head") then
                if((v.ticks>=0 and v.ticks<2) or (v.ticks>=8 and v.ticks<10)) then --frame 1
                    if v.direction==-1 then
                        Graphics.drawImageToSceneWP(flameChomp, v.x, v.y, 0, 32, 32, 32, -5)
                    elseif v.direction==1 then
                        Graphics.drawImageToSceneWP(flameChomp, v.x, v.y, 0, 192, 32, 32, -5)
                    end
                elseif((v.ticks>=2 and v.ticks<4) or (v.ticks>=10 and v.ticks<12)) then --frame 2
                    if v.direction==-1 then
                        Graphics.drawImageToSceneWP(flameChomp, v.x, v.y, 0, 64, 32, 32, -5)
                    elseif v.direction==1 then
                        Graphics.drawImageToSceneWP(flameChomp, v.x, v.y, 0, 224, 32, 32, -5)
                    end
                elseif((v.ticks>=4 and v.ticks<6) or (v.ticks>=12 and v.ticks<14)) then --frame 3
                    if v.direction==-1 then
                        Graphics.drawImageToSceneWP(flameChomp, v.x, v.y, 0, 96, 32, 32, -5)
                    elseif v.direction==1 then
                        Graphics.drawImageToSceneWP(flameChomp, v.x, v.y, 0, 256, 32, 32, -5)
                    end
                elseif((v.ticks>=6 and v.ticks<8) or (v.ticks>=14 and v.ticks<16)) then --frame 4
                    if v.direction==-1 then
                        Graphics.drawImageToSceneWP(flameChomp, v.x, v.y, 0, 128, 32, 32, -5)
                    elseif v.direction==1 then
                        Graphics.drawImageToSceneWP(flameChomp, v.x, v.y, 0, 288, 32, 32, -5)
                    end
                elseif(v.ticks>=16) then --frame 5
                    if v.direction==-1 then
                        Graphics.drawImageToSceneWP(flameChomp, v.x, v.y, 0, 320, 32, 32, -5)
                    elseif v.direction==1 then
                        Graphics.drawImageToSceneWP(flameChomp, v.x, v.y, 0, 352, 32, 32, -5)
                end
end
can be reduced to

Code: Select all

if(v.part=="head") then

	if v.direction==-1 then
                  Graphics.drawImageToSceneWP(flameChomp, v.x, v.y, 0, yourframetimer * 32, 32, 32, -5)
        elseif v.direction==1 then
                  Graphics.drawImageToSceneWP(flameChomp, v.x, v.y, 0, (yourframetimer * 32) * (yourframetimer + 6), 32, 32, -5)
        end
        
end

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Thu Sep 29, 2016 10:25 am
by PlumberGraduate
Fixed it, but I don't know how... :lol:

Re: SMB3 Flame Chomp (Custom LunaLua API)

Posted: Thu Sep 29, 2016 10:41 am
by Valtteri
I suggest you post in the LunaLua help topic about this. The API worked some months ago but LunaLua has updated since and might have rendered this API broken. Usually fixing these issues is a simple procedure.