I am working on a character generation script. Depending on the body type chosen, either petite, average or large, you get a stat bonus for dexterity or intelligence or strength. It all looks right, but I’m getting a BodyModifier(int, int, int, int): not all code paths return a value error.
BodyModifier( _bodytype, _dexterity, _strength, _intelligence); //Call is here
int BodyModifier( int _bodytype, int _dexterity, int _intelligence, int _strength)
{
_bodymodifier = 1;
Debug.Log("Bodytype" + _bodytype);
Debug.Log("Dex=" + _dexterity);
if(_bodytype == 1)
{
Debug.Log("Previous Dex: " + _dexterity);
_dexterity = _dexterity + _bodymodifier;
Debug.Log("Dex is increased" + _bodytype + _dexterity);
return _dexterity;
}
if(_bodytype == 2)
{
Debug.Log("Previous Int:" + _intelligence);
_intelligence = _intelligence + _bodymodifier;
Debug.Log(_bodytype + "Intelligence is increased" + _intelligence);
return _intelligence;
}
if(_bodytype == 3)
{
Debug.Log("Previous Str" + _strength);
_strength = _strength + _bodymodifier;
Debug.Log(_bodytype + "Strength is increased" + _strength);
return _strength;
}
}
I did use the code sample button, please forgive me if it’s not quite right.
Can anyone tell me where the problem is?
Thanks!