Achievement tracking & variables

Hello all,

I'm developing an "achievement" system in my Pulp game, but I've hit a road block: the variables that track each achievement are triggering, but they don't seem to work on my "achievement progress page." Here's how it works:

When the player does something that activates an "achievement," here's how it works:

if achievement==0 then                             //checks if they've already done the achievement
	achievement = 1                               //set to "achieved"
	store "achievement"                         
	say "Achievement Unlocked"
end

When I do the required action, the game will say "Achievement Unlocked." So I know that part is working.

I have a series of Rooms ("the gallery") that each display a work of pixel art for each achievement unlocked. I use Items to direct the player to either: 1) the next piece of art if they've done the achievement, or 2) an essentially blank room if they have not. The Items look like this:

on collect do
	if achievement==1 then
		goto 11,14 in "nextArt"
	else
		goto 11,14 in "blankRoom"
	end
end

For some reason, the game is always sending the player to the blankRoom, even if the achievement variable is 1.

I've tried declaring each achievement variable first when the game starts, thinking maybe you can't create a variable in an "if" statement, but that didn't work.

I'm really at a loss here. Any ideas?

Figured it out!

The achievements screen is accessible from the main menu, which also includes the typical "continue" and "new game" options. Variables are restored only when the player selects "continue," so none of the achievement tracking variables were active (sorry, I don't know the correct terminology - not a programmer).

I fixed the issue by including the following on my title screen:

on load do
    restore "achievement1"
    restore "achievement2"
    ...
end

I hope this helps someone else! store/restore has been the steepest learning curve for me.

1 Like

This is super cool, and definitely helpful! Going to be putting an achievement system in the game I'm building right now, or am at least considering it / something similar, and this thread will be handy in time. :slight_smile: