Open Cuerzor opened 2 years ago
I found that the room keeps all of the persistent entities insided it between levels, and even runs. When I restart the whole game, the room's data get cleared.
That's pretty wild and was previously unknown. I think that's fairly useful, as there isn't another way to persist entities between runs.
That's pretty wild and was previously unknown. I think that's fairly useful, as there isn't another way to persist entities between runs.
Surely this could be useful in some ways. But I still want a function to clear the room's data manually, this issue bothers me for a time
Can you make a copy of the data before putting entities in it?
No I think, I tried every field and function, nothing helps
I would recommend that you don't use this hack for "storing" entities, as it relies on memory that isn't supposed to be initialized, and can potentially cause the game to crash.
It's fairly easy to keep track of any state related to entities and respawn them at the appropriate times - use a Map<roomGridIndex, Map<position, data>>
e.g. look at the algorithm for how IsaacScript stores implements custom trapdoors.
I would recommend that you don't use this hack for "storing" entities, as it relies on memory that isn't supposed to be initialized, and can potentially cause the game to crash. It's fairly easy to keep track of any state related to them and respawn them at the appropriate times - use a
Map<roomGridIndex, Map<position, data>>
e.g. look at the algorithm for how IsaacScript stores implements custom trapdoors.
Can't understand... I use lua
It's just a two dimensional https://en.wikipedia.org/wiki/Associative_array The programming language doesn't matter.
它只是一个二维的https://en.wikipedia.org/wiki/Associative_array 编程语言无关紧要。
Well...I'm not supposing to store entities, I just want a out-of-map room for my custom bossfight
Why can't you simply use the debug room?
Why can't you simply use the debug room?
In fact, I'm currently using it, but the debug room will not save and if you continue the game or use glowing hourglass, the game crashes. A lot of players feedbacked this
Ok. What floor is it on? You can probably just use ROOM_BLUE_WOOM_IDX instead of the debug room. Change the backdrop once you enter to whatever you want it to be.
Ok. What floor is it on? You can probably just use ROOM_BLUE_WOOM_IDX instead of the debug room. Change the backdrop once you enter to whatever you want it to be.
It's on home floor, and it's backdrop is planetarium which is not changable using Game:ShowHallucination (It will cause the backdrop glitched). Looks like there's no perfect method to resolve it. Fine, just put the problem away.
It's on home floor, and it's backdrop is planetarium which is not changable using Game:ShowHallucination (It will cause the backdrop glitched).
You can work around that with set stage. Here's a short example in TypeScript (you'll have to convert it to Lua, but hopefully it should be pretty clear):
function teleportToMyCustomBossRoom() {
const level = game.GetLevel();
level.SetStage(-1, StageType.WRATH_OF_THE_LAMB);
teleport(GridRoom.BLUE_WOMB);
runNextRoom(postNewRoomMyCustomBossRoom);
}
function postNewRoomMyCustomBossRoom() {
setBackdrop(BackdropType.MINES_SHAFT);
const level = game.GetLevel();
level.SetStage(LevelStage.HOME, StageType.ORIGINAL);
removeAllTrapdoors();
spawnCustomBoss();
}
function spawnCustomBoss() {
// TODO
}
I want to make additional rooms that out-of-map like devil room or crawlspaces, so I coded like this:
It works well, I can create an extra room that out of map, and I can keep persistent entities, like collectibles, pickups, or machines inside it after enter it again, but there's another problem.
I found that the room keeps all of the persistent entities insided it between levels, and even runs. When I restart the whole game, the room's data get cleared.
So I think is there any method to clear room's entity states?
Note: The entities only keeps if you leave the room or quit the game (not restart the game), or the room's state will not be saved.