Battle System

Hi everyone,

Can I see someone else’s codes, a released or WIPs game, with a battle system that considered “successful” or “got potential” ?

is that an appropriate thing to ask?

the battle system in my mind is not a battle which options are predefined like “Attack with my Sword” even when I forget that I carry a sword with me or “Cast a Fireball” even when I don’t know if I got a talent in magic, and anything you choose only affect the sugary words on the story and doesn’t do anything to the end result.

thanks in advance

I have one that’s from a game that I didn’t release yet. I still need to work on it a bit more.
Test it out.

*set ph - m_attack
*set mh - p_attack
*set health  m_attack
*set health1  p_attack
*if health = 0
    *set health health
*if health > 0
    *set ph_percent round(10 *(ph / health))
*if health1 = 0
    *set health1 health1
*if health1 > 0
    *set mh_percent round(10 *(mh / health1))
*if ph_percent > 100
    *set ph_percent 100
    *set ph_percent - 1
*if mh_percent > 100
    *set mh_percent 100
    *set mh_percent - 1
*if p_attack >= number
    *set p_attack - number
*if p_attack < number
    *set number - p_attack
*if p_defense >= number
    *set p_defense - number
*if p_defense < number
    *set number - p_defense
*if p_agility >= number
    *set p_agility - number
*if p_agility < number
    *set number - p_agility
*if m_attack >= number1
    *set m_attack - number1
*if m_attack < number1
    *set number1 - m_attack
*if m_defense >= number1
    *set m_defense - number1
*if m_defense < number1
    *set number1 - m_defense
*if m_agility >= number1
    *set m_agility - number1
*if m_agility < number1
    *set number1 - m_agility
*choice
    #Attack.
        *goto attack
    #Run away.
        *if m_agility = 0
            *set p_attack attack
            *set p_defense defense
            *set p_agility agility
            *set ph 10
            *set mh 10
            *set health 0
            *set health1 0
            You managed to escape.
            *goto_scene start start1
        *set r_chance round(p_agility / m_agility)
        *rand number 1 100
        *if r_chance <= 10
            *if number <= 20
                *set p_attack attack
                *set p_defense defense
                *set p_agility agility
                *set ph 10
                *set mh 10
                *set health 0
                *set health1 0
                You managed to escape.
                *goto_scene start start1
            *else
                You failed to escape.
                *goto attack
        *if r_chance <= 20
            *if number <= 40
                *set p_attack attack
                *set p_defense defense
                *set p_agility agility
                *set ph 10
                *set mh 10
                *set health 0
                *set health1 0
                You managed to escape.
                *goto_scene start start1
            *else
                You failed to escape.
                *goto attack
        *if r_chance >= 21
            *if number <= 60
                *set p_attack attack
                *set p_defense defense
                *set p_agility agility
                *set ph 10
                *set mh 10
                *set health 0
                *set health1 0
                You managed to escape.
                *goto_scene start start1
            *else
                You failed to escape.
                *goto attack
        *else
            You failed to escape.
            *goto attack
*label attack
*stat_chart
    percent ph_percent Health
Your health ${ph} - ${health}
*stat_chart
    percent mh_percent Health
${d_name}'s health ${mh} - ${health1}
*if ph > 0
    *if mh > 0
        *goto combat
    *else
        
        [b]You Win.[/b]
        *set ph 10
        *set p_attack attack
        *set p_defense defense
        *set p_agility agility
        *set ph * p_level
        *set mh 10
        *set health 0
        *set health1 0
        *goto results
*else
    
    [b]You died.[/b]
    *set p_attack attack
    *set p_defense defense
    *set p_agility agility
    *set ph 10
    *set mh 10
    *set health 0
    *set health1 0
    *page_break
    *goto m_name
1 Like

If you want to view the code of someone’s game, just add /scenes to the end of the WIP link.

https://dashingdon.com/playgalavantic/gametitle/mygame/scenes.

I’d recommend I, the forgotten one. It’s a good example of a properly done fight system that takes into account player’s chosen attributes like height and fighting style. Also I don’t think the author minds code divers.

6 Likes

Huh, it Kind of reminds me a bit of Pokemon. Maybe you should consider allowing a choice of different “moves” which would have different effects on the opponent?

Again thinking of Pokemon, you’d have an opening choice of either Attack, Use an Item or Run Away. Choosing “Attack” gives you a few options for the type of attack… Choosing “Use an Item” would obviously open up an inventory of consumables… and Run Away is just… well yeah.

You could go all Rock-Paper-Scissors style of fighting. Attack 1 beats Attack 2, Attack 2 beats Attack 3, and Attack 3 beats Attack 1.

Could use RNG to decide the opponent’s attack.

Edit: Typo

I should note: using the stats menu to assign attributes doesn’t work. The attributes reset upon exiting the stats menu.

(Anything done in the stats menu isn’t permanent. The stats menu doesn’t affect the game, the game is supposed to affect the stats menu)

So you’ll want to make a scene outside the stats scene for assigning skill-points instead.

I would put it after the “Combat” choice in the “Combat, Story, or Quest” choice block. Then the Next scene after that would be the fighting.

The stats are only reset temporarily until you advance a page.

Oh I see. Kinda an annoying bug that it doesn’t update until the next scene but I guess that’s choicescript’s fault

It sounds like what you mean is, you want a system where what happens in each battle will affect your character. So like, what? If you get injured the injury is relevant to the rest of the game?

It’s all about variables and accounting for player choices.

Like you could absolutely make it possible to lose a limb in a fight and then have that loss affect the player-character for the rest of the game… but you’ll have to write it all in.

*choice
 #Dodge the axe
  *if (agility >= 15)
   You successfully dodge the axe
   *goto twoyearslater
  *else
   The axe cuts clean through your arm, amputating it comepletely
   *set arm_status “Amputated”
   *goto twoyearslater
 #Block the axe
  *if (strength >= 15)
   You raise your shield and successfully block the axe swing
   *goto twoyearslater
  *else
   The axe cuts clean through your arm, amputating it completely
   *set Arm_status “amputated”
   *gototwoyearslater

*label twoyearslater
You finish your breakfast, and think about the next battle to come.
*if (arm_status = “Amputated”)
  You look over your mechanical arm, thinking back to when you lost the original during that fight with the Axe-wielding assassin. The wound still itches, sometimes.
*else
  You look over your arm, strong and ready to win yet another battle.

In this case, you can potentially lose your arm if you fail the choice in the fight against the “Axe”. And losing that arm could have further effects throughout the rest of the story… but you have to write all of it, and you also have to write what happens if you never lost the arm at all, because that’s also possible.

Ensuring choices have lasting consequences is limited entirely to how far you’re willing to see those consequences through, as a writer.

This is why many prefer to write “false” choices where, what happens doesn’t significantly affect the plot… because it’s incredibly tedious to create entire plot tangents for every conceivable choice the player might make.

thanks man, I’ll use this to construct the system I want

Oh I didn’t know it was possible, thank you
but nobody would sue me for peeking at their WIP codes, right?

that’s even better, a completely different story path and choices because of something you did or let happened on yourself or the world.

technically, I want to imitate suikoden battle system, where I can use skills ( either learnable or pre-determined on the character ), using items I carry with me, but also the freedom of stats build like common MMORPGs, yeah it sounds hard but that’s what I love, I can’t really enjoy clicking nexts without ever thinking and then the story simply reached the end.

it feels so wrong to progressing the story without ever get the feeling that I need to understand whats going on.

Can’t sue someone just for peeking at their code. Copying code on the otherhand is a different story, but I don’t think most people on here mind if you do.

The way I see it, in text games there is a dichotomy for how to go about writing combat.

Option one is “Literal”. You make a choice for every action the player will do. Hit with sword. Block with shield, repeat until enemy is defeated or you died.

Option two is “narrative”. You make a choice for a general approach to combat: will the player be Evasive? Stealthy? Straightforward? Then you write out a long narrative description of where that approach leads the player when they take it.

Option one sort of removes you from the narrative of the world and places you into a semi-generic combat scenario. When it’s over, you return to the narrative. They’re two separate, but co-dependent entities; combat and narrative. It’s like the difference between a story-cutscene and the gameplay in Call of Duty or something similar.

In Option two, the combat is part of the narrative. They’re intertwined. You leave the actual choice vague so that you, the author can write up an interesting “story” about the result of that choice.

In my experience “literal” combat is tricky to keep interesting in a longer game. Since all the combat is pretty much “use attack” until the enemy is dead, it will feel very repetitive.

That said, “narrative” combat can be hard to write. Sure, it maintains a consistent flow between the story and the combat, but man it can really be a slog writing “interesting” results for every possible move a player might make, twice over because you also have to account for whether they pass or fail.

But ultimately, those are your options as far as formats for writing combat. At least from my perspective.

1 Like

impressive, I was so absored into making a battle system that I can use on my current project and future ones, I never realized this terms before.

from what I can learn from suikoden games, there are random encounters ( repetitive yes, and sometimes annoying ), and major battles ( narrative with scenes and dialogues, affecting story ), so I think it is possible to combine the two depending on the story progression.

It’s definitely possible to use both in one game.

It would make sense to make smaller fights that have less plot impact more “literal” and have major fights be more narrative oriented. I think that would be a good way to balance it.

1 Like