Hello! So i’ve made the below script which shows the attributes of a character. What i basically wanna do is to increase the HealthPoints by 10 for every 2 Vitality points so it would be 50 HP for 10 Vitality. Like i did it with the “for” function it is 100 HP. Of course, the other thing i want is about the GUI Button. I want to have the HealthPoints increased by 10 but again for every 2 Vitality Points so it would be for 12 points you get +10 Health and so on. Could you help me a bit? Thanks!
var STRENGTH : int;
var DEXTERITY : int;
var INTELLIGENCE : int;
var VITALITY : int;
var HEALTHPOINTS : int;
function Awake(){
STRENGTH = 12;
DEXTERITY = 9;
INTELLIGENCE = 8;
VITALITY = 10;
}
function Start(){
for(var i : int = 0; i < VITALITY; i++){
HEALTHPOINTS += 10;
}
}
function OnGUI(){
stat1 = "Strength : " + STRENGTH;
stat2 = "Dexterity : " + DEXTERITY;
stat3 = "Intelligence : " + INTELLIGENCE;
stat4 = "Vitality : " + VITALITY;
stat5 = "Health : " + HEALTHPOINTS;
GUI.Box(new Rect(20,20,100,70),stat1 + "
" + stat2 + "
" + stat3 + "
" + stat4);
GUI.Box(new Rect(140,20,100,40),stat5);
if(GUI.Button(new Rect(20,100,40,20),“+”)){
VITALITY += 1;
}
}