I’m trying to come up with a system where the player can do a “choice” and that choice has a randomized outcome which is either positive or negative. For the system to be complete I need to randomize the outcome whilst having a player attribute like “intelligence” affect the positive outcomes probability. After this i will return a simple bool value to indicate which outcome was randomized.
Example of my code:
attributeX = 10;
attributeY= -10;
attributeZ= 100;
private bool CalculateProbabilities(Choice choice)
{
float pos = choice.basePositiveProbability + attributeX;//attributeX just as an example could be attributeY or attributeZ too
float neg = choice.baseNegativeProbability;
//Randomize an outcome based on the probabilites.
}
Does anyone have any knowledge on how a calculation like this could/should be coded?