You can't have options within options like you've got unless that is just a copy and paste error.Regarding ai_chance, would I be correct in the commented out code if I were to do this?:
Code:option = { name = amareturn.13a ai_chance = { factor = 95 modifier = { factor = 73 # If mother's stubborn, there's 73% chance she agrees, and 27% refuses. trait = stubborn } modifier = { factor = 8 # If mother's cynical or kind, there's 92% she agrees, and 8% chance refuses. OR = { trait = cynical trait = kind } } } } option = { name = amareturn.13b ai_chance = { factor = 5 modifier = { factor = 27 # If mother's stubborn, there's just a 73% chance she agrees, and 27% refuses. trait = stubborn } modifier = { factor = 92 # If mother's cynical or kind, there's a 92% chance she declines and 8% refuses. OR = { trait = cynical trait = kind } } } }
Do the numbers work out to the percentage math that I laid out, or is that not how ai_chance works?
Other than that your script is right but your calculations are wrong. The way it works is all the factors from the ai aoptions have any applicable modifiers for that option applied to them, then the chance of one specific option happening is the modified weight of that option divided by the total modified weights of all options. So in your case if the character is stubborn then the chance they pick option A is (95*73)/((95*73)+(5*27) = 0.98 so it is 98%.