Hi there,
First of all, i sincerly apologize for my writing, english is not my native langage.
Now let’s talk about the techy thing !
I’am trying to think about a efficient way to write a perticular code. I have 2 point which need to be corrected/optimised.
And if there is experienced coder here, feel free to share if you have an idea.
Let me explain and let’s keep this simple :
I have 2 variables for exemple :
var 1 : recklessness
var 2 : cautiousness
This two variables are related (if one increase the other decrease, and reciprocally).
All the time and a lot of time, during the aventure, there is going to be this kind of line :
*set recklessness + 5
*set cautiousness - 5
1 ) First thing i am trying to solve :
Each of this two variables can’t be superior than 100. To verifie it, i have a general subroutine who is played relay regulary during the adventure. Including, Inside this subroutine, we have :
*if (recklessness > 100)
*set recklessness = 100
But to total of this two variable have to be equal to 100.
(cause this is how i display it in the choicescript trait bar)
So you CAN have :
[ recklessness 75 % / cautiousness 25 % ]
or
[ recklessness 12 % / cautiousness 88 % ]
etc
but you CAN’T have :
[ recklessness 12 % / cautiousness 33 % ]
or
[ recklessness 38 % / cautiousness 98 % ]
Because the total is not equal to 100 and it doesnt make any sens.
This bad thing happens i my story because when, in my subroutine, i do this :
*if (recklessness > 100)
*set recklessness = 100
I don’t take into account my other variable (here cautiousness) and i know i should make so kind of differencies (with the rest and adding to the cautiousness substraction) but i have no idea how to do it easily.
- Seconde point
I also have other character caracteristics (like strenght or stealth for exemple). And iam trying to make the psycological caracteristics (recklessness, cautiousness) have an impact to it.
I explain :
Stealth and strenght will only increase when you obtain a new level (when you spent you skill point). Anything else will modifif their value, exept that :
When your recklessness become superior than your cautiousness, you obtain a bonus to your strenght and when your cautiousness become superior than your recklessness, you obtain a bonus to your stealth skill.
So like you saw in point 1, if you understood how it works, you can ONLY have one bonus at the time.
So if you have a strength bonus for exemple, and your recklessness drop below the bar of 50%, then you loose if and you obtain a bonus to your stealth.
The matter i’ve met in the code is this :
*if (recklessness> cautiousness)
*set strength + 5
*set stealth - 5
BUT this is completly wrong. Cause I want to apply the bonus only once => Only each time one of the variables (recklessness/cautioness) are becoming higher the the other. Because otherwise, each checking will increase strenght and lower stealth as long as recklessness will be superior cautiousness…
So there is it. I am currently wondering how i could make that work in my general subroutine.
Subroutine which, i remember you, is played really often.
Thanks a lot if anyone have any tips , advice, or , lets be crazy : any solution !