If I understand correctly, you want to check each of the enemies in enemy party's separate speed with the player's? Something like:
Code: Select all
init python:
class Player(renpy.store.object):
def __init__(self, SPEED=0):
self.SPEED = SPEED #This should be equal to SPEED, not self.SPEED
#A method for checking the higher speed
def getHighestSpeed(character, enemy_list):
highest = "Player" #This system assumes the player is faster
#If an enemy inside enemy_list has higher speed, change highest's value to "Enemy"
for enemy in enemy_list:
if enemy.SPEED > character.SPEED:
highest = "Enemy"
else:
continue
return highest
default player1 = Player(SPEED=80)
default enemy1 = Player(SPEED=50)
default enemy2 = Player(SPEED=51)
default enemy3 = Player(SPEED=52)
label battle_test:
$ e_list = [enemy1, enemy2, enemy3]
$ who = getHighestSpeed(player1, e_list)
"[who] is faster!"
What this getHigherSpeed function do, when it's called, it uses a 'for' loop to iterate throughout the contents of enemy list. If it finds that an enemy's speed is higher than the players, it sets the variable highest to "Enemy". If not, it leaves it as it is, with the value "Player". It then returns this value, so you can store it in a variable or use it in a function.
This was written on the fly so there should be more elegant ways of doing this, but I have to leave now, so do some testing and see if it can be adapted to what you want.
The silent voice within one's heart whispers the most profound wisdom.