anotherpowerup.lua - and another one

Share and discuss custom LunaLua code and content packs for SMBX2.
Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 8889
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

anotherpowerup.lua - and another one

Postby Enjl » Wed Apr 01, 2020 3:51 pm

I woke up today with motivation to do this so here you go:
https://drive.google.com/file/d/1FeFLta ... sp=sharing
Gif: show
Image
How does it work?
This essentially replaces the fire and ice flower with whatever you want. It comes preinstalled with fire and ice flower replacements, and I included a little demo level with a Gold Flower to show how a custom powerup might be implemented.

Features:
- Technically infinite powerups. The biggest bottleneck is your motivation to make player hitboxes and spritesheets and code.
- As mentioned above, every powerup state can have its own hitboxes and spritesheets. Hitboxes must be named like "mario-powerupname.ini", so in the example for the gold flower that'd be "mario-ap_goldflower.ini".
- Every powerup gets onTick, onDraw, onTickEnd which run only when the powerup is active, as well as onEnable and onDisable for when the player switches to and fro.
- As a little additional feature, you can define powerup tiers, or just whether you would like to have the powerup turn into a mushroom when the player is small.
- Powerups save across levels.

Limitations:
- You cannot make mini mario since every powerup has the properties of a full grown adult (can smash bricks and turn blocks).
- Only works with Mario, Luigi, Peach, Toad. Link's projectile timers make extracting fire and ice flower for this impossible. The rest all have custom code that is impossible to fight against.

Stuff:
-- registerPowerup registers a new powerup to the system
--- libraryName: string - The name of the library containing powerup information. One library per powerup. Think of it as a require(libraryName) call

-- Returns the library table for the powerup
ap.registerPowerup(libraryName)

-- Returns the player's current powerup, accounting for anotherpowerup powerups. Use this instead of player.powerup.
function ap.getPowerup()

-- Use this instead of setting powerup. Silent avoids the powerup animation and sound.
function ap.setPlayerPowerup(appower, silent)

-- registerItemTier registers a new tier chain for items.
-- spawnedItem: number - The item that spawns from a block.
-- chain: table - The list of states ordered by significance. Numbers correspond to vanilla states, strings correspond to the names of anotherpowerup powerups. See demo for more info.
-- if you provide chain as "true", it will accept everything except for small mario
function ap.registerItemTier(spawnedItem, chain)

Score is doubled up for vanilla powerup npcs but literally who cares.
If you make powerups for this make sure that they're clearly marked as anotherpowerup mods so people can find them.

Enjoy.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

User avatar
Taycamgame
Gold Yoshi Egg
Gold Yoshi Egg
Posts: 1436
Joined: Mon Jun 19, 2017 11:35 am
Flair: Stargard
Contact:

Re: anotherpowerup.lua - and another one

Postby Taycamgame » Wed Apr 01, 2020 5:28 pm

I thought it was currently impossible to add new powerups due to the Id system?
Official Level Reviewer (My Gold Yoshi Egg rank replaced the level reviewer icon, but i am still a level reviewer).
Image
Image
Image
Image
Check out the World Map Service that i host:
viewtopic.php?p=316733#p316733
Check out the projects i support:
Spoiler: show
ImageImage
Image
Image
Quotes: show
xDestroy wrote:
Wellington Games wrote:Taycamgame, I know how to take screenshots in the SMBX.
https://nsmbx.proboards.com/
------
Tower Mario Bros.

User avatar
Electriking
Posts: 4535
Joined: Mon Jun 06, 2016 4:32 pm
Flair: I have NO idea what to put here
Contact:

Re: anotherpowerup.lua - and another one

Postby Electriking » Wed Apr 01, 2020 5:43 pm

Taycamgame wrote:
Wed Apr 01, 2020 5:28 pm
I thought it was currently impossible to add new powerups due to the Id system?
Still is. This system just replaces fire and ice flowers.
SMM2 ID: JJF-P7G-FSF

User avatar
FanofSMBX
Bowser
Bowser
Posts: 3874
Joined: Sun Dec 22, 2013 12:01 pm

Re: anotherpowerup.lua - and another one

Postby FanofSMBX » Sat May 02, 2020 12:36 am

"- You cannot make mini mario since every powerup has the properties of a full grown adult (can smash bricks and turn blocks)."

Can't one theoretically
1. Combine fire and ice mario into slot 3
2. Make slot 7 have a small hitbox
3. Code custom blocks (brick and turn block replicas) that do NOT smash if one is in form 7?

It's complex, sure, but if one is already making Mini Mario's floaty physics and water stuff then this should be possible.

I believe in Jesus Christ as my Lord and Savior. If you do, put this in your signature.
My graphics pack!
Supporting forums:

Spoiler: show
SMBX Galaxy forum by Pivot40Channel
http://smbxgalaxy.prophpbb.com/
Come to the SMBX+ forums by illias3000. There is a whole forum category dedicated to the boss rush series with official rushes, submit bosses, and fan boss rushes! It is still open but AirSeus Forums is now open:
http://nsmbx.prophpbb.com/
AirSeus Forums the new home of the Boss Rush series:
http://smbxairseusforums.prophpbb.com/
Spoiler: show
First to discover:
Spark
Eerie
Grinder
Rainbow Shell
Birdo
Boom Boom
Image
Image
Image
Image
Image
KINGBOWSER112 RULES!


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

Re: anotherpowerup.lua - and another one

Postby Enjl » Sat May 02, 2020 1:30 am

FanofSMBX wrote:
Sat May 02, 2020 12:36 am
"- You cannot make mini mario since every powerup has the properties of a full grown adult (can smash bricks and turn blocks)."

Can't one theoretically
1. Combine fire and ice mario into slot 3
2. Make slot 7 have a small hitbox
3. Code custom blocks (brick and turn block replicas) that do NOT smash if one is in form 7?

It's complex, sure, but if one is already making Mini Mario's floaty physics and water stuff then this should be possible.
Points 1 and 2 dont even contribute to changing those properties, especially since anotherpowerup gives each powerup a string-index, and each powerup already can have its own hitbox (by means of loading/unloading them for player.powerup in onEnable and onDisable). If you REALLY wanna reprogram the powerup hierarchy and all brick blocks and enemy bounce physics... and prevent the player from riding a mount then ... maybe... you can get close to something that resembles mini mushroom, though the amount of effort to make it non-janky is not trivial.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

User avatar
Bulby_VR
Bob-omb
Bob-omb
Posts: 33
Joined: Wed Aug 07, 2019 11:18 am

Re: anotherpowerup.lua - and another one

Postby Bulby_VR » Fri May 08, 2020 11:29 am

um i think that it's bad that it causes an error when you try to pick up a power up with a incompatible character? Is it the power up itself or the inner script?
an ace at making garbo code
When I use mediafire, I use adblock, and you should too when using my links.

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

Re: anotherpowerup.lua - and another one

Postby Enjl » Fri May 08, 2020 12:35 pm

Bulby_VR wrote:
Fri May 08, 2020 11:29 am
um i think that it's bad that it causes an error when you try to pick up a power up with a incompatible character? Is it the power up itself or the inner script?
Well, they're incompatible. I didn't optimize for those, because I figured an episode using this would hardly employ characters that don't work with it.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

User avatar
Bulby_VR
Bob-omb
Bob-omb
Posts: 33
Joined: Wed Aug 07, 2019 11:18 am

Re: anotherpowerup.lua - and another one

Postby Bulby_VR » Sat May 09, 2020 12:51 pm

ah, ok
an ace at making garbo code
When I use mediafire, I use adblock, and you should too when using my links.

ArtAddictedArchitect
Shy Guy
Shy Guy
Posts: 8
Joined: Fri Aug 09, 2019 11:05 am

Re: anotherpowerup.lua - and another one

Postby ArtAddictedArchitect » Mon Jun 29, 2020 7:01 am

So, apart from no mini Mario— what needs to get this useable? By making hit boxes do you mean importing the custom tiles for the new powerup you make or something else?

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

Re: anotherpowerup.lua - and another one

Postby Enjl » Mon Jun 29, 2020 7:49 am

ArtAddictedArchitect wrote:
Mon Jun 29, 2020 7:01 am
So, apart from no mini Mario— what needs to get this useable? By making hit boxes do you mean importing the custom tiles for the new powerup you make or something else?
You need to use the player calibration tool in the data/pge folder to calibrate the hitboxes. Getting a powerup set up is inferrable from the included gold mario example.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

User avatar
MrDoubleA
Bit
Bit
Posts: 136
Joined: Mon Aug 20, 2018 7:02 am
Contact:

Re: anotherpowerup.lua - and another one

Postby MrDoubleA » Mon Jun 29, 2020 11:24 am

I've been wondering... why exactly is the mini mushroom not possible? Couldn't the issues be avoided with onNPCHarm and onBlockHit, and onPlayerHarm?
Hi. I'm not very active on the forums.
(MrDoubleA#3124 on Discord)

rooms.lua - Quick respawn & Celeste-styled rooms
simpleLayerMovement.lua - For all your custom layer movement needs!
MrDoubleA's NPC Pack
Are you a mouse?
I support: show
Image
Image
Image
Image

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

Re: anotherpowerup.lua - and another one

Postby Enjl » Mon Jun 29, 2020 11:38 am

MrDoubleA wrote:
Mon Jun 29, 2020 11:24 am
I've been wondering... why exactly is the mini mushroom not possible? Couldn't the issues be avoided with onNPCHarm and onBlockHit, and onPlayerHarm?
Potentially.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

User avatar
MrDoubleA
Bit
Bit
Posts: 136
Joined: Mon Aug 20, 2018 7:02 am
Contact:

Re: anotherpowerup.lua - and another one

Postby MrDoubleA » Mon Jul 13, 2020 1:21 pm

I've been using this library for a bit, and I have a couple bugs/annoyances to share.

- If you pick up a custom powerup but you already have that powerup, it'll still play the animation.
- When picking up a custom powerup, often times the wrong powerup will appear in the item box. This could maybe be fixed by setting 0x46 to the NPC ID of the powerup (though it'd need to happen after the animation happens, and therefore outside of the setPlayerPowerup function).
- Not a bug, but it'd be really nice to let the sound effect played when grabbing it be customisable.
- Only works with Mario, Luigi, Peach, Toad. Link's projectile timers make extracting fire and ice flower for this impossible. The rest all have custom code that is impossible to fight against.
- Link's projectiles have a dedicated timer, so you can just do this every tick:

Code: Select all

player:mem(0x162,FIELD_WORD,29)
As for the x2 characters... I don't really think anybody cares about those lol


Good job on this, though! It's really nice to have a functional custom powerup library.


Edit: There's also some bugs with the fire/ice flower recreations:
- Both don't spawn fireballs when spin jumping.
- Fire flowers (but not ice flowers) give this error:
Error: show
Image
Hi. I'm not very active on the forums.
(MrDoubleA#3124 on Discord)

rooms.lua - Quick respawn & Celeste-styled rooms
simpleLayerMovement.lua - For all your custom layer movement needs!
MrDoubleA's NPC Pack
Are you a mouse?
I support: show
Image
Image
Image
Image

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

Re: anotherpowerup.lua - and another one

Postby Enjl » Mon Jul 13, 2020 1:51 pm

Thanks for pointing these out! I'll get to fixing them when I have time. I'll reply here when that's happened.

The spinjump thing is actually intentional. Mostly because platforming with a fire flower or ice flower is pretty miserable otherwise. Part of it is also though that I'm not sure how to best do it... Maybe I could make it toggleable if I find that out.

Added in 3 hours 16 minutes 14 seconds:
... alright... Updated the file with a few fixes and experiments.
- Link support? I guess? I'm not sure? The existing powerups don't work with them the way they're written, but the script at least won't outright reject link now. I don't really feel like dealing with link code in the example powerups tbh, but maybe he'll work for further custom ones.
- Fixed the fireflower crash
- You can now have .apSounds table in your powerup file for the upgrade and reserve storage sound effect. Check gold flower for an example. If you wanna change it per character, adjust it upon character change on your end.
- Redesigned the powerup distribution mechanism. Instead of spawning an item on the player it now manually sets the relevant offsets.
- Hopefully fixed reserve powerup distribution as well?

Known issues:
- No change to the way fireball spinjumping works. You can still manually shoot fireballs throughout a spinjump, however.
- Because fire and ice flower in the basic example only use the basegame powerup, there are some duplicate effects, and sometimes the wrong sound effect for the animation plays. The solution here is to introduce new powerup items for those states.
- Still no multiplayer. I toyed around with the idea a little bit, but it's getting late and I don't consider it a priority.
Ideas are useless if you can't make them real.
Image

All my assets from packs and episodes are free to use for non-Novaverse levels and projects, as long as proper credit is given.

User avatar
MrDoubleA
Bit
Bit
Posts: 136
Joined: Mon Aug 20, 2018 7:02 am
Contact:

Re: anotherpowerup.lua - and another one

Postby MrDoubleA » Wed Jul 15, 2020 6:10 pm

Thanks for the update! There's just 3 new bugs I've found recently. (Sorry for all the hassle...)

- The reserve powerup is much more functional now, though it still doesn't seem to work 100% properly.
you're a mouse? - If you collect a custom powerup with nothing in 0x46, you'll get the custom powerup in the item box for whatever reason
you're a mouse? - If you collect a normal powerup while having a custom powerup, a fire/ice flower will appear in the item box
(you should just be able to set 0x46 and reservePowerup appropriately when getting a custom powerup, since 0x46 isn't cleared on level load, though I don't know what's going on with that latter bug)

- The player's frame doesn't get reset to 1 like it normally does when picking up a custom powerup, resulting in the animation almost always looking odd when transforming from small mario)
- Costumes do not work with the fire/ice flower recreations

Edit: it also seems that hitting a block containing a non-custom powerup gives this error:
Error: show
Image
Hi. I'm not very active on the forums.
(MrDoubleA#3124 on Discord)

rooms.lua - Quick respawn & Celeste-styled rooms
simpleLayerMovement.lua - For all your custom layer movement needs!
MrDoubleA's NPC Pack
Are you a mouse?
I support: show
Image
Image
Image
Image

User avatar
marioman2007
Rex
Rex
Posts: 86
Joined: Tue Aug 25, 2020 3:19 am

Re: anotherpowerup.lua - and another one

Postby marioman2007 » Tue Sep 29, 2020 5:03 am

Wow, I was just looking for a Gold Flower, Thanks. But I replaced the golden mario and Gold ball sprites with the one that lx xzit made. I want to ask you one question is it possible to add an sparkling effect and golden trail like the fire flower (effect-77) ?


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 3 guests