How do I add a party in combat?

Let’s say I want to add a system where the player can enter battle with one or more side characters. How would I go about that? I’m still new to coding so it would be a great help if you guys could show me the code to make it happen.

Much thanks!

1 Like

Hi Matt –

These two threads might help:

and

There are a few completed games that you might want to look at as well for generative combat:

The Great Tournament , @adrao 's games, even the Daria games by Lucid should be inspirational.

My combat is curated and choreographed in its entirety, so my systems would not help you in this.

4 Likes

I think the best answer would depend on what you exactly want.

The code for a system that allows the player to choose who attacks for example would be different to the code for a system where the MC attacks and whoever they are with reacts to that.

5 Likes

I’d rather the one where the side characters just react thanks. Like you can seenon screen that they are fighting their own battles while the MC is focused on his.

*create player_power 0
*create side_character1_power 0
*create side_character2_power 0

*label start

You are preparing to enter a battle.

What is your power level? (0-5)
*input_number player_power 0 5

How many side characters will accompany you in the battle? (0-2)
*input_number num_side_characters 0 2

*if (num_side_characters >= 1)
    What is the power level of side character 1? (0-5)
    *input_number side_character1_power 0 5

*if (num_side_characters = 2)
    What is the power level of side character 2? (0-5)
    *input_number side_character2_power 0 5

*set cumulative_power (player_power + side_character1_power + side_character2_power)

Your cumulative power level, including side characters, is ${cumulative_power}.

*finish
2 Likes

create variables to represent the power levels of the player (player_power) and two potential side characters (side_character1_power and side_character2_power).The player is prompted to enter their own power level, and then asked how many side characters they want to bring into the battle (from 0 to 2). Depending on the number of side characters chosen, the game will prompt for their power levels as well.Finally, i calculate the cumulative power level by adding the player’s power level and the power levels of any side characters that were selected. The total cumulative power is displayed to the player.You can further expand this system by adding more side characters, allowing the player to name them, and incorporating their interactions during the battle sequences. Additionally, you could introduce choices in the battle that depend on the combined power levels of the player and side characters.

2 Likes

Hey thanks a lot! This is very useful. Not quite sure I fully get it but I think I have an idea now.

Well I after seeing my code i figured out that’s its a bad system or we can say have many gaps I mean the player can make himself stonge and its kind of cheating it’s no fun to make yourself the strongest you have to work for it so i figured a updated code and some ideas that you can adapt and I think it will be more helpful👇

1 Like

So this is the better system concept of party battle it’s more simple and more engaging and competitive

*create player_name ""
*create player_health 100
*create player_attack 20
*create player_defense 10

*create side_character1_name ""
*create side_character1_health 80
*create side_character1_attack 18
*create side_character1_defense 8

*create side_character2_name ""
*create side_character2_health 90
*create side_character2_attack 15
*create side_character2_defense 12

*label start

You are preparing for battle. Choose your side characters wisely:

*choice
  #Take Side Character 1
    *set side_character1_name "Side Character 1"
    *goto choose_side_character2
  #Take Side Character 2
    *set side_character2_name "Side Character 2"
    *goto choose_side_character1
  #Go alone
    *goto start_battle

*label choose_side_character1

You have chosen Side Character 1 to join you.
*goto start_battle

*label choose_side_character2

You have chosen Side Character 2 to join you.
*goto start_battle

*label start_battle

You encounter an enemy!

*choice
  #Attack
    *set enemy_health - player_attack
    *if (enemy_health <= 0)
      You defeated the enemy! Congratulations!
      *goto next_encounter
    *else
      The enemy attacks you back!
      *set player_health - enemy_attack
      *if (player_health <= 0)
        You were defeated. Game over.
        *finish
      *goto start_battle
  #Use Side Character 1 Ability
    *set enemy_health - side_character1_attack
    *goto enemy_turn
  #Use Side Character 2 Ability
    *set enemy_health - side_character2_attack
    *goto enemy_turn

*label enemy_turn

The enemy attacks!

*set player_health - enemy_attack
*if (player_health <= 0)
  You were defeated. Game over.
  *finish
*goto start_battle

*label next_encounter

Congratulations! You have won the battle and gained experience!

This code showcases a simple battle system with two side characters. Depending on your game’s complexity, you can expand on this code and add more features like special abilities, multiple enemies,more side characters, and dynamic storytelling.

Remember to customize the variables and scenes according to your game’s requirements

3 Likes

Awesome!! This one is even better, I can see the possibilities. Arigato!!! ありがとう!!!:blush:

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.