Levelling and crafting system

So in my game, there is going to be some skills, ie wood-working and fishing, that start at level 1 and by the time they get to level 50 of fishing they catch fish regularly half the time with less mistakes. Each time they fish, they get 10 xp per fish. How would I be able to implement this crafting and levelling system?

It’s early, so there might be a way to do things more efficiently, but my first thought is to use gosubs to level.

*choice
    #Fish
        You caught a fish in ${time_fish} hours.
        *set time_left - time
        *set exp_fish + 5
        *gosub_scene level fish_level
     .....

In level:

*label fish_level
*if (lvl = 1)
    *if (exp > 5) 
          *set lvl + 1
          *set time_fish [the thing]
*if (lvl = 2)
....
*return
...

Written assuming you want to change the amiunt of exp needed for each level (otherwise just check if exp > 30 or something, then after leveling up subtract 30 from exp for next gosub and loop it until you stop leveling (assuming you’ll gain enough exp between incriments to level more than once ).

You could also use another gosub to calculate time every time you did an activity if you wanna trim the variable count (you’d have to divide time by 2^lvl I believe).

1 Like

You’re in for a long journey, often with an underwhelming payoff. But anyway, here’s how you should do it.


First, mark the points where your skills level up. How much exp per lvl? Incremental limit or linear? Might helps you if you graph it out.

Second, simply set up the system. For clarity, I’ll give you examples in the most logical way. Perhaps not the most effective/efficient, but should get my points across.
Now, obviosly, you’ll have

*create xp_fish 0
*create lvl_fish 0
*create xp_wood 0
*create lvl_wood 0

at the startup.txt. At any point you get xp, simply *set +X them accordingly.

But to run a check whether a skill has leveled up, you want to run them to a subroutine.

*gosub lvlup_fish

*label lvlup_fish
*temp prev_lvl lvl_fish
*if xp_fish < 10
   *set lvl_fish 1
*elseif xp_fish < 20
   *set lvl_fish 2
etc.

You gained 10 fishing exp.
*if prev_lvl < lvl_fish
   You leveled up! Your fishing is now ${lvl_fish}.
*else
   You're currently at {lvl_fish}, with {xp_fish} exp.
*return

Remember I said mark the points where the skill lvls up? You’d want to list them down in this subroutine.

You can call on this every time you want to make a lvl up check.

And then, if you want to make a limited event check that relied on the levels, simply *if lvl_fish >= [condition].

5 Likes

I’d recommend, like others, a *gosub.

If you want the player to catch fish half the time at skill level fifty, then generate a random number out of a hundred and check that against the skill level.

*rand number 1 100
*if number < fish_level

This way, they will reliably catch fish at a rate of (skill level / 100), and if their skill goes over a hundred, they will catch a fish every time.

To make it at least somewhat possible to catch or learn something at lower levels, reward failure as well.

This is the perfect opportunity for fairmath as well. This makes it more difficult to level up at higher levels, and easier to learn at lower levels.

For lower levels, I’d make it so that a player catches a fish every one out of five tries, until they increase their level over twenty.

To display the level, just round the (experience divided by some arbitrary number). I chose ten.

Full Code
*create fish_level 0
*create fish_xp 0
*create number 0

*label top

Your current Fishing level is ${fish_level}.
What would you like to do?

*choice
	#Fish
		*rand number 1 100
		*if number < fish_level
			Congratulations! You caught a Sparkling Minnow!
			*set fish_xp %+ 5
			*gosub level_up_check
			*goto top
		*elseif fish_level < 20
			*rand number 1 5
			*if number = 5
				Congratulations! You caught a Ferocious Trout, but only based on pure luck. You've gained some valuable experience though!
				*set fish_xp %+ 5
				*gosub level_up_check
				*goto top
			*else
				You've caught nothing, but don't be discouraged! The most important part when starting out is trying. You've learned something in the process, though. Better luck next time.
				*set fish_xp %+ 2
				*gosub level_up_check
				*goto top
		*else
			You've failed to catch something, but you can certainly try again!
			*goto top
	#Do nothing
		Nothing comes to those who participate in nothing.
		*goto top
	
*label level_up_check
*set fish_level round(fish_xp/10)
*return
4 Likes

campus line 52: invalid return; gosub has not yet been called

Trace back your code and see if there’s a missing *label or something.

*label campus
The campus is wide and there are a lot of activities to try out here!

*choice
  #Check out the Zen gardens
    *finish
  #Go to the gym
    *finish
  #Go fishing
    *goto fishing
  #Go back to the University
    *goto_scene university

*label fishing
Your current fishing level is ${lvl_fish}, ${name}! You are on a wooden dock facing the lake, with a fishing line in tow- [i]the fishes are certainly biting![/i]
*choice
  #Start fishing, ${name}!
    *rand number 1 100
    *if number <  lvl_fish
      Congratulations! You caught a Sparkling Minnow!
      *set xp_fish % + 5
      *gosub_scene levelup_check
      You gain ${xp_fish} xp!
      *goto fishing
          *elseif lvl_fish < 20
          *rand number 1 6
         *if number = 6
          Congratulations! You caught a Snapping Salmon, but only based on pure luck. You've gained some valuable experience though!
          *set xp_fish % + 5
          *gosub_scene levelup_check
          You gain ${xp_fish} xp!
          *goto fishing
         *else
          You've caught nothing, but don't be discouraged! The most important part when starting out is trying! You've learned something.
          *set xp_fish % + 3
          *gosub_scene levelup_check
          You gain ${xp_fish} xp!
          *goto fishing
         *else
          You've failed to catch something, but you can always try again later!
          *gosub_scene levelup_check
          You gain ${xp_fish} xp!
          *goto fishing
  #Do nothing for the day
    Nothing comes to those who participate in laziness!
    *set xp_fish % + 5
    *goto fishing

*label levelup_check
*set lvl_fish round(xp_fish/10)
*return```

Ah, you probably want to add a “terminating” choice to end the playthrough. Add *ending somewhere so the code can terminates and actually end the test.

1 Like

When you say put *ending somewhere, you mean at the very bottom of the text (below *return)?

I’m thinking of putting it on an individual choice, kinda like #Exit

Your current fishing level is ${lvl_fish}, ${name}! You are on a wooden dock facing the lake, with a fishing line in tow- [i]the fishes are certainly biting![/i]
*choice
  #Start fishing, ${name}!
    *rand number 1 100
    *if number <  lvl_fish
      Congratulations, ${name} caught a pregnant Minnow!
      *set xp_fish % + 5
      *gosub_scene levelup_check
      You gain ${xp_fish} xp!
      *goto fishing
      *ending
          *elseif lvl_fish < 20
          *rand number 1 13
         *if number = 13
          Congratulations! You caught a Snapping Salmon, but only based on pure luck. You've gained experience though!
          *set xp_fish % + 5
          *gosub_scene levelup_check
          ${name} gains ${xp_fish} xp, during the process!
          *goto fishing
          *ending
         *else
          You've caught nothing, but don't be discouraged! You've learned [i]something[/i] (somehow)!
          *set xp_fish % + 3
          *gosub_scene levelup_check
          ${name} gains ${xp_fish} xp, during the process!
          *goto fishing
          *ending
         *else
          You've failed to catch something, but you can always try again later!
          *gosub_scene levelup_check
          ${name} gains ${xp_fish} xp, during the process!
          *goto fishing
          *ending
  #Do nothing for the day
    Nothing comes to those who participate in laziness!
    *set xp_fish % + 5
    *ending

*label levelup_check
*set lvl_fish round(xp_fish/10)
*return```

campus line 56: invalid return; gosub has not yet been called

No, no. Put it on an individual choice.

*choice
   #Exit/Leave the game
      *ending
Your current fishing level is ${lvl_fish}, ${name}! You are on a wooden dock facing the lake, with a fishing line in tow- [i]the fishes are certainly biting![/i]
*choice
  #Start fishing, ${name}!
    *rand number 1 100
    *if number <  lvl_fish
      Congratulations, ${name} caught a pregnant Minnow!
      *set xp_fish % + 5
      *gosub levelup_check
      You gain ${xp_fish} xp!
      *goto fishing
          *elseif lvl_fish < 20
          *rand number 1 13
         *if number = 13
          Congratulations! You caught a Snapping Salmon, but only based on pure luck. You've gained experience though!
          *set xp_fish % + 5
          *gosub levelup_check
          ${name} gains ${xp_fish} xp, during the process!
          *goto fishing
         *else
          You've caught nothing, but don't be discouraged You've learned [i]something[/i] (somehow)!
          *set xp_fish % + 3
          *gosub levelup_check
          ${name} gains ${xp_fish} xp, during the process!
          *goto fishing
         *else
          You've failed to catch something, but you can always try again later!
          *gosub levelup_check
          ${name} gains ${xp_fish} xp, during the process!
          *goto fishing
  #Do nothing for the day
    Nothing comes to those who participate in laziness!
    *set xp_fish % + 0
    *ending
  #Other things happen (leave fishing
    Everything else
    *choice
      #Exit fishing
        You exit fishing
        *ending
  #Go back to the campus
    *goto_scene campus

*label levelup_check
*set lvl_fish round(xp_fish/10)
*return```

campus line 60: invalid return; gosub has not yet been called

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the @moderators.