ID:158406
 
ok i've got this code and what i want to do with it is make it so that if one of the variables in the list (IQ,ME,MA,Speed ect.) is lower than 7 then the player can choose one of the attributes other than ones lower than 7 to add a 1d4+3 boost to. if two or more of the variables in the list are lower than 7 then the player can choose one of the other attributes other then ones lower then 7 to add 1d4+5 and another bonus of +3 to any other attribute

in short
1 variable under 7 = 1d4+3 bonus to any other variable
2 or more variables under 7 = 1d4+5 AND +3 to any other variables but they cant be on the same ones or ones under 7

sorry if that was hard to understand
this is the code I have so far

        RollAttr()
src << "Rolling..."
sleep(10)
CreateStat("IQ")
CreateStat("ME")
CreateStat("MA")
CreateStat("PS")
CreateStat("PP")
CreateStat("PE")
CreateStat("PB")
CreateStat("Speed")
src.HitPoints=src.PE
src.MaxHitPoints=src.PE
if(7>IQ||7>ME||7>MA||7>PS||7>PP||7>PE||7>PB||7>Speed)
var/somevar=input("Choose an attribute to add a bonus to.")in list("IQ","ME","MA","PS","PP","PE","PB","Speed")
vars[somevar] += roll("1d4+3")

please help id really appreciate it
thats a verb by the way
it wont stay a verb though i just made it a verb to test it out
For every stat under 7, add it to a list
Pick from the new list of stats under 7 to add a 1d4 roll bonus to, then every other stat in that list gains a +3 bonus.

I'm assuming that's what you mean. Correct me if I'm wrong.
In response to Spunky_Girl
could you show an example

also what I meant is that if one variable is under 7 then one other stat gets a 1d4+3 bonus which means i roll a 4 sided die and add three to that

and if two or more variables are under 7 then two other stats get bonuses 1d4+5 and on a different stat just a normal +3

so lets say i rolled my stats and my IQ is 6 i get a 1d4+3 bonus and I add it to my PS to make up for my stupidness since i cant add the bonus to IQ

then i roll a different characters stats and my ME and MA are 3 and 5 respectively. since there are two variables under 7 i get two bonuses. I give my IQ a 1d4+5 bonus and since i cant give my ME, MA, or IQ another bonus because i already used a bonus on IQ bonuses then i use it on my PB changing it from 10 to 13 because it was a +3 bonus
In response to Acyd
So...

One stat is below 7, one stat that is above 7 gets a 1d4 roll bonus? If two stats are below 7, two stats above 7 get the 1d4 roll bonus?
In response to Spunky_Girl
no its ok that you dont get it i didnt use much punctuation lol.
Bob starts a new game and his 8 attributes are rolled
I.Q.:12
M.E.:15
M.A.:19
P.S.:22
P.P.:11
P.E.:6
P.B.:16
Speed:13
Bob's P.E. Attribute is lower then 7 so he gets a 1d4+3 bonus he can add to any of his stats other than P.E. because that was the attribute that gave him the bonus. He chooses to add it to P.S. The 1d4 dice rolls with a result of 2. So 2+3 = 5 and 5 is added to Bobs P.S. for a total of 27.
Joe starts a new game and he also rolls his attributes
I.Q.:11
M.E.:4
M.A.:15
P.S.:11
P.P.:9
P.E.:13
P.B.:14
Speed:6
Joe has two attributes lower than 7 so he gets a 1d4+5 bonus as well as a +3 bonus to add to any of h is stats other then Speed or M.E. for reasons stated previously.
Joe rolls his 1d4 for a result of 4. Lucky Joe! 4 is added to the +5 for a total of nine and Joe chooses to add it to P.P. for a total P.P. of 18. Joe still has one bonus left of +3. Joe can't add the bonus to P.P. because he already gave P.P. a bonus and he cant add it to M.E. or Speed because of the reasons stated previously so he adds it to his P.E. for a total P.E of 16.

Hoped those examples helped i really appreciate you helping me
In response to Acyd
Alright, I think I understand how you want it to work. What I would do is make a list to act as a buffer to be used for storing the variables.
var/list/buffer = list("IQ","MA","ME") //etc

Then subtract from that list if the player's variable is less than 7.
for(var/x in buffer)
if(player.vars[x] < 7)
buffer -= x

After that, I'd use the final list for the player to choose which variable he'd want to give the bonus to.
var/bonus = input(player,"","") as null|anything in buffer
if(bonus)
player.vars[bonus] += bonus_effect(buffer)

Now, bonus_effect() could be determined a number of ways, but the first that comes to mind is by counting up the number of variables in the list buffer, then comparing that with the len value to determine which bonus roll you want to do.
//i counted 8 variables from your last post so...
proc/bonus_effect(list/L)
. = 8-L.len
if(. >= 2) return roll("1d4+5")
else return roll("1d4+3")


This is just my mentality. It's most likely not the best way.