How do I code a turn-based battle systems?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
worldismyne
Newbie
Posts: 6
Joined: Tue Jul 25, 2017 8:59 pm
Projects: McCarthy Academy
Organization: Sonora Productions
Tumblr: worldismyne
Contact:

How do I code a turn-based battle systems?

#1 Post by worldismyne »

I've just started working on my demo and I need a little help coding the mechanics I'd like to have. The biggest one is finding a tutorial or reference code for a turn-based rpg battle system. It will be used as chapter events, so I don't need any dungeon maps or random encounter code. Just something so the player can use stats and beat bosses.

I am currently using Ren'py with the DSE add-on.


Thank you so much for helping me! Any direction would be helpful at this point.
Last edited by worldismyne on Thu Jul 27, 2017 2:47 am, edited 1 time in total.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: How do I code a turn-based battle systems?

#2 Post by Milkymalk »

How do I code a turn-based battle systems?
With lots of time and experience in screen language, Ren'Py script and Python.

Seriously, what you are trying to do isn't impossible, but far from being trivial. You need to understand classes, lists, loops and screens for the presentation. You probably want status effects, which adds a lot to the work to be done.

But I don't want to discourage you. Read my thread in the cookbook forum about inventory programming, because it's also about data management in general and a combat party is much like an inventory. That's a good start I'd say because it covers a lot of what you will need.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
Pomeranian
Regular
Posts: 33
Joined: Wed Oct 12, 2016 6:52 pm
Contact:

Re: How do I code a turn-based battle systems?

#3 Post by Pomeranian »

I think that what you're proposing is overly complicated. With what worldismyne needs, they could probably do it easily with Ren'Py script. The code is a bit outdated, but this should help:

viewtopic.php?f=51&t=18047&start=15#p395926

User avatar
worldismyne
Newbie
Posts: 6
Joined: Tue Jul 25, 2017 8:59 pm
Projects: McCarthy Academy
Organization: Sonora Productions
Tumblr: worldismyne
Contact:

Re: How do I code a turn-based battle systems?

#4 Post by worldismyne »

Pomeranian wrote: Wed Jul 26, 2017 9:38 pm I think that what you're proposing is overly complicated. With what worldismyne needs, they could probably do it easily with Ren'Py script. The code is a bit outdated, but this should help:

viewtopic.php?f=51&t=18047&start=15#p395926
I tried using the code you sent, and I don't know if I did something wrong, but the game won't open anymore and I don't know how to roll it back. It keeps giving me this error message:

After initialization, but before game start.
File "renpy/common/00voice.rpy", line 360, in voice_interact
if _menu:
NameError: global name '_menu' is not defined

But there's only 113 lines of code. Tried deleting the code battle code and loading my old work into a new game with my old DSE files; it gave the same error. Any ideas on how to fix it?

Post Reply

Who is online

Users browsing this forum: Exiscoming