How to increment an attribute by 1 everytime another attribute increments by 2
knight55
Member Posts: 5
I have an attribute that increases by 1 as a result from an action in my game and I want another attribute to increase by 1 everytime the first attribute increases twice(that is multiples of 2).
Comments
the pseudocode would be:
if (mod(firstAttribute, 2) == 0) then incrementSecondAttribute,
if that makes sense
I'm not quite sure how to input this in a rule
Another fun way to do this would be:
When round(firstAttribute/2)*2 == firstAttribute then increment secondAttribute
This basically checks to see if firstAttribute is even before it modifies secondAttribute.
This doesn't seem to be working for me. It keeps on incrementing the second attribute by 2.
Could it be because I used the "Index" data type for my attributes
Am I meant to type "==" in the expression editor
It looks like this:
Here is an example:
Thanks for your help
You are welcome!