Determining highest/lowest stat of an OPPOSED pair? // no longer need help :)

i figured it out, thank u all! :)

hi! name’s jade, and i’m not really new to choicescript coding, but i am new to getting pretty serious into it with a real project. i’ve tried searching around for a solution for this, i think i found one but it didn’t work when i tried it? but also to be fair, i didn’t understand it at all so i might’ve used it wrong lol. anyway:

i already know how to determine the highest stat of a single PERCENT stat, but i want to use opposed pairs, i.e friendly vs hostile. i know for example that only “friendly” would exist in coding, and “hostile” doesn’t, so i can still easily determine if “friendly” is the highest stat, but what if i want to determine if “hostile” is the highest (technically the lowest)? i’m really hoping there’s a code to determine this, because i would like to use opposed pairs rather than singular percent stats. i don’t need to determine both the highest and lowest, (though that would be neat) i want to determine the greater of both if that makes sense?? i’m also very dumb so if there is a solution please explain it to me like i’m five lmao.

thank you very much if anyone can help me! i’m also sorry if this makes NO sense, just ask me to clarify! :slight_smile:

ps. i apologize if there’s a solution to this there’s clearly visible somewhere, i really haven’t seen it besides the one i mentioned!

3 Likes

You can figure out the value of hostile by doing 100-friendly. If you want to know whether friendly is greater than hostile, it is if friendly is > 50. If you want to know if hostile is greater than friendly, it is if friendly is < 50

thanks! but i guess i should have clarified i plan on having multiple opposed pair traits, i only put one as an example. so while that works, i want to be able to determine the greatest/lowest of all the traits at once? and i can’t wrap my head around doing that fhfhfhs

In startup *create friendly 50 that will automatically make the bar percent

friendly 50% and hostile 50%

in stats add it like this

*stat_chart
 opposed_pair friendly
  hostile

Whenever you want friendly to go up…just *set friendly %+10 if you want hostile to go up just *set friendly %-10

hey, thank you! but i know all that already. i know how to make the stats go higher or lower, my issue is determining the highest/lowest trait of multiple stats! :slight_smile:

Ok so you need to create a specific variable for them…let me show you

So question…do you mean that you have friendly and hostile for different npc like this or???

1 Like

i’m not sure what you mean about that, but by your screenshot let’s use your variables: karel’s “highest” trait is acquaintance overall, but since acquaintance doesn’t exist the code reads it as “friends” is the lowest trait overall, and i can’t find a code that determines the lowest trait, only code to find the highest one? :frowning:

If you have different trait for the mc as opposed pairs, just create them like this… each oppossed pairs bars need a specific variable attached to it in order for you to make it go lower or higher like this…

*stat_chart
  opposed_pair karfriend
    Friends
    Acquaintance
  opposed_pair karfear
    Courageous
    Fearful

Check out this post, I think that the code might work for what you are looking for, I haven’t tested it myself though.

Ok I got you now…create a variable that is called friendly1 and set it as 50…if you want friendly to be 50% and hostile to be 50% or create friendly1 10 if you want friendly to be 10% and hostile to be 90%

*stat_chart
  opposed_pair friendly1
    Friendly
    Hostile

thanks! unfortunately, reading through it, i have NO idea what any of that means so i have no idea how to apply it and make it work;; but, reading to the end, it sounds like it’s determining the highest stat? i already have much simpler code for that, i need to determine the lowest stat basically…? even if you haven’t tried that code, if you understand it better than i do and i’m wrong about it please let me know!

1 Like

Can you paste the code for us to see what you are trying to achieve?

sure, this code works completely fine and great, but it’s determining the HIGHEST stat and this is for separate singular percent stats. i want to be able to do this for OPPOSED stats, but in opposed only one variable actually exists (i.e friendly) but what if hostile is the highest stat of them all? i’m so sorry i’m really bad at explaining this;;

*if friendly > {highest_stat}
*set highest_stat “Friendly”
*if hostile > {highest_stat}
*set highest_stat “Hostile”
*if trustworthy > {highest_stat}
*set highest_stat “Trustworthy”
*if deceitful > {highest_stat}
*set highest_stat “Deceitful”
{highest_stat} is your highest stat, at {{highest_stat}}

i can flip the > to < to determine the lowest probably, right? but then how can i determine which is the greater of BOTH? i don’t need both highest and lowest, i need the greater of the two? if this isn’t possible at all, then i just need to know so i can stop smacking my brain around ^^;;

1 Like

I think all you need is a *if statement… for what you are trying to achieve…

So first, you need to know what is the percentage base you want to work with…like it it is 50/50

you will go…

*if (friendly>50)
*set this highest trait… this will mean friendly is highest trait
*if (friendly<50)
*set this highest trait…this will mean that hostile is the highest trait

*if friendly > {highest_stat}
*set highest_stat “Friendly”
*if friendly< {highest_stat}
*set highest_stat “Hostile”
*if trustworthy > {highest_stat}
*set highest_stat “Trustworthy”
*if trustworthy < {highest_stat}
*set highest_stat “Deceitful”
{highest_stat} is your highest stat, at {{highest_stat}}

try to see if it works

1 Like

it doesn’t :confused: half the time it either says the variable doesn’t exist, (like if i’m picking hostile options), and when it does work it displays the incorrect stat, like if my highest stat is friendly at 61%, it tells me that trustworhy is my highest even if it’s at 50%?

1 Like

thank you to everyone who posted :slight_smile: it took me awhile but everything here made me realize what i was missing in my code, so i’ve solved it for now! :]

1 Like

Great!, you could still post the solution so if anyone else has the same problem we can refer them to this post

1 Like

i don’t know why i never realized i could do this especially since it’s actually so simple, (i guess i was hoping to do something in the least amount of code possible) but i realized rather than determining the greatest of both high/low of a single opposed pair i would just duplicate all the opposed pairs and switch them around, only one would be visible to the player in the stats screen and the second would be hidden and used to determine if the “lowest” trait is actually the “highest” :slight_smile:

here's my code for reference

testing min/max codes

opposed pairs, only “friendly” and “trustworthy” actually exist, “hostile” and “deceitful” don’t, lets see if i can still get it to detect the highest/lowest stat overall

*fake_choice
#friendly choice
*set friendly %+ 10
*set hostile %- 10
*set highest_stat “Friendly”
#hostile choice
*set friendly %- 10
*set hostile %+ 10
*set highest_stat “Hostile”
#trustworthy choice
*set trustworthy %+ 10
*set deceitful %- 10
*set highest_stat “Trustworthy”
#deceitful choice
*set trustworthy %- 10
*set deceitful %+ 10
*set highest_stat “Deceitful”
#wise choice
*set wise %+ 10
*set naive %- 10
*set highest_stat “Wise”
#naive choice
*set wise %- 10
*set naive %+ 10
*set highest_stat “Naive”

*fake_choice
#friendly choice
*set friendly %+ 25
*set hostile %- 25
#hostile choice
*set friendly %- 25
*set hostile %+ 25
#trustworthy choice
*set trustworthy %+ 25
*set deceitful %- 25
#deceitful choice
*set trustworthy %- 25
*set deceitful %+ 25
#wise choice
*set wise %+ 25
*set naive %- 25
#naive choice
*set wise %- 25
*set naive %+ 25

*if friendly > {highest_stat}
*set highest_stat “Friendly”
*if hostile > {highest_stat}
*set highest_stat “Hostile”
*if trustworthy > {highest_stat}
*set highest_stat “Trustworthy”
*if deceitful > {highest_stat}
*set highest_stat “Deceitful”
*if wise > {highest_stat}
*set highest_stat “Wise”
*if naive > {highest_stat}
*set highest_stat “Naive”
{highest_stat} is your highest stat, at {{highest_stat}}

yea
*ending

like i said this is actually so simple, i’m forever going to beat myself up for trying to think about it in such a complicated way :cold_sweat:

there might be another way to do this but this works for me :slight_smile: