I have a "Sword" status and a "Strength" status. The sword status valus should be equal to the strength status value. So I set up a formula to calculate that and used it in the sword status.
The problem is that now I am changing the strength value with a script but the sword value does not change. So how do I force the sword value to be updated?
This will trigger combined status values to be recalculated.
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Theoretically you could do it with status development, but combined values are the way to go :)
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
So if a status value is calculated via "Combined Values" you can't change it's value from outside the formula. You have to add a node to it containing the value you want to add, right?
For example: I changed the code from above to also increase the value of "Sword" when you press another button. The only way to make that work was adding a game variable node to the formula and then use this code:
The last line is only there to force the immediate recalculation.
Another question: What is the relationship between BaseValue and Value of a status? Because I managed to write code that increases the BaseValue without changing the Value of Sword using this code:
The base value is the actual value of a status value without bonuses (for normal type status values). Changing a normal status value permanently should be done by adding to the base value (which is also happening if you change a normal status value with abilities/items).
For combined values, it's a bit different. Their actual value will be the result of the formula, but you can still also use their base value in the formula to add it to the combined value.
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
How do you change the status value in your script?
Since this are (most likely) Normal type status values, you should use the following code to change a status value:
combatant.Status[int index].SetBaseValue(int value);
This will trigger combined status values to be recalculated.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
The "SetBaseValue" works.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
For example: I changed the code from above to also increase the value of "Sword" when you press another button. The only way to make that work was adding a game variable node to the formula and then use this code:
help1 += 1;
ORK.Game.Variables.Set("HelpVariable", help1);
c1.Status[8].SetBaseValue(0);
The last line is only there to force the immediate recalculation.
Another question: What is the relationship between BaseValue and Value of a status? Because I managed to write code that increases the BaseValue without changing the Value of Sword using this code:
help1 += 1;
c1.Status[8].SetBaseValue(help1+help);
Resulting in:
Strength GetBaseValue: 7 GetValue: 7 Sword GetBaseValue: 12 GetValue: 7 help: 7 help1: 5
While this code changes both values of the Strength status:
help = c1.Status[0].GetValue()+1;
c1.Status[0].SetBaseValue(help);
For combined values, it's a bit different. Their actual value will be the result of the formula, but you can still also use their base value in the formula to add it to the combined value.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Then it sounds like I should use getvalue,addvalue instead of getbasevalue,addbasevalue.
However, unlike addbasevalue, addvalue has various parameters.
To bring my exp type value
ORK.Game.ActiveGroup.Leader.Status[12].GetValue ().ToString ();
Instead of
ORK.Game.ActiveGroup.Leader.Status[12].AddBaseValue (-1);
I used Following:
ORK.Game.ActiveGroup.Leader.Status[12].AddValue (-1,false,false,false,false,false,false);
However, an error occurs that the last argument, StatusValueChangeSource, does not exist.
What are the proper parameters to put in addvalue??
Is it right to put all bool value to false?
What should I put in StatusValueChangeSource?