Inputting and resetting stats

I’m having trouble with allowing the player to boost some stats at the start of the game

The error I’m getting is twofold- it is possible to input More AP than you have. For example, you have 6 ap points to play with, you can add 4 to luck and have 2 left BUT still add 4 to skill

and the option to reset doesn’t reset, I have used *set command to return the values to the original state but this doesn’t work

*label init 
*temp ap 6
*temp skill_limit 4 
*temp stamina_limit 6 
*temp luck_limit 4 
*label choose_stats 
You have ${ap} AP left to spend to increase your stats. Which stat do you want to increase
*choice 
	#Skill
		How many AP will you spend to increase skill? (1 - ${skill_limit}) 
		*input_number stat1 1 skill_limit 
		*set skill +stat1 
		*goto adjust_ap
	#Stamina
		How many AP will you spend to increase stamina? (1 - ${stamina_limit}) 
		*input_number stat1 1 stamina_limit 
		*set stamina +stat1
		*goto adjust_ap 
	#luck
		How many AP will you spend to increase luck? (1 - ${luck_limit})
		*input_number stat1 1 luck_limit 
		*set luck +stat1
		*goto adjust_ap 
	#I'm finished spending AP 
		*goto done
	#Reset stats and AP
		*set skill 8
		*set stamina 17
		*set luck 8
		*goto init 
*label adjust_ap 
*set ap -stat1 
*if ap < 1 
	*goto done
*if skill_limit > ap
	*set skill_limit ap
*if stamina_limit > ap 
	*set stamina_limit ap
*if luck_limit > ap
	*set luck_limit ap 
*goto choose_stats 
*label done 
*goto_scene club


Don’t know tbh. I couldn’t see anything glaringly wrong so I copied it into CS and ran it, worked fine for me. I was unable to allocate more points than the limit. Might be worth putting some lines of code in there to print the values as you’re allocating them, just so you can see what’s happening at each choice.

Just in case: Where are you running this? Is it in startup.txt or did you put it into choicescript_stats? If it’s in choicescript_stats, all variables reset when you exit back to the game.

2 Likes

Didn’t you already create a topic for this problem? Wasn’t it fixed then?

Edit: I tried to look through your game files, and there are a lot of files with choosing stats sequences similar to this. Are you sure the file you are using for the game currently has the version you show here?

Yes and it seemed it was fixed but now through playtesting I have found not unfortunately.

Does the game use this file for stats choosing? The code is different there, doesn’t have correct AP adjusting.
https://dashingdon.com/play/jonnysaxc/journey-into-darkness/mygame/scenes/skillsgosub.txt

1 Like

I’m stumped, but there have been times where I have been completely baffled by an error only to realize that I spelled something differently in startup or whatever. Maybe try triple and quadruple checking the spacing and spelling on all your variables?

2 Likes

Thank you indeed, I have changed the file to choosestats. (code below)

I am afraid you can still add eg 4 to luck (leaving 2 ap) and then 4 to skill

Reset doesn’t reset

*label init 
*temp ap 6
*temp skill_limit 4 
*temp stamina_limit 6 
*temp luck_limit 4 
*label choose_stats 
You have ${ap} AP left to spend to increase your stats. Which stat do you want to increase
*choice 
	#Skill
		How many AP will you spend to increase skill? (1 - ${skill_limit}) 
		*input_number stat1 1 skill_limit 
		*set skill +stat1 
		*goto adjust_ap
	#Stamina
		How many AP will you spend to increase stamina? (1 - ${stamina_limit}) 
		*input_number stat1 1 stamina_limit 
		*set stamina +stat1
		*goto adjust_ap 
	#luck
		How many AP will you spend to increase luck? (1 - ${luck_limit})
		*input_number stat1 1 luck_limit 
		*set luck +stat1
		*goto adjust_ap 
	#I'm finished spending AP 
		*goto done
	#Reset stats and AP
		*set skill 8
		*set stamina 17
		*set luck 8
		*goto init 
*label adjust_ap 
*set ap -stat1 
*if ap < 1 
	*goto done
*if skill_limit > ap
	*set skill_limit ap
*if stamina_limit > ap 
	*set stamina_limit ap
*if luck_limit > ap
	*set luck_limit ap 
*goto choose_stats 
*label done 
*goto_scene club

Isn’t this your scene list in startup.txt?

*scene_list
	startup
	intro
	skillsgosub
	club
	lecture

And this is in intro scene:

*choice
	#Let's go!
		*goto_scene skillsgosub

Edit: you can change text for Next/Next chapter button instead of making a choice with a single option. Like this:

*page_break Let's go!
*goto_scene choosestats

Or this:
*finish Let's go!

If you use *finish command, it will load a file which is next in the scene_list.

2 Likes

I think you have probably found the answer, I haven’t been linking to the right code - apologies if this is the case
I am fixing this but now needing to find out why notepad++ is not saving as a text file (sigh!)

Ok-, I am sorry I was linking to the old stats file, that is terrible I’m sorry

Inputting now works perfectly! Yay- reset doesn’t work, I may remove that option as it seems very problematic for what it is

Thank you for all your help (again!) and I will think about reset this week

Reset is very easy, I just used *set for the original values

Cheers all, onwards and upwards!

3 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.