Stickykeys.lua!(V 1.1) - Items are glued to your hands!

Share and discuss custom LunaLua code and content packs for SMBX2.

Moderator: Userbase Moderators

MarioChallengerX2
Buster Beetle
Buster Beetle
Posts: 88
Joined: Sat Dec 31, 2022 4:34 pm
Pronouns: he/him

Stickykeys.lua!(V 1.1) - Items are glued to your hands!

Postby MarioChallengerX2 » Thu Sep 14, 2023 9:39 pm

Sticky Keys from SMW ROM hacks are here!!!

Originally, in SMW, Sticky Keys are actually a sprite used with the Sticky Hands ASM

https://www.smwcentral.net/?p=section&a ... s&id=33627

https://www.smwcentral.net/?p=section&a ... s&id=21745



But now, with the help of people like Emral, Quine, Hoeloe and ESPECIALLY Mr.Nameless who actually provided base code to make you never let go items, this mechanic is now in SMBX!

Library code:
https://pastebin.com/6g1w6yCD

Gif of the library in action:
Spoiler: show
I know it doesn't look like anything different but the text.print on the screen is the state of player.keys.run. Showing that I am pressing it repeatedly and I can't let go of the item. https://cdn.discordapp.com/attachments/ ... _29_25.gif
HOW TO USE:
Spoiler: show
To load the library, you need to put this in your luna.lua file.

Code: Select all

local SK = require("stickyKeys")
Variables you can touch:
Spoiler: show

Code: Select all

SK.stickymovementstate -- if this is set to false, the script will be automatically holding the run button for you. If this is set to true, no run button will be held. True by default. 
Fun Fact: Apparently, walking with stickykeys issn't possible in SMW afaik, but with a memory method in SMBX, this was possible to make happen!
How to register NPCS that can be stuck to Mario's hands:
Spoiler: show
A lookup table called SK.holdingtable is used to register NPCS that can be glued to Mario's hands.

Registering an NPC is simple: In the library, both NPC-45 and NPC-31 are sticky by default. To add an NPC, you have to type this code in:

Code: Select all

SK.holdingtable[30] = true -- registers NPC-30 as a sticky item Mario can hold 
This is my first library ever made for SMBX2 and I hope you enjoy using it!

IMPORTANT NOTES:
Spoiler: show
Klonoa won't work with this code. He can throw the items regardless if Stickykeys is active.
Last edited by MarioChallengerX2 on Thu Sep 28, 2023 9:22 pm, edited 2 times in total.

punkitt
Spiny
Spiny
Posts: 25
Joined: Sun Jun 11, 2023 4:31 pm
Pronouns: she/her
Contact:

Re: Stickykeys.lua! - Items are glued to your hands!

Postby punkitt » Mon Sep 18, 2023 10:14 pm

Oh, this is genuinely perfect for something I wanna do for a level! Thanks a bunch!

MarioChallengerX2
Buster Beetle
Buster Beetle
Posts: 88
Joined: Sat Dec 31, 2022 4:34 pm
Pronouns: he/him

Re: Stickykeys.lua!(V 1.1) - Items are glued to your hands!

Postby MarioChallengerX2 » Thu Sep 28, 2023 9:23 pm

Stickykeys 1.1 is here!!

Changes:
  • Merged the runstate and the walk state into one single variable for better user understanding.
  • Script is now multiplayer compatible!


Return to “LunaLua”

Who is online

Users browsing this forum: PizzaNoob and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari