Page 1 of 1
Dungeon levels
Posted: Tue Feb 11, 2014 1:25 am
by KrazyEd
Hey guys, I've been playing LoG for a while and gone through several custom dungeon's and am now building my first but I have some questions I hope might get answered.
1. Is there a way to copy a level in the editor? My Idea has the party going through an arena that gets harder as the levels progress and while each level will change it won't be by very much.
2. I'm trying to make the entrance to the stairs be secret and only open after the last monster is killed in the final room of the level. I was hoping to have a series of spawners in the room that triggered on a hidden pressure plate. Would the best way to do this be to create a custom monster for the spawners that had an 'onDie = increment counter' attribute and then write a function to track the counter and once all the monsters are dead it triggers the secret door? I'm open to suggestions here as the help guides and topics I've seen all have a) only one monster or b) a key drop solution for puzzles like this one.
Any suggestions will be appreciated! Thanks!
Re: Dungeon levels
Posted: Tue Feb 11, 2014 1:45 am
by Isaac
Copy the level in-editor? It's not impossible to box select everything and copy/paste it to another level... but the editor will rename for duplicate objects... which means every one of them, as you've copied the entire level. You would then have to re-draw the hallways; and of course, adjust all connections, because the copied level objects would still be connected to the other level.
It might be possible to script a function to clone the level on load, and do the renaming automatically.
As for the stairs... Yes, you could make a cloned monster with its own onDie hook that opens the secret door. You could write an If block that checks the counter, and spawns the clone when the counter is high or low enough.
______________________
You might try regular expressions and/or a bit of mass replace via a text editor.
Open dungeon.lua in the scripts folder, and select all of the level you'd like to copy, and paste into a new file, then use its 'find & replace' feature to alter the ids... When the engine spawns an object and auto names it, it adds an underscore and a number to the object name... You could search for "wall_button_" and replace with even "wall_button__", and it should work. Do that for each group of objects used and it should rename them ~AND~ rename them in the connectors. Then paste the edited file as the next level in dungeon.lua
Re: Dungeon levels
Posted: Tue Feb 11, 2014 1:50 am
by KrazyEd
It's not impossible to box select everything and copy/paste it to another level... but the editor will rename for duplicate objects... which means every one of them, as you've copied the entire level.
That's what I was afraid of.

Oh well. Just more stuff to do
Yes, you could make a cloned monster with its own onDie hook that opens the secret door. You could write an If block that checks the counter, and spawns the clone when the counter is high or low enough.
Thanks for confirming that too!
Re: Dungeon levels
Posted: Tue Feb 11, 2014 12:07 pm
by lexdr
Isaac wrote:As for the stairs... Yes, you could make a cloned monster with its own onDie hook that opens the secret door. You could write an If block that checks the counter, and spawns the clone when the counter is high or low enough.
Or without cloning monsters, you can simply start a timer and a script that check every 5 seconds if monster entities still exist in the room.
Don't forget to deactivate the timer when the door opens.
Re: Dungeon levels
Posted: Tue Feb 11, 2014 3:21 pm
by Isaac
Alternatively: one does not have to clone the monster... just add the onDie hook to the original, with a condition that checks the counter and adds to it, (or subtracts from it); and does what you want when the counter has the right value.
lexdr wrote:Isaac wrote:As for the stairs... Yes, you could make a cloned monster with its own onDie hook that opens the secret door. You could write an If block that checks the counter, and spawns the clone when the counter is high or low enough.
Or without cloning monsters, you can simply start a timer and a script that check every 5 seconds if monster entities still exist in the room.
Don't forget to deactivate the timer when the door opens.
This has a potential gotcha....
If the script employs the entitiesAt() function, it will not work right if the player places a map marker in the room. (The function is bugged, and doesn't handle them well.)
Re: Dungeon levels
Posted: Tue Feb 11, 2014 3:38 pm
by lexdr
If there is no monsters' spwaning but a fixed number with identified monsters, the easiest way is to use incremental ids for corresponding monsters ("finalmonster_X" where X is a digit) and add a loop script that return true if all corresponding entities are nil.
Actually, this method can also be used with monsters' spwaning if you use the same ids as above and a global var with the max id.
