Help please! Wondering if something simple is possible?

Okay so, you know how you can make variables for relationship points like in a romance game, and have the percentage bar fill up or drain as you add or remove points to it? :slight_smile: WELL, I was wondering if it’s possible to put a cap on the relationship bar? Like, cause if you get more and more points it’ll just go up right past 100 percent won’t it? And if you remove more and more points it’ll eventually go below zero right? So is there a way to make it STOP when it hits 100, and STOP when it hits 0 too?

Fairmath is the answer:

4 Likes

Ooh, that looks like exactly what I wanted! :slight_smile: Thanks! I’ll try out this fairmath % stuff then! I’ve just been using plain old +10 or -50 stuff, for example. :slight_smile: I didn’t know you could do %+ or %- and that it’d keep it in the 0-100 range. :slight_smile: Thank you!!!

1 Like

If you want to work in whole numbers (I find fairmath difficult to montior myself for stat checks due to the changing percentages as you get closer to 0 and 100) and you can keep it pretty close to within 0-100, if you go over or under a little, you can kind of cheat with a code to set it back to 100 or 0. Basically something along the lines of :

*set strength +10
*if (strength > 100)
   *set strength 100

Depends what you need to do with it really :slight_smile:

5 Likes

Thanks! :slight_smile: I’ll try this out sometime I guess! Kinda would suck to have to put that *if clause on every single *set variable though…But that’s just me being lazy. :smiley: It’d not be more work than having to make every single *set variable to begin with! :slight_smile:

You could create a little subroutine with that code in it. You call the subroutine with *gosub name and end the subroutine with *return. Then you can call it from anywhere in your story as many times as you like. You can add parameters as well so you can vary the amount you change the strength by.

e.g.

*label add_strength amt
*params amt
*set strength (strength + amt)
*if (strength > 100)
    *set strength 100
*return

Then you just call it as many times as you like, with:

  • gosub add_strength 10


Edit: Sorry, made a little mistake in that subroutine, corrected now. Just pointing it out in case anyone copied it and found it didn’t work lol

5 Likes