Jump to content

Photo

What is the ZScript code for 100% please?


  • Please log in to reply
2 replies to this topic

#1 LikeLike888

LikeLike888

    Spicy food lover!!

  • Members
  • Real Name:Jason
  • Location:North America

Posted 05 June 2018 - 05:18 PM

I am curious on how to code 100% in ZScript
such as
Link->HP = 100%;
for example.

#2 Saffith

Saffith

    IPv7 user

  • ZC Developers

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 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

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