- Dec 24, 2019
- 25
- 94
Hi everyone
Right now I have a project that has a point system based on the choices the player makes.
The player has two options and one of them awards a point that is stored in a variable (I think). The game has the rollback feature enabled and my intention is not to remove it. The problem is that if the player uses the rollback and selects again the option that gives the point it is still added to the variable, which is not practical for the game.
I know that if I use the variables of the style "$ variable_x += 1" when the rollback is used that point is "eliminated", but the problem is that as it is a same system for several characters and with different variables I have a code that facilitates me to make the obtaining of points. The code is the following:
And inside the game code I have something like this:
The code works fine but the problem arises if the player makes rollback and chooses that option again because it continues adding points, which throughout the game is something that would cause a problem and I would like to know if there is a way to avoid this because I do not want to use the "$ variable_x += 1" style variables because of the lack of practicality that can generate me on the way.
Greetings.
Right now I have a project that has a point system based on the choices the player makes.
The player has two options and one of them awards a point that is stored in a variable (I think). The game has the rollback feature enabled and my intention is not to remove it. The problem is that if the player uses the rollback and selects again the option that gives the point it is still added to the variable, which is not practical for the game.
I know that if I use the variables of the style "$ variable_x += 1" when the rollback is used that point is "eliminated", but the problem is that as it is a same system for several characters and with different variables I have a code that facilitates me to make the obtaining of points. The code is the following:
Code:
init python:
class Actor():
def __init__(self, character, name, affection, slotA, slotB):
self.c = character
self.name = name
self.affect = affection
self.slotA = slotA
self.slotB = slotB
def affection_up(self, amount):
self.affect += amount
renpy.notify(f"{self.name} affection +{amount}")
if self.affect < 0: ### (this is to define the point limit, not related to the actual problem)
self.affect = 0
elif self.affect > 15:
self.affect = 15
Code:
menu:
"Option A":
$ renpy.fix_rollback()
"Ok. No problem"
"Option B": ### (The right one)
$ renpy.fix_rollback()
$ NAME.affection_up(1) ### This line is the one that gives the point
NAME.c "Oh... ha ha... I missed you too!"
Greetings.