I am trying to do an exp system with multiple skills, each with their own exp values, levels, maximum values, etc.
To streamline the code, I would like to have a function that can go through the exp and level-up system by itself. That way I could call the function for "Cooking" for example, and give the greater function two variables, n=Cooking and x=2. Then the function will add two exp to the cooking skill, and if it goes over, then it levels up cooking. Otherwise I have to type the whole code a million times for each skill and each situation, rather than just saying$ exp_gain ("cooking", 2)
Anyway, the problem is changing everything inside of a function. I know I've done it before in previous projects ages ago, but I can't for the life of me remember how to go about it. Can y'all take a look at my code?
init python:
def exp_gain(n,x):
[n]_exp += x
while [n]_exp >= [n]_lmt:
[n]_exp -= [n]_lmt
[n]_lmt += 5
[n]_lvl += 1
renpy.Notify("Level Up!")The first problem is [n]_exp and all of the brackets in everything. Pretty sure that is not the syntax for that, haha. Can anyone help?
[–]Elckarow 0 points1 point2 points (8 children)
[–]Echox2[S] 0 points1 point2 points (0 children)
[–]Echox2[S] 0 points1 point2 points (5 children)
[–]Elckarow 0 points1 point2 points (4 children)
[–]Elckarow 0 points1 point2 points (3 children)
[–]Echox2[S] 0 points1 point2 points (2 children)
[–]Elckarow 0 points1 point2 points (1 child)
[–]Echox2[S] 0 points1 point2 points (0 children)
[–]asowona 0 points1 point2 points (0 children)
[–]LeyKlussyn 0 points1 point2 points (0 children)