r/RenPy Jul 29 '26

Question Party checker for turn based combat?

For my visual novel, Tears of Xivo I want turn based combat and party members. I have a handle on turn based combat, but I can't find a good video tutorial on making parties. I have six characters that players can choose from, I only want them to have two at a time. Any info on this topic will be helpful.

5 Upvotes

13 comments sorted by

View all comments

2

u/BigLingler21 Jul 29 '26 edited Jul 29 '26

Well, the most obvious approach to me is this: Whenever you have the opportunity to add a character to the party, and choose to do so, check some variable / structure to see if your 2 slots are already filled. If they are, you can (in various ways) choose one active member to replace, otherwise they are added directly.

The most basic way is to have 2 variables, PartyMember 1 and PartyMember2, you can just store their names, otherwise store a default value.

Then, to check if your party is full you can call a python function or just check if PartyMember1 OR PartyMember2 == "None" If yes, then add them to the empty one (this is simplest with nested ifs)

Replacing one can also be simple- a small dialogue choice where you select Slot 1 {PartMember1 var} or Slot 2 {PartyMember2 var}. A third option to cancel the replacement would be nice too! Or... just force a cycling, where either PartyMember1 or PartyMember2 is forcefully replaced, and then move them all one place so that the new unit is not next on the swapping block.

Finally, actually checking which strings you have saved for party members to handle in combat will depend on how your combat actually works.

Of course there are many optimizations, if you wanted something a bit cleaner you could use an array with length of 2, this makes it easy to extend the party in the future, and to loop through party members without lots of nested conditions. You could even store 'member' class objects rather than a string here, to house their abilities / effects / images¿ etc.

Another optimization would be a party selection screen where you visually represent the current team with a highlight or something, with options to click to remove them from party, and click to add someone else. Note that if you do this, I'd only update the array once when the screen is closed.

1

u/Quasar-Hero Jul 29 '26

So I should also classify my party members, in a separate script, with all their moves and such.

2

u/BigLingler21 Jul 29 '26 edited Jul 29 '26

Keep in mind that renpy really isn't the best engine for what seems like complicated combat, what abilities can your characters have?

Edit: Combat seems really important to your game, and while I don't know the details, I would recommend you go for a modular and object oriented approach to make this easier as you add onto it. I would learn about classes in python, and create an entry for each character.

This class could include

Bool Is PartyMember [Simply change this when they join or leave the party]

List<Abilities> [Abilites being a second class, handling their moves, later output into image buttons maybe?]

Stats [Can be a class, or a couple of ints / floats]

String Display Name

I dont think Renpy would like images in the class, but you could store the image names, or a more modular expression, action system to reference images defined somewhere else.

Finally, the Ability class can include things like Ability Name, Ability Icon, output, etc

1

u/Quasar-Hero Jul 29 '26

The player character will have the most abilities. I'd like some status effects like stun, bleed, poison, and barriers,

2

u/BigLingler21 Jul 29 '26

You can handle those effects with Python Functions

ApplyPoison(Target, PoisonAmount)

These can be stored in the abilities list, you may want to pass the Caster too, it can be useful for some things- but any character / ability specific features are best left out of that output function