Here are some notes we took while working on our nightmare dungeon scene for our indie game and visual novel "Sam in New York" that you may find useful if you're interested in learning more about how to use the Dungeon Crawl RPG Framework by Nyaatrap on the Ren'py forums (public domain script).
We will be focusing on parts of the script that you need to understand in order to customize your dungeon level.
1)_ To Transfer the player from a visual novel scene to the dungeon, this is the script we used:
call battle(sam,demon) is put in there so you can randomly encounter the "demon" enemy (as "sam," the player). If you only want a dungeon but don't want to include enemy encounters, you can just leave "call battle(sam,demon)" out.
call dungeon is when the player actually gets sent to the dungeon. Everything that comes before it is just setting up what the dungeon looks like and what kind of attacks and skills the player will have when s/he arrives in the dungeon.
For the skills listed above, "hit" refers to the probability that the attack will hit. In this case, Taunt is given a 60% probability that it will hit. "Power" refers to how much damage it causes. In this case, Taunt causes 20 damage if it hits.
2) Dungeon Stage Creation - Walls, Paths and Exits
As for what 'a' is in the dungeon stage creation composed of 1's and 0's (as seen above), a is defined in "dungeon.rpy" script as the following:
wakeupday2 is the visual novel scene that happens after the dungeon level in our script. So if you want your player to find a way out of the dungeon and go back to the visual novel format (or go to another dungeon level), use this script to indicate where in the dungeon leads to the next level/out of the dungeon.
As for how to create your own textures for the walls and paths, use the default orange PNGs that come with the script. Open them in an image editing software such as MediBang, Photoshop, GIMP, etc. and use Perspective Transform to make your textures fit on top of the existing orange images.
This is what our walls look like as separate images:
From first to last, left to right, the images are:
floor.png, front1.png, front2.png, left0.png, left2.png, left1.png
This is the code in dungeon.rpy used to assign the above images as walls in the dungeon (no need to change this code other than replacing file names) :
3) Enemy Encounters - How Do They Work?
Looking at the script battle.rpy, let's start by looking at how we formatted the boxes where the HP stats are.
This is our code we used:
We defined "char.max_hp" above in the screens.rpy script as follows, referring to the following images:
To decide what happens if the player wins, loses or escapes successfully, look at this part of battle.rpy in particular:
Generally, after winning, losing or escaping, you would hide the character sprite of the enemy (hide humbaba) as well as hide the battle screen UI showing HP (hide screen battle_ui). Use dissolve to make the transition smoother and add stop sound to stop playing battle music. For "win" and "escape," since your player will still be in the dungeon, add a command to play the dungeon music again, since you're no longer in battle (play sound oppressive loop).
The part at the bottom tells Ren'py what "win" and "lose" means when it applies to hit points. If the enemy's HP is less than 1, then it's a win. If your HP is less than 1, then the enemy has won.
To add sound effects after each successful attack (for both player and enemy), we used renpy.play ("sound/punch.mp3") in the following part of battle.rpy: