Help with turn based combat system with stats, etc

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

You could also change it from a string to a variable and it makes the code cleaner.

So instead of having to write

*if (weapon = “sword”)

You can just write

*if (sword)

2 Likes

HUZZAH! After a while of dicking around and seeing what stuck, I finally was able to get weapon equip stat values down. It’s just a matter of figuring out all the other stuff now. Thanks again.

1 Like

I think there is a way to peak into the code, there should be a post somewhere in the forum about it. So let me know if you have problems, but from what I read you seem to be getting the gist. Do remember: no system you implement in choicescript will be perfect, and you’ll have to compromise with some elements

1 Like

yo @Haunted, are you sure you wanna go that far?

you should have at least the stats system, for the MC, all allied and hostile NPCs, within the game world.

next you need the equipment system to customize your MC and each items should have its own effect, thus you need “database” for those items.

in case you wish to have a party turn-based combat like Suikoden series, then you need equipment system for all possible recruitable characters as well.

the third part is the skill system, unless you want boring combat that only focus on stats amassing, and there will be different calculation and used stats for each skill.

lastly the inventory system, the staple of any RPG-oriented games.

as much as I’m into gameplay and features rather than story, I will give respect to what you’re going to do and hope it will come to fruition.

I had enough with choices where I have to choose my own eye color and question my sexuality in some books talking about war and death, being a bastard child, gods and magic, fantasy world, pirates, martial arts, etc.

I do understand that this forum promotes lovey-dovey cheesy romantic stuffs, but it kills the atmosphere and tension of what the book is telling, by constantly drooling and twisting your nippies.

2 Likes

Skill system, working on it. Levelling system… that’ll be tricky, because I’m not sure how I’m gonna work out how EXP is given to the player. I thought about random encounters, but I don’t want this game to become grindy.

2 Likes

Why not just have a levelling up system without exp. For example let’s say they start at level 1 and then at the end of every chapter they level up by 1.

2 Likes

Hmm… I guess as the story progresses, the PC gets stronger too huh? I’ll take that into consideration.

1 Like

It makes sense and its a lot simpler to code.

1 Like

The problem is, I’m planning on adding in classes + subclasses, meaning I’m not entirely sure how to make a narrative focused level progression system synergize with that. Lots to think about…

1 Like

How many chapters are you planning on?

Chapter 1 = Level 1 (Choose start class)
Chapter 2 = Level 2
Chapter 3 = Level 3
Chapter 4 = Level 4
Chapter 5 = Level 5 (unlock subclass)
Chapter 6 = Level 6
Chapter 7 = Level 7
Chapter 8 = Level 8
Chapter 9 = Level 9
Chapter 10 = Level 10

Thats how I would do it.

i think you need to decide if you want your combat encounters to be narrative or not. If they are not going to be narrative then you can write a (very) big chunk of re-usable code which would work for every combat encounter. The answer to this will really change how you approach your game.

1 Like

A big chunk of the early game revolves around the PC taking out bandits. Maybe I could script some random encounters? Or maybe a choice to actively start a fight?

As of right now though, I’m still learning how to implement a damage over time system, like bleeding/poison

Not entirely sure… but I’ll keep this in mind.

At the beginning of each turn you could do a:

*if poison true
   The bandit looks a little greener. 
   *set banditheath %- 5

Something like that

1 Like