Execute something on block bump, then destroy block

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
dochalkos
Shy Guy
Shy Guy
Posts: 5
Joined: Sat Nov 26, 2022 8:49 pm

Execute something on block bump, then destroy block

Postby dochalkos » Thu Dec 08, 2022 3:48 pm

Feels like this should be braindead simple to do but I'm looking through example scripts and youtube tutorials and can't find the answer. I'm trying to get a custom block to work like the POW item, but in block form: you bump it from below (or otherwise activate it), it does the POW thing, and it's destroyed in the process. I've gathered "misc.doPOW()" is what I need for the effect itself, but what do I put to get this to execute when the block is bumped?

deice
Volcano Lotus
Volcano Lotus
Posts: 542
Joined: Fri Jul 23, 2021 7:35 am

Re: Execute something on block bump, then destroy block

Postby deice » Thu Dec 08, 2022 4:56 pm

i believe you'd want to put it inside the "onPostBlockHit" event. something to note about this event is that even when you register it inside your custom block's lua script, it will still execute for every block that gets hit, which means you have to compare the hit block's id to the id of your custom block before running any of the code (this is outlined within the documentation, but not within the example block script itself even though it maybe ought to be).


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 0 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari