I am curious on how to code 100% in ZScript
such as
Link->HP = 100%;
for example.
What is the ZScript code for 100% please?
Started by
LikeLike888
, Jun 05 2018 05:18 PM
2 replies to this topic
#1
Posted 05 June 2018 - 05:18 PM
#2
Posted 05 June 2018 - 07:18 PM
It would be
Link->HP = Link->MaxHP;Variables don't have any concept of "full" or "half" or anything like that. If a variable should have a maximum value, that's generally given by another variable or a constant.
- ShadowTiger and Yuuki like this
#3
Posted 06 June 2018 - 12:40 AM
...or an expression of the percentage. Using Link->HP as an example:
void SetLinkPercentileHP(int percentage) { Link->HP = (Link->Max->HP/100) * percentage; }
Obviously, fixed percentages can be a decimal expression with basic multiplication. The above example variable/scaling value.
- ShadowTiger likes this
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users