- Home /
Storing Different Slider Values
I'm only asking in case there's an easier way than the way I was thinking.
Idea: I have a friendship meter. Every time you interact with an in game character positively, it goes up until you obviously reach a maximum. There are multiple in game characters that each have a friendship meter, and you can only interact with in game characters a certain amount before you have to wait a day to talk to them.
Question: Each time you interact with a character, is there a function that can check for what the friendship meter was at the last time you interacted with that specific character and display it? Without having a different friendship meter for each character individually storing the value for that specific character? Would this need to utilize Json or another kind of programming, or is there a different way?
Answer by AbandonedCrypt · Mar 11, 2021 at 11:22 AM
float currentValue;
float previousValue;
void ChangeValue(float amount)
{
previousValue = currentValue;
currentValue += amount;
}
you literally just add a single variable to store the previous meter value and set it whenever you add or subtract from the current value.