Help with turn based combat system with stats, etc

Hello. This is my first venture into making a combat system within choicescript, and I’m not exactly sure how to go about doing this. Despite me being a nervous wreck when it comes to asking for help, I figured coming here would help a lot, so excuse my ignorance when it comes to code within choicescript and game development itself, (still learning here!)

Excuse me for the shoddy descriptions below, it’s currently 2 am and I’m really tired.

So for the story I’m writing, I wanted the combat to be more than just a stat check. I want something more fluid, with a Class/Stats system. Two problems:

1 - How in the world would I incorporate this into choicescript in a clear, optimized manner

2 - I have a VERY rough idea on how I’d like the combat to flow, but not sure if it’s too ambitious.

The outline is a typical RPG based format:

  • Something along the lines of strength, magic, dexterity, etc?
  • Status effects (Bleed, poison, etc) and damage types (physical, magical, etc)
  • HP and Mana based combat, along with other stats that must be taken into consideration (Armor affecting Physical damage dealt, dodge chance, etc)
  • Weapons may affect stats
  • A skill system with varying moves that differ with each class
  • Levelling system

I’ve been working for months on this story and I really want to post a WIP soon, but right now I’m just completely stumped. Thanks for all your help :slight_smile:


You’re going for a fairly in-depth combat system. Do you have a rough idea on what the player will see when interacting with the system?

Is it classic JRPG Attack / Magic / Item / Escape, or card-based style with a deck of moves to draw (except we have choices instead of cards), or do you have something else?

Something among the lines of JRPG Attack/Magic/Item/Escape.

Something like…

The bandit in front of you snarls with contempt, raising his rusty blade with killing intent. You unsheathe your weapon, readying yourself into a combat stance.

You feel completely fine. (100 HP) (Level 15)

The enemy in front of you shows no sign of relenting. (100 HP) (Level 12)

Use a basic attack.

Use a skill.

Use an item.


A very basic, barebones idea of what I’ve had in mind.

1 Like

I think your first order of business should be designing how the actual math works.

1 Like

Hmmm. Treat me like a complete and utter newb about this stuff. I do know that math has a pretty big part in this stuff, but could you elaborate a bit more? Thanks :slight_smile:

Well, I’m not that much familiar with turn based combat myself - never cared about that stuff - but if you are making a combat system, you need to have rules in place to how it works, yes? Even if you’re not going with numeric values, you need to know what should happen where, and if you are, you need to know how values stack and what affects what.

Can’t start coding before you know what you’re coding.

Aahhhh, right. Like damage values and whatnot, how much damage should be taken from XXXX and stuff… thank you, I’ll put it on the list of shit i need to take account of!

Are there any particular games or series that you like that you can kind of base an experimental setup with? Not necessarily what you end up sticking with, but to get an idea of what a balanced(ish) system might look like? I haven’t tried to get this kind of in depth with a game I made, but I feel like that might be a way to at least learn where to start as far as how to make the math work. Then once you see how some others do it, you can use that knowledge to try and set up something of your own, with whatever spins you want to add to make it yours, if that makes sense.

-edit: When I say that, I mean to study other systems as a way to figure out how balance works in those, and then transfer it to what you’re doing. Like, if a speedster character got into a fight with a tank, what kind of stats would they need in order to have an about even chance of winning? That sort of thing. Then you can use that info to apply it to your own system. If that made any sense at all, haha.

I’ve thought about it, but nothing exactly comes to mind in terms of reference. I’d have to surf through a lot of turn based combat systems and see which one somewhat fits what I’m looking for.

The reason you are completely stumped OP is that what you are wanting to do is very complex. Not logically difficult, but coding complex.

You effectively want:

a health point system

a damage type system

a status effect system

a mana point system

an equipped items system

a skillset system

a leveling system (XP spend based?)

Any one of them is potentially complex to integrate into your game – all of them, that’s a lot of things to code and manage. This is 100% not something someone can just tell you how to do, you need to design your own system and learn how to code it from the base up in choice-script as you do. I don’t know any other choicescript written game (except my own ^_^) which combines even a fraction of what you want to put in. It is possible though, I was a coding noob when I started writing, but it was not a simple process to learn how to do this.

It would help if you laid out, in code form what variables you expect to be using for you combat system and think about how they would integrate into your gameplay as written. Sorry to be a downer, but if you are a noob you need to learn how to do these things gradually as you work - its not something someone can just tell you how to do: if you have more specific questions and coding issues I can help, but “how do I code a very complex combat system” is too vague.

  1. Start by laying out your variables: what do you want to keep track of, in what format will it be tracked
  2. Come up with some way in which attacks will work, using *if, *choice, *set, *rand &c
  3. write a small amount of code which will enable you to run through a very simple battle.

You are welcome to have a look around in my code (its accessible through dashingdon) to see what might be involved in coding a battle, seeing some examples might help you visualize how you might want your own system to work and how you might go about coding it.

See here for some of the earliest stuff I coded:

Jump to “*comment MUTANT GUARD - ROUND 1” for a good sample.

Getting a hand on how some other code handles what you want to do will help you.


Like what @Alice-chan said the code will be very complex and I’m thinking it might require over 15 different stats working in each major combat . Though I’m good at coding ,my game combat system actually depends on three things:difficulty,combat stat and health stat and this uses dozens of lines of code and mathematics . I admire your ambitiousness and this might the best CS game to implement a full and diverse combat system :smiley:


I’ll echo in with the others that you’re going for something elusively very complex. I went down this path, too.

Since you mentioned that you’re new on combat system, maybe you should start basic with narrative-based combat. It’s not necessarily as “plain” as a simple linear narration, but it can capture the same awesomeness and strategy nevertheless. Take a look at Supra Humanum WIP or Lone Wolf Saga gamebooks. Holy Ordos is a good one to look into, too. Otherwise, libraries from Delight Games are a good reference if you’re willing to suffer through its monetization scheme.


Adrao did some pretty complex combat stuff in their Hero or Villain sequel - if the OP was looking for an example of complex combat that is less narrative-driven.


Since I was summoned from the dark depths that I was lurking in, I’ll weigh in on what I was going for in Supra.

There was going to be melee-focused with short ranged weaponry to assist and then ranged-focus with long ranged weaponry. The background stats would be strength plus minor dex (melee + ranged checks) and then dex heavy for ranged.

However, that was going to be one part of the equation. As @Szaal mentioned, the narrative was going to take care of the heavy lifting but you needed to make smart choices.

For instance in later instances (not on Dashingdon) I am tracking mistakes. I.e. if you are trying to snipe but the enemies are on top of you, you will do so at a steep penalty. If you have the stats to succeed, I will definitely write you up as an 80s era action hero. If you fail, well you might recover but too many fails will meet a bad end.

IMO, don’t let your “system” constrain your writing. You want the reader to enjoy the experience.

Good luck with your work @Haunted!


So I am working on something somewhat similar. Give *gosub a look, especially if you want to have the same math done fairly often.

1 Like

As mentioned by Alice-chan, I might be one of the few around here who had implemented such systems (in all four of my games!). The best one is probably the last, hero or Villain genesis.


-but an old school tabletop rpg system, and get the inspiration from it there in how the system will work. My superhero systems are loosely based on the old marvel superhero rpg. Tokyo Wizard has a big dnd thing. My new WIP uses as a base figuring fantasy.

-random is bad and difficult to implement in choice script. There is the rand function, but if needs to be called in the page before the variable is used (or else if somebody checks stats it’s re-rolled).

-obviously check my own games to see her I’ve done it…


This is all very helpful. Thanks everyone who replied, once I get back on my PC I’ll be brainstorming and hopefully will be able to pull this off. I’ll be sure to follow all the advice here. Here goes nothing…

Oh hey! Nice of you to chime in, I left a review for the first HoV game.

I know this weird to ask, but can you upload a small snippet of the combat systems code onto dashingdon or somewhere? Or better yet, is it okay to peek into the code for HoV:G? Thanks. :slight_smile:


Thanks for the help! I’ll try my best to code a very small and simple battle encounter and try to get this down.


Managed to get some basic stuff down in a combat encounter.

Enemy HP
Held weapons
Mana costs for skills

As for everything else… heh. That’ll have to wait, thanks everyone for your support.

1 Like