Way to add more global switches?

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
PizzaMario
Goomba
Goomba
Posts: 4
Joined: Wed Sep 07, 2022 9:57 pm

Way to add more global switches?

Postby PizzaMario » Sun Aug 20, 2023 9:54 pm

Alright, so the card suit switches. Is there a way to add more of those through lua?

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9731
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Way to add more global switches?

Postby Emral » Sun Aug 20, 2023 11:45 pm

There is.
The easiest way requires the following:
1) A big switch NPC that registers a new palace switch color:

Code: Select all

local bigSwitch = {}

local npcManager = require("npcManager")
local palaceSwitch = require("npcs/ai/palaceswitch")

local npcID = NPC_ID

local settings = {id=npcID, color="purple",  speed = 1, blockon=999, blockoff=1000, iscustomswitch = true}

palaceSwitch.registerSwitch(settings)
return bigSwitch
It sets the IDs of palace switch blocks here in blockon and blockoff. You can set them to any ID of block you want. If you add your own, make sure to use the custom range.

2) The particles for its emission.
These are easily added by having a "particles" folder in your episode folder, with a "switch" subfolder and "part_purple.png" for the texture. Or "part_orange" if it's orange switch, etc... Whatever you set color to in the lua file up there ^^

Once these things are prepared, your added global switch should work.

PizzaMario
Goomba
Goomba
Posts: 4
Joined: Wed Sep 07, 2022 9:57 pm

Re: Way to add more global switches?

Postby PizzaMario » Tue Aug 29, 2023 4:12 pm

Thanks so much, Emral! You're a lifesaver!


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 0 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari