Making a stat system and i wanna make it so it add a certain points to all stats and not randomly pick one as all other tutorials show it.
example 1-9 add 10 points to one stat and 5 to the others and increase it slightly 10 -19 and so on.
Sorry for the bad grammar!
And this is how the code looks like.
extends Node
# Character stats
export (int) var max_hp = 10
export (int) var max_mana = 10
export (int) var strength = 1
export (int) var dexterity = 1
export (int) var agility = 1
export (int) var magic = 1
export (int) var defence = 1
export (int) var speed = 1
export (int) var wisdom = 1
# Leveling system
export (int) var level = 1
var experience = 0
var experience_total = 0
var experience_required = get_required_experience(level + 1)
func get_required_experience(level):
return round(pow(level, 1.6) + level * 4)
func gain_experience(amount):
experience_total += amount
experience += amount
while experience >= experience_required:
experience -= experience_required
level_up()
func level_up():
level += 1
experience_required = get_required_experience(level + 1)
Edit: Sorry for the not so good explaining
level 2 add 10 to all var exept maxhp and maxmana
add 5 maxhp and maxmana
level 3 same as level 2 all the way to level 9
and from level 10 add 15 to all var exept maxhp and maxmana
and repete that type of pattern all the way until max level that is not decided yet
hops this explains it better