using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class statroll : MonoBehaviour {
public void RandomizeStats() {
for(int x = 0; x < 20; x++)
{
int str = 5, agi = 5, inte = 5;
int statroll = Random.Range(1,3);
switch (statroll)
{
case 3:
str++;
break;
case 2:
agi++;
break;
case 1:
inte++;
break;
default:
Debug.LogError("Something went wrong, probbably with my Random.Range bounds!");
x--;
break;
}
Debug.Log("str=" + str + " :agi=" + agi + " :inte=" + inte);
}
}
}
I know this is like the fifth thread I opened on this one annoying script, but I’m struggling with this.
Thanks to the help of some posters in these forums, I’ve been able to assemble this code that somewhat works. The problem is that it’s not working the way I want it to. The code does change the numbers when I press a button but it only changes int and agi and doesnt change str at all, and I want the stats that were randomly generated to equal to 35 and so far it only only changes to either 5 or 6. I’ve already tried adjusting the values myself, but when I messed with the Random.range, it just crashed my program.