Page 1 of 1

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

Posted: Thu Sep 14, 2023 9:39 pm
by MarioChallengerX2
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.

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

Posted: Mon Sep 18, 2023 10:14 pm
by punkitt
Oh, this is genuinely perfect for something I wanna do for a level! Thanks a bunch!

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

Posted: Thu Sep 28, 2023 9:23 pm
by MarioChallengerX2
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!