effectReplacer.lua - replace 1.3 and block effects!

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

Moderator: Userbase Moderators

MrDoubleA
Edward
Edward
Posts: 394
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?

effectReplacer.lua - replace 1.3 and block effects!

Postby MrDoubleA » Sat Mar 29, 2025 1:45 pm

Allows you to replace any 1.3 effect with any other effect, including custom ones. Also allows you to set a custom effect to spawn when a block is destroyed, instead of the default one.

Image

Examples: show
Replacing an existing effect with a custom one:

Code: Select all

local effectReplacer = require("effectReplacer")

-- Replace the Goomba death effect (ID 4) with a custom effect (ID 751)
effectReplacer.registerID(4, 751)

-- Setting the replacement effect ID to 0 will result in the original effect simply being removed
effectReplacer.registerID(4, 0)

-- Alternatively, you can also provide a function that runs whenever the effect is replaced
effectReplacer.registerID(4, 751, function(oldEffect, newEffect)
    newEffect.speedY = oldEffect.speedY
end)
Setting up an effect for a block being destroyed:

Code: Select all

local effectReplacer = require("effectReplacer")

-- Replace the destroy effect of the SMW cement block (ID 115) with effect ID 751
effectReplacer.registerBlockDestroyEffect(115, 751)

-- Setting the destroy effect ID to 0 will result in no effects spawning from the block
effectReplacer.registerBlockDestroyEffect(115, 0)

-- Alternatively, you can also provide a function that runs whenever the block is destroyed
effectReplacer.registerBlockDestroyEffect(115, 751, function(block, effect)
    effect.speedY = block.speedY
end)

Download

mariobrigade2018
Rocky Wrench
Rocky Wrench
Posts: 673
Joined: Wed May 24, 2023 7:00 pm
Flair: OK in coding who dreams of making a Mario game
Pronouns: he/him

Re: effectReplacer.lua - replace 1.3 and block effects!

Postby mariobrigade2018 » Sat Mar 29, 2025 8:03 pm

YES! Thank you ohmygoodnessiamfreakingout AAAAAAAAAAAAAAAAAAAAAAAAAAAAA-

Donkdonker124
Hoopster
Hoopster
Posts: 47
Joined: Wed Mar 27, 2024 10:31 am
Flair: Fictionally stronger than man
Pronouns: he/him
Contact:

Re: effectReplacer.lua - replace 1.3 and block effects!

Postby Donkdonker124 » Sun Mar 30, 2025 6:13 am

May you find everything valuable in life, MrDoubleA. Thank you.

ilovehamburgerz
2025 Egg Hunter
2025 Egg Hunter
Posts: 470
Joined: Thu Jul 25, 2024 5:34 am
Flair: i have 0 dollars
Pronouns: he/him

Re: effectReplacer.lua - replace 1.3 and block effects!

Postby ilovehamburgerz » Sun Mar 30, 2025 12:31 pm

This guy keeps cookin πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯

Mal8rk
Snifit
Snifit
Posts: 217
Joined: Mon Oct 25, 2021 11:04 pm
Flair: English Speaking Spanish Speaker
Pronouns: He/Him
Contact:

Re: effectReplacer.lua - replace 1.3 and block effects!

Postby Mal8rk » Wed Apr 02, 2025 11:23 am

This is such a useful script!!!

Although I'm not sure if I'm using it correctly or if there's something wrong with this because when I try to replace block 4's breaking effect, it still spawns the basegame effect

Image

Here's my code:

Code: Select all

effectReplacer.registerBlockDestroyEffect(4, 955)


Return to β€œLunaLua”

Who is online

Users browsing this forum: No registered users and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari