Dungeon Crawl RPG Framework

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
User avatar
ComputerArt.Club
Veteran
Posts: 409
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

Re: Dungeon Crawl RPG Framework

#91 Post by ComputerArt.Club » Thu Jul 13, 2017 8:44 am

Thank you for this amazing piece of code! I have found it extremely useful! Extremely gracious of you. :)

I encountered a few issues when I tried to implement the script, some of which I solved, others I am still trying to resolve.

My current issue is that after a battle, no matter what the outcome, the story continues - i.e. it is not resetting the game in the event of the character's death. There are no errors being raised. Furthermore, the "Gameover" text is not being rendered either. I want some game over text and then to return to the main menu.

I think that this is the relevant section of code. I have tried changing a few things, also tried adding some narration, but I guess it can't be added there. I also changed the code for hiding the say window as it wasn't working either and I have removed the escape outcome as I am doing something a little different with escape.

Does anyone any ideas or did you have similar issues?
Also, the battles are being called from the "script" file, not the dungeon file. I have not needed a dungeon yet, instead I have battles at key parts of the story.

Code: Select all

    
    # Result
    if _return is "lose":
        #next line hidden as it didn't work  
        #narrator ("You died!")
        #next line is not rendering but has been left in as it may have an important role in the function.
        "Gameover"
        $ renpy.full_restart()
        return
    elif _return is "win":
        "You won"
    elif _return is "escape":
        #next line hidden as it didn't work.
        #narrator ("You escaped!")
        "You escaped"
    hide screen battle_ui
    window show
    #next line hidden as it was not working. Replaced with the above line.
    #show screen screens.say
    $ _rollback=True
    return
    
label _battle(player, enemy):
    # A sub label used in the battle label.
    
    while True: 
        $ player.skill = renpy.call_screen("command_screen")
        $ enemy.skill = renpy.random.choice(enemy.skills)
        #next line hidden as I am using escape differently but I may want to use it or alter it later.
        #if player.skill.type=="escape": 
            #return "escape"
        $ player.attack(player.skill, enemy)
        if enemy.hp < 1:  
            return "win"
        $ enemy.attack(enemy.skill, player)
        if player.hp < 1:
            return "lose"
Thanks again for this!

User avatar
ComputerArt.Club
Veteran
Posts: 409
Joined: Mon May 22, 2017 8:12 am
Completed: Famous Fables, BoPoMoFo: Learn Chinese, Santa's workshop, Cat's Bath, Computer Art Club
Location: Taiwan
Contact:

Re: Dungeon Crawl RPG Framework

#92 Post by ComputerArt.Club » Tue Jul 18, 2017 2:59 am

Natalie helped me and solved the problem.

Code: Select all

if _return is "lose":
should be

Code: Select all

if _return == "lose"
Hope this helps someone else too!

Thanks again!
Last edited by ComputerArt.Club on Sun Jul 30, 2017 10:41 am, edited 1 time in total.

User avatar
CalixtheGreat
Regular
Posts: 71
Joined: Thu Jun 08, 2017 12:00 am
Projects: Zephyr Breeze Investigations
itch: calixthegreat
Location: Philippines
Contact:

Re: Dungeon Crawl RPG Framework

#93 Post by CalixtheGreat » Tue Jul 18, 2017 4:19 am

Going to try this. Maybe I can add this to my game soon. :D
Image
FB PAGE:
CALIX THE GREAT

User avatar
Luxliev
Veteran
Posts: 242
Joined: Sat Feb 07, 2015 11:01 am
Soundcloud: Luxliev
Contact:

Re: Dungeon Crawl RPG Framework

#94 Post by Luxliev » Sun Jul 30, 2017 4:18 am

I've mentioned no clip issue before. If anyone wants to fix it change line:

Code: Select all

if front1.stage.map[front1.y][front1.x] is not "1":
to:

Code: Select all

if front1.stage.map[front1.y][front1.x] != "1":
it is in dungeon.py file
Newest classical cover: Advance Wars - Sami Theme: https://www.youtube.com/watch?v=657Jt7hJRVc

Forum with my music: http://luxliev.proboards.com/

RustyXXL
Newbie
Posts: 1
Joined: Thu Jan 04, 2018 2:14 pm
Contact:

Re: Dungeon Crawl RPG Framework

#95 Post by RustyXXL » Fri Jan 05, 2018 7:20 am

Image

Started making my first game using this framework.
Those are temporary assets, prerendered in daz...quality is far from production quality. ;)
I also modified the code to calculate 5 steps. As a result Ihad to go 1 further to the left & right to allow more than 1 wide corridors.
I'll also probably add suport for multiple wall variations, so they don't look quite as boring. I'd also like to split up the floor and ceiling for at least the closest 1 or 2 steps into blocks, so I can do some more stuff with them, and also probably add support for some decorations like pillars etc....

In any case, thanks for your ground work. Sped things up considerably :)

Hseo
Regular
Posts: 28
Joined: Thu Sep 24, 2009 10:42 am
Completed: High School Life:HSL
Deviantart: greeeed
Contact:

Re: Dungeon Crawl RPG Framework

#96 Post by Hseo » Sun May 27, 2018 11:57 am

Nvm, already been mention

User avatar
hyperionthunder
Regular
Posts: 51
Joined: Fri May 18, 2018 2:10 pm
Projects: The Wanderers
Deviantart: hyperionthunder
Contact:

Re: Dungeon Crawl RPG Framework

#97 Post by hyperionthunder » Sat Jun 09, 2018 5:42 pm

What is the best way to impliment a visible exit, say a gate in place of a wall texture?
My test grid looks like this:

Code: Select all

# "4" means exit to continue, "3" means key, "2" means entrance, "1" means wall, "0" means path.
forestgarden=Stage([
            "1111111111",
            "1111114001",
            "1300011101",
            "1111011001",
            "1000010001",
            "1110111101",
            "1000000001",
            "1010111111",
            "1010000001",
            "1211111111"
            ],
            key="gardenkey",
            enemy=maze_encounter_list)
i have images stored as gateleft2, etc.
i tried to get it to draw different image using this but no dice:

Code: Select all

for i in ["left2", "right2", "front2", "left1", "right1", "front1", "left0", "right0", "gateleft2", "gateright2", "gatefront2", "gateleft1", "gateright1", "gatefront1", "gateleft0", "gateright0", "key"]:
                try:
                    j=globals()[i]
                    if j.stage.map[j.y][j.x]=="1":
                        renpy.show(i)
                    if j.stage.map[j.y][j.x]=="2":
                        renpy.show(i)
                    if j.stage.map[j.y][j.x]=="3":
                        renpy.show(i)
                    if j.stage.map[j.y][j.x]=="4":
                        renpy.show(i)
                except:
                    pass
also i find that whenever the player faces left (west) the event triggers instead of what's directly in front of them when the step on the tile, such as a key
How can I fix that?

User avatar
hyperionthunder
Regular
Posts: 51
Joined: Fri May 18, 2018 2:10 pm
Projects: The Wanderers
Deviantart: hyperionthunder
Contact:

[solved] Re: Dungeon Crawl RPG Framework

#98 Post by hyperionthunder » Mon Jun 11, 2018 3:47 pm

I solved the issue about displaying different texture based on the different values on the grid.

however I ran into a separate problem in the way the map reports the location of the player. It seem to be reporting the location of the cell directly to the right of the player, not on top of the player's cell. So all the events i wanted to trigger, the player has to face left from that cell to trigger it. is there a workaround to get this to work correctly (as in, the player facing the intended direction to trigger such events?)

edit: turns out the solution is easy:

i found the solution from another forum: viewtopic.php?t=44910

turns out using

Code: Select all

 if here.stage.map[here.y][here.x] == event
works like a charm

User avatar
hyperionthunder
Regular
Posts: 51
Joined: Fri May 18, 2018 2:10 pm
Projects: The Wanderers
Deviantart: hyperionthunder
Contact:

Re: Dungeon Crawl RPG Framework

#99 Post by hyperionthunder » Thu Sep 06, 2018 10:10 am

I am considering having multiple dungeons and i wish to reuse part of the code.

How do i go about having looks and images for each dungeon?

User avatar
orangejuice
Newbie
Posts: 1
Joined: Sat Aug 18, 2018 10:00 pm
Contact:

Re: Dungeon Crawl RPG Framework

#100 Post by orangejuice » Sun Sep 22, 2019 4:55 am

Hello, nyaatrap, thank you so much for the framework code, this is a very insightful thread!! ^^

I do have a question regarding the battle system, is there any way I could add a leveling system as well as adding party members to your battle system (like for instance, you could have one party member at the start of the game but add more later)? I've been using this code viewtopic.php?f=51&t=18047&start=15#p395926 for turn based battles but it is without a leveling and party system and just overall limited, but the overall UI, after some adjustments, is ideal for me. though I'm not sure how to best implement/replace the battle system in the codes you provided without doing a lot of trial and error and frankenstein-ing codes.

I am no expert coder by no means, in fact, I'm completely new to this!! So I figured I should ask what would be best to have both this UI and this dungeon code work as one, as well as having that leveling and party system ... Thank you again and sorry if this was already kinda answered in this thread, it's so easy to get lost in code ahhh!!

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]