(HELP) Character Stat Modifiers

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();
}

}

ā€¦

I havent replied to the original topic yet because my laptop is now dead and my reply to the last post be lengthy.

Not sure if you are taking the Unity RPG coirse or not this section relates to the modifiers and attributes for the course material.

Iā€™m sorry to hear that. I am taking the combat course now.

1 Like

Ok, you will find that it doesnt just slot in with what we have started, proba ly better to follow the course for a bit and get your bearings, happy to return to what we started as and when.

I am about a 1/3rd in the course now.

Great, well done :slight_smile:

Privacy & Terms