My fan game is doing great, to the point that I have also started working on my own original game. The art is flowing in, I'm doing better with code, but there's one thing that still eludes me and that is an Initiative system for my battles.
In both the fan game I'm working on and the original project I feature turn-based battles. So far, the acting order has been pre-ordained by me. Renpy goes through a list and depending if the switch is on or off, it goes to that character's turn or the next in the list, until you reach the last and it resets everything.
This, though, has obvious limitations -including the fact that sometimes certain characters will act twice in a row, like the switch doesn't properly set for some reason-. So, I'd like to migrate to a stat Based initiative system, where the higher of a certain STAT a character has the further up the list he/she goes. How would you do it?
Also, this is how I've been setting up battle order so far:
Code: Select all
if moveEvelyn == True and moveJack == True and movePenny == True and moveDavid == True and moveBH1 == True and moveBH2 == True and moveBH3 == True and moveBH4 == True:
$ moveJack = False
$ movePenny = False
$ moveDavid = False
$ moveEvelyn = False
$ moveBH1 = False
$ moveBH2 = False
$ moveBH3 = False
$ moveBH4 = False
if enDefence == True:
$ endefence -= 35
$ enDefence = False
if enBoost == True:
$ enattack -= 30
$ enBoost = False
if moveEvelyn == False:
jump TurnEvelynBH1
elif moveJack == False:
jump TurnJackBH1
elif moveBH1 == False:
jump TurnBH1
elif movePenny == False:
jump TurnPennyBH1
elif moveBH2 == False:
jump TurnBH2
elif moveDavid == False:
jump TurnDavidBH1
elif moveBH3 == False:
jump TurnBH3
elif moveBH4 == False:
jump TurnBH4