Help with turn based combat system with stats, etc

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: https://dashingdon.com/play/alicechan/holy-ordos-v04/mygame/scenes/shattered_hope.txt

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.

8 Likes

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:

2 Likes

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.

6 Likes

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.

3 Likes

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!

3 Likes

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.

Advice:

-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…

4 Likes

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:

2 Likes

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

2 Likes

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

PC HP
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

Here are the stats I figured you will need

Enemy’s Hit points
Enemy’s weapon
Your HP
Your weapon
Your mana
Enemy’s state of health
mana regeneration
Enemy’s magic ability
Your magical ability
I guess you’ll still have to figure out a few more and the advantages of each weapon and magical ability over another and put a little bit of greyed out choices and/or hidden choices . You’ll also decide if the enemy’s damage will be random depending on his level or fixed depending on his stats and for the enemy’s state you could just make a label that will change the enemy’s state after every move depending on the enemy’s live by using the gosub and finally at the end of a fight change it back to the healthiest state . (Or you could just use a temporary stat but that will require putting the fights at different scenes or making lots of temps)

Hope this helps :smiley:

As far as your weapon goes, you need to think: what does this actually do and how.

*set weapon "sword"

will mean that you can check *if weapon = “sword” and do things based on that, but its cumbersome and writing heavy for encounters since it gives you nothing about how it functions and you would have to write that each time.

I put all my inventory weapons into a single scene file so I could call them via subroutine. This way you can set all your stats simply when you change weapon.

e.g. imagine a choice:
you select #change to laspistol
that would lead to:

*gosub_scene subroutines_weapons weapon_laspistol

which would hit *label weapon_laspistol from the list below which would then set all your variables for your various damages and the like.

Example in game

*choice
    #Select laspistol
        *gosub_scene subroutines_weapons weapon_laspistol
        *goto next_scene
    #Select autopistol
        *gosub_scene subroutines_weapons weapon_autopistol
        *goto next_scene

*label nextscene
You equip the ${gun}.

Relevant subroutine scene file

*comment ============FIREARMS==============

*comment LAS PISTOL
*label weapon_laspistol
*set Gun "las pistol" 
*set Gtype "Las"
*set Gdam "1d10"
*set Gdam_rolltimes 1
*set Gdam_dievalue 10
*set Gdam_bonus 2
*set Gpen 0
*set Gfire_type "las beam"
*return

*comment AUTOPISTOL
*label weapon_autopistol
*set Gun "autopistol" 
*set Gtype "SP"
*set Gdam "1d10"
*set Gdam_rolltimes 1
*set Gdam_dievalue 10
*set Gdam_bonus 2
*set Gpen 0
*set Gfire_type "slug"
*return

*comment LASGUN
*label weapon_lasgun
*set gun "lasgun"
*set gtype "las"
*set gdam "1d10"
*set Gdam_rolltimes 1
*set Gdam_dievalue 10
*set gdam_bonus 3
*set gpen 0
*set Gfire_type "lasbeam"
*return
5 Likes

Very helpful! this is exactly what I needed. One question though, how can you have this change depending on the weapon the PC is currently wielding?

Example: Say you equip a longsword: The rand value would be around 1 - 10.

Now, if the player would equip a shortsword, the damage would drop to 1 - 8.

2 Likes

Yeah, thats perfectly possible.

*rand dam_roll 1 {Gdam_dievalue}

will role between 1 and whatever value you have for the variable “Gdam_dievalue”. If Gdam_dievalue is 8 it will roll 1-8, if Gdam_dievalue is 10 it will roll 1-10

So if you set a shortsword you need your code to set your max damage value to 8 (in my case “Gdam_dievalue”), while if you set a longsword you need it to set your max damage value to 10.

3 Likes

You can do more complex things if you want, like e.g. manipulate your code into “faking” a 2d4, but imo go with flat 1d10, 1d8, 1d5 etc if you are just starting.

1 Like

Ah, thank you so much. I had no idea you could use a variable tag in a *rand command… thanks a bunch.

1 Like