Jump to content

Recommended Posts

Posted

I wasn't able to find in forum and in help too.

If I have a value let's say for a game, and let's call it $healt, then, how I set that variable minimum to for example 0 and maximum for example 100?

Then during the game it will be modified but it must never go under 0 or over 100.

I just control the $healt value modifying events with If or so (Like if $healt >=0 or <=100 then decrease it) or there is a way to make it value exceeding proof?

For example i may want to put fights and i have 20 healt left, but my enemy hits me for 30. I want it to stop at 0 because I told before that the value of $healt must not go under 0 or over 100.

Any clue?

Also, If you suggest/know different method of doing the same thing, post here.

Thanks community.

Posted

At key points throughout script or whenever necessary to check, you can do:

If $healt < 0 Then $healt = 0

or

If $healt > 100 Then $healt = 100

Something like that?

Posted

Yes that would work perfectly. Just wondering if there was a native function to state the thing when declaring a variable. Just asking to who knows more than me. Thanks, thats a good solution.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...