i am using a Dice Roller to generate character stats i am trying to make modifiers based off the rolls. The formula i want to use is sum of dice - 10 / 2 . Here is the script that i am using to roll the dice. I have been trying to make a 2nd script to call the some of the dice and input the formula but it has no0t been working.
ā¦
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class RollStats : MonoBehaviour {
public Text strength;
public Text dexterity;
public Text consititution;
public Text intelligence;
public Text wisdom;
public Text charisma;
public static int DiceRoller()
{
// TODO: remove the hard-coded "4"
int[] results = Dice.Roll(Dice.DieType.D6, 4, Dice.SortOrder.Descending);
int sumOfDiceRolls = 0;
// TODO: remove the hard-coded "3"
for (int i = 0; i < 3; i++)
{
sumOfDiceRolls += results[i];
Modifiers = (results[i] - 10) / 2;
}
return sumOfDiceRolls;
}
public static int ModifiersModifiers;
public void RollStrength()
{
strength.text = DiceRoller().ToString();
}
public void RollDexterity()
{
dexterity.text = DiceRoller().ToString();
}
public void RollConsititution()
{
consititution.text = DiceRoller().ToString();
}
public void RollIntelligence()
{
intelligence.text = DiceRoller().ToString();
}
public void RollWisdom()
{
wisdom.text = DiceRoller().ToString();
}
public void RollCharisma()
{
charisma.text = DiceRoller().ToString();
}
}
ā¦