respawnRooms.lua (v1.1) - Quick respawn and Celeste-styled rooms, again!

Share and discuss custom LunaLua code and content packs for SMBX2.
MrDoubleA
Flurry
Flurry
Posts: 384
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?
Pronouns: he/him

respawnRooms.lua (v1.1) - Quick respawn and Celeste-styled rooms, again!

Postby MrDoubleA » Sun Feb 19, 2023 3:11 pm

This is a complete rewrite of one of my older libraries, rooms.lua. It includes new features, new settings, and is just generally better-written and more stable.

It uses sizeables to set up rooms in order to have more settings, though it is still compatible with the old quicksand rooms.lua system. If you find any bugs, report them in this thread!

Image

How to use: show
Installation
After downloading, extract the contents into your level/episode folder. Then, add the following line to your luna.lua file:

Code: Select all

local respawnRooms = require("respawnRooms")
You can edit any settings by opening the respawnRooms.lua file and editing the values at the very bottom.

Lua Use
Any custom lua may not be compatible with the library's reset/quick respawn. However, you can help fix this with the following custom events: onRoomEnter, onPreReset, and onPostReset. This can be registered with the library like so (assuming it is already loaded):

Code: Select all

function respawnRooms.onRoomEnter(room)
    -- Your code here (note that room is an actual room object, not a number)
end

function respawnRooms.onPreReset(fromRespawn)
    -- Your code here
end

function respawnRooms.onPostReset(fromRespawn)
    -- Your code here
end

Note that any code written to be compatible with rooms.lua may not necessarily be compatible with respawnRooms.lua.


Download!

Ness-Wednesday
Purple Yoshi Egg
Purple Yoshi Egg
Posts: 1576
Joined: Sun Jun 28, 2015 3:50 pm
Flair: Diverse Scouts
Pronouns: He/Him

Re: respawnRooms.lua - Quick respawn and Celeste-styled rooms, again!

Postby Ness-Wednesday » Sun Feb 19, 2023 3:22 pm

Friendship ended with rooms.lua, now respawnRooms.lua is my best friend.

But seriously, I'm excited to start using this for future levels.

DisasterMaster
Monty Mole
Monty Mole
Posts: 147
Joined: Fri Jan 31, 2020 10:01 pm

Re: respawnRooms.lua - Quick respawn and Celeste-styled rooms, again!

Postby DisasterMaster » Sun Feb 19, 2023 3:58 pm

An excellent upgrade of Rooms.lua! I was experimenting with one of my levels that uses your SMM Key Coins and it properly saves their collection.

I did notice an issue that carried over involving the Yoshi's Island P-Block state. A solid block (block-689) will change to passthrough (block-690) when you first die, with no change in P-switch state.
Image

I also noticed that it will disable some libraries upon the first death, such as icantswim.lua (shown below). I'm assuming you have to re-enable it somehow using "onPostReset"?
Image

Otherwise, very nicely done.

MrDoubleA
Flurry
Flurry
Posts: 384
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?
Pronouns: he/him

Re: respawnRooms.lua - Quick respawn and Celeste-styled rooms, again!

Postby MrDoubleA » Sun Feb 19, 2023 5:54 pm

DisasterMaster wrote:
Sun Feb 19, 2023 3:58 pm
An excellent upgrade of Rooms.lua! I was experimenting with one of my levels that uses your SMM Key Coins and it properly saves their collection.

I did notice an issue that carried over involving the Yoshi's Island P-Block state. A solid block (block-689) will change to passthrough (block-690) when you first die, with no change in P-switch state.
Image

I also noticed that it will disable some libraries upon the first death, such as icantswim.lua (shown below). I'm assuming you have to re-enable it somehow using "onPostReset"?
Image

Otherwise, very nicely done.
I'll take a proper look into the YI P-blocks later, but the libraries being "disabled" is actually just because their onStart event does not get run again after the reset. So just making that happen would fix them.

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

Re: respawnRooms.lua - Quick respawn and Celeste-styled rooms, again!

Postby deice » Sun Feb 19, 2023 7:09 pm

MrDoubleA wrote:
Sun Feb 19, 2023 5:54 pm
I'll take a proper look into the YI P-blocks later
do beware that the yi p-switch blocks are kinda broken in general, read this thread for more details.

MarioChallengerX2
Bit
Bit
Posts: 77
Joined: Sat Dec 31, 2022 4:34 pm
Pronouns: he/him

Re: respawnRooms.lua - Quick respawn and Celeste-styled rooms, again!

Postby MarioChallengerX2 » Sun Feb 19, 2023 8:56 pm

Okay, so a small hiccup here.
You registered the custom tileset as 951 and 952 but the actual ids are 851 and 852

EDIT: Wait a second! They're registered as backgrounds and not blocks...

Is that what is supposed to happen?

DisasterMaster
Monty Mole
Monty Mole
Posts: 147
Joined: Fri Jan 31, 2020 10:01 pm

Re: respawnRooms.lua - Quick respawn and Celeste-styled rooms, again!

Postby DisasterMaster » Sun Feb 19, 2023 10:24 pm

MarioChallengerX2 wrote:
Sun Feb 19, 2023 8:56 pm
Okay, so a small hiccup here.
You registered the custom tileset as 951 and 952 but the actual ids are 851 and 852

EDIT: Wait a second! They're registered as backgrounds and not blocks...

Is that what is supposed to happen?
The script comes with 1 block (block-997) and 2 bgos (background-851 & 852). The bgos in the custom tileset "respawnRooms BGOs" should be set to 851 and 852, as opposed to the 951 and 952 that they are initially set as.


I'm also happy to say that the script is working properly with the altered YI block AI provided by deice.
Image

TLtimelord
Red Yoshi Egg
Red Yoshi Egg
Posts: 2668
Joined: Sat Dec 21, 2013 5:16 pm
Flair: Info under raps

Re: respawnRooms.lua - Quick respawn and Celeste-styled rooms, again!

Postby TLtimelord » Mon Feb 20, 2023 12:12 am

Thank you, I hope to make good use of this soon.

FutureNyanCat
Rocky Wrench
Rocky Wrench
Posts: 695
Joined: Fri Dec 20, 2013 8:39 pm
Flair: Species: Felis robotus
Pronouns: He/Him
Contact:

Re: respawnRooms.lua - Quick respawn and Celeste-styled rooms, again!

Postby FutureNyanCat » Mon Feb 20, 2023 4:22 am

There's a lot of bugs I've seen surface with this script from extensive testing with other custom scripts, including breaking of compatibility with some of MDA's scripts such as Helmets.lua (helmet is kept on the player after respawn), SimpleLayerMovement.lua, and extraNPCProperties. I've already reported them in DMs on Discord, and seems me and my friends found a couple more as well which broke custom NPCs like Magikoopa Sorcerer and Train Monty Moles by Enjl.

Some NPCs with their own custom extra settings may break, including Wowsie's SMW Sign. This was also reported by me on Discord too. I'm keeping an eye out for other bugs to ensure increased stability for this script.

Ness-Wednesday
Purple Yoshi Egg
Purple Yoshi Egg
Posts: 1576
Joined: Sun Jun 28, 2015 3:50 pm
Flair: Diverse Scouts
Pronouns: He/Him

Re: respawnRooms.lua - Quick respawn and Celeste-styled rooms, again!

Postby Ness-Wednesday » Mon Feb 20, 2023 5:35 pm

FutureNyanCat wrote: There's a lot of bugs I've seen surface with this script from extensive testing with other custom scripts, including breaking of compatibility with some of MDA's scripts such as Helmets.lua (helmet is kept on the player after respawn), SimpleLayerMovement.lua, and extraNPCProperties. I've already reported them in DMs on Discord, and seems me and my friends found a couple more as well which broke custom NPCs like Magikoopa Sorcerer and Train Monty Moles by Enjl.

Some NPCs with their own custom extra settings may break, including Wowsie's SMW Sign. This was also reported by me on Discord too. I'm keeping an eye out for other bugs to ensure increased stability for this script.
Adding onto this, I can confirm that it also breaks SetaYoshi's wormholes and SineLayerMovement.lua. While respawning, I get this error message on every tick until the transition ends:
Image
After respawning, layers that move via SineLayerMovement.lua won't reset back to their original place:
Spoiler: show
Image

S_Koopa0
Spiny
Spiny
Posts: 26
Joined: Mon Jul 04, 2016 10:57 am
Flair: The S stands for Springboard

Re: respawnRooms.lua - Quick respawn and Celeste-styled rooms, again!

Postby S_Koopa0 » Sat Mar 25, 2023 8:21 am

I also found an issue: setting respawnSettings.enabled to false doesn't seem to disable the quick respawn, but the death music still plays when the player dies, completely stopping the music for part of the level.

tangy
Hoopster
Hoopster
Posts: 110
Joined: Tue Oct 23, 2018 11:32 pm
Flair: less is more

Re: respawnRooms.lua - Quick respawn and Celeste-styled rooms, again!

Postby tangy » Tue Apr 04, 2023 11:05 pm

setting respawnSettings.enabled to false doesn't actually disable respawning. this makes one of my use cases for it unviable. Also the tilesets included by default have bgo 951 and 952 instead of 851 and 852

MrDoubleA
Flurry
Flurry
Posts: 384
Joined: Mon Aug 20, 2018 7:02 am
Flair: How much munchers?
Pronouns: he/him

Re: respawnRooms.lua - Quick respawn and Celeste-styled rooms, again!

Postby MrDoubleA » Fri Apr 07, 2023 9:07 am

Finally got around to fixing the issues with respawn not being disabled and the tileset. Also, added an option to give the player a powerup when respawning.

I'd also like to note that a lot of the issues regarding compatibility with other libraries that have been reported are not issues with respawnRooms. If you wanna fix them, you have to modify the library that it isn't working with.

georgespezi12
Dolphin
Dolphin
Posts: 99
Joined: Mon Jun 01, 2020 3:45 am

Re: respawnRooms.lua (v1.1) - Quick respawn and Celeste-styled rooms, again!

Postby georgespezi12 » Fri Apr 07, 2023 10:46 am

Version 1-1 fixed my issue of the player respawning after death with the music inactive instead of dying outright.

Just_Thomas
Blooper
Blooper
Posts: 190
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Re: respawnRooms.lua (v1.1) - Quick respawn and Celeste-styled rooms, again!

Postby Just_Thomas » Fri Dec 22, 2023 11:05 am

I have some - hopefully just configuration - problems here:
Level is a ghost house, main area has a repawnroom as well SOME additional rooms (in complete seperate sections)

Use Physical Boundaries: OFF
Act as Spawn Zone: OFF
Reset Level When Entered: Default

respawnrooms.lua is changed to these settings here:

Code: Select all

respawnRooms.resetSettings = {
    -- If true, event timers will reset, layer speeds will reset, and auto-start events will trigger again.
    eventsReset = true,
    -- If true, section settings (such as background and music) will reset.
    sectionsReset = true,

    -- If true, star coins will reset when dying if they have not been saved.
    starCoinsReset = true,

    -- If true, p-switches and the stopwatch effect will be reset when going through rooms (they always be reset when dying, regardless of this setting).
    timedSwitchesReset = false,
    -- If true, the 4 color switches and the ON/OFF switch will reset when going through rooms (they always be reset when dying, regardless of this setting).
    colorSwitchesReset = false,

    -- If true, the player's held NPC will be reset when going through a room.
    -- Also affects NPCs in Yoshi's mouth.
    resetHeldNPC = false,
}

respawnRooms.roomSettings = {
    -- Default options for the extra settings of each room.
    -- For quicksand, these'll always be used, no matter what.
    defaultOptions = {
        -- If set, this room will have "solid" walls and a death plane if there isn't an adjacent room.
        usePhysicalBounds = false,
        -- If set, any NPC's inside will be spawned when the player is in the room, regardless of if they are on camera.
        actAsSpawnZone = true,
        -- If set, most of the level will be reset (similar to when respawning) when this room is entered.
        resetWhenEntered = true,
    },

    -- If true, the level will be reset at the end of transition and not the start. Doesn't affect non-panning transitions.
    onlyResetAtEnd = false,

    -- The layer name that quicksand rooms are placed on.
    quicksandLayerName = "Rooms",

    -- The speed that the player will get (in pixels per frame) when entering the room from the bottom.
    -- If 0, there will be no speed boost.
    jumpFromBelowSpeed = -10,

    -- The type of camera movement for the transition. Can be NONE for no transition.
    -- Can be PAN_CONSTANT, PAN_SMOOTH, PAN_SINE, or PAN_QUAD to have the camera move between rooms.
    -- Can be FADE, MOSAIC, DIAMOND, ROTATING_SQUARE, DIAMOND_SWEEP, INWARD_SWEEP, or WIPE to have a fade between rooms.
    transitionType = respawnRooms.TRANSITION_TYPE.MOSAIC,

    -- The duration (in frames) that a camera transition lasts.
    panTransitionDuration = 20,

    -- The amount of time (in frames) that the screen will fade to black during a fade transition.
    fadeOutDuration = 32,
    -- The amount of time (in frames) that the screen will fade from black, back to gameplay during a fade transition.
    fadeBackDuration = 32,
    -- The amount of time (in frames) that the screen will remain completely black during a fade transition. This can be 0.
    fadeWaitTime = 0,
}

respawnRooms.respawnSettings = {
    -- If true, quick respawn will be enabled. When the player dies, there will be a brief transition and the level will reset without a loading screen.
    enabled = false,

    -- Powerup that the player will have when respawning.
    respawnPowerup = PLAYER_SMALL,

    -- If true, respawn BGO's will never be used, and the actual start point/checkpoints will be used instead.
    neverUseRespawnBGOs = false,
    -- The directions of each respawn BGO.
    respawnBGODirections = {
        [851] = DIR_RIGHT,
        [852] = DIR_LEFT,
    },

    -- The sound effect played when the player dies. Can be nil, a string, or a number.
    -- Default value is 38, which is the birdo spit sound.
    deathSound = 38,
    -- The amount of screen shake to have when the player dies. Can be 0 for none.
    deathEarthquake = 0,

    -- If true, the game will be paused while the transition is active.
    pauseDuringTransition = true,

    -- The type of transition to use.
    -- Can be NONE, FADE, MOSAIC, DIAMOND, ROTATING_SQUARE, DIAMOND_SWEEP, INWARD_SWEEP, or WIPE.
    transitionType = respawnRooms.TRANSITION_TYPE.MOSAIC,

    -- The amount of time (in frames) to wait between the player dying and the transition starting.
    deathAnimDuration = 0,
    -- The amount of time (in frames) that the screen will fade to black during the transition.
    fadeOutDuration = 32,
    -- The amount of time (in frames) that the screen will fade from black, back to gameplay during the transition.
    fadeBackDuration = 32,
    -- The amount of time (in frames) that the screen will remain completely black during the transition. This can be 0.
    fadeWaitTime = 4,
}


return respawnRooms
Some screenshots of the WIP level for those who are interested...(one of them might be for further context at least)
Image
Image

Checklist:
I can get hurt within the respawnrooms: yes, good.
I can die within the respawnrooms: yes, good as well.
Respawnroom content respawn when re-entered: yes yes yes,...
NON respawn room areas and sections (which do NOT have these things) content respawn as well: NO! Why? :lol:

And despite "colorSwitchesReset = false," also these SMW colored STATES return as like nothing as ever been activated.
I've already come to terms with the fact that these semi-solid floorslopes don't work properly with NPCs and I have to be careful with them, but I absolutely need the respawn rooms for this level.
Please help me out there, otherwise the whole level is for the trashcan.

Edit: Even if I set up an extra respawnRoom with "Reset Level When Entered" to OFF, I feel like, this is not working in the first place, because everthing stil does reset there in that area.

Edit 2:
I absolutely cannot understand what is going wrong. So either everything is packed into a respawn room or somehow nothing. I just can't use the possibilities of this script properly for my purposes.

skipper
Shy Guy
Shy Guy
Posts: 5
Joined: Tue Jul 04, 2023 2:32 pm
Pronouns: he/him

Re: respawnRooms.lua (v1.1) - Quick respawn and Celeste-styled rooms, again!

Postby skipper » Sun Feb 18, 2024 6:51 pm

so the newest smbx2 patch broke something with the layers heres the debug that pops up
Image

Just_Thomas
Blooper
Blooper
Posts: 190
Joined: Sat Dec 16, 2023 3:32 am
Pronouns: he/him

Re: respawnRooms.lua (v1.1) - Quick respawn and Celeste-styled rooms, again!

Postby Just_Thomas » Mon Mar 11, 2024 5:53 am

Also it does not seem to work in combination with FakeBlocks.lua anymore. That is really more than a pity. So, if you think you can use it to make a SMW like ghost house... well not really possible or not intended for this, even if it actually looks like it (see my last post).
Image
At least I am pretty sure this was NOT before beta 5.

It is sometimes really difficult to find a working combination of different scripts, especially from different authors. So either you are talented enough to do everything yourself, or you should limit yourself to 1 or 2 things (or stick to the standard features to be on the safe side) and put them through their paces to see if everything works for your level the way you want it to before you end up throwing the whole concept in the garbage can.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 0 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari