Page 1 of 1

Way to add more global switches?

Posted: Sun Aug 20, 2023 9:54 pm
by PizzaMario
Alright, so the card suit switches. Is there a way to add more of those through lua?

Re: Way to add more global switches?

Posted: Sun Aug 20, 2023 11:45 pm
by Emral
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.

Re: Way to add more global switches?

Posted: Tue Aug 29, 2023 4:12 pm
by PizzaMario
Thanks so much, Emral! You're a lifesaver!