make sure you created~added~set'ted your 'Nutrition' and 'Max_Value' Attributes on your 'player' Player Object are indeed both set to an 'int' Attribute Type:
'player' Player Object -> 'Attributes' Tab -> Attributes -> (at the bottom, is the box containing your Attributes, find your two Attributes, 'Nutrition' and 'Max_Value', and click on them, then make sure that the little drop down box below, for both, is Attribute Type of: [integer~int], and while here, you might as well make sure that your 'Max_Value' is indeed set to: 100, as well)
--------
also, this is wrong:
if (player.Nutrition > player.Max_Value) {
player.Nutrition = player.Nutrition = player.Max_Value
}
this is correct:
if (player.Nutrition > player.Max_Value) {
player.Nutrition = player.Max_Value
}
in this wrong code:
// let's say: player.Nutrition = 25
// and: player.Max_Value = 100
player.Nutrition = player.Nutrition = player.Max_Value
(not used yet =) player.Nutrition = player.Max_Value
(not used yet =) player.Nutrition (25) <==== player.Max_Value (100)
(not used yet =) player.Nutrition (100)
player.Nutrition = player.Nutrition
player.Nutrition <==== player.Nutrition (100)
player.Nutrition = 100
see how it's redundent? So, you only need:
player.Nutrition = player.Max_Value
player.Nutrition <==== player.Max_Value (100)
player.Nutrition = 100
------------
remember, in Programming, you're ASSIGNING (=) the Value_or_Expression on the right side of the ASSIGNMENT OPERATOR (=) to~into being STORED by the VARIABLE on the left side of the ASSIGNMENT OPERATOR (=). Think Algebra and Algebraic Substitution:
x = 10
we're ASSSIGNING '10' to~into being STORED by the VARIABLE 'x', like this:
x <==== 10
and then we can use the VARIABLE:
msg ("The number is: " + x)
// outputs: The number is: 10