Save system for score and checkpoints (1 player only)
After seeing (and receiving) quite a few questions about this i thought i'd post a tutorial rather than reply to each.
fistly i need to point out this is for one player only, i havn't tested this in an MP environment however i'm sure scores wont be handed back to all players correctly. While you can sense player scores separately, there is no way to detect if they are the same players returning etc.
I'll start with saving the score only. score sensors send an analogue signal based on the percentage of the sensor limit the players score has reached. For example if the score sensor is set to 500, and the player score reaches 250, the sensor will output an analogue signal of 50%. Whats both interesting and useful in this situation is the fact sensors will also exceed the normal 100% cap of analogue signals in lbp. For example if the sensor is set to 500 and the player score is 1000 the sensor will output an analogue signal of 200%. Also at the extreme of this a score sensor set to 1 and the player score is 4,000,000 the sensor will output a signal of 400,000,000%. also if you feed that signal back into a score giver set to 1 it will give 4,000,000 points. (well it would try to, but the score cap would have already been reached, but you get the idea)
how is this useful?
It becomes useful on the score giver side of things, as a score giver set to "scale every second" requires a digital on signal to give scores.
While there are other ways to add a digital signal to an analogue signal without affecting the analogue signal, having both the sensor and giver set to 1 point is the most thermo friendly way to do it, and it will still allow us to save any score between 1 and 4,000,000.
The following setup is for score only, where a player leaves and returns to the same level with the same score.
The pic is pretty straight forward, i'll just fill in what you cant see.
The memorizer must have a label, player sensor is set to infinite, score sensor is set to 1 point, score giver is set to 1 point and "scale every second", both counters are set to 1.
it is also important to remember the AND gate is set to multiply, and that the signal used to trigger it should always carry a 100% analog signal with the digital.
When the memorizer is triggered it saves the current score, when the player enters the level the saved score is given back to the player.
http://i0.api.vita.lbp.me/img/ft/7e0...8d49969b3f.jpg
now thats all well and good, but what about player progress?
sackboy uses checkpoints to respawn, so this is a good place to also save score and progress, meaning when a player leaves the level (by either closing down the game or returning to pod), when they return to the level we can have them spawn from the last checkpoint they passed, with the same score they had when they passed it.
I've put together a rather basic system that does just that.
we start off with the same system as b4, but without the score sensor or anything wired to the trigger.
this can be placed anywhere as long as player sensor is set to infinite.
http://i5.api.vita.lbp.me/img/ft/805...30fd18cb93.jpg
this next image shows the logic setup for the checkpoint, when the player reaches it, the memorizer is triggered storing both the score and a digital signal indicating that checkpoint was reached, the wire to the checkpoint is also activated (and will be if the player leaves and re-enters the level).
Note: all score givers and sensors are still set to a score of 1, AND gate is set to multiply, and all memorizers should have the same label.
The XOR prevents the player from returning after collecting bubbles further and saving the updated score.
It is also important to also wire the output that goes to the checkpoint to a method of blocking a player from going backwards, for example wire it to logic that closes a door just b4 the checkpoint etc. this prevents players from re-loading the level and re-collecting bubbles they have already collected.
The entry checkpoint can be left as normal, the next should have this. the chip can go on the checkpoint itself, i just often do logic on sticker panel squares so i just glued it on.
the player sensor should be set large enough so players cant get past without activating it.
http://ia.api.vita.lbp.me/img/ft/dca...7ef60eb28d.jpg
you can then copy/paste that checkpoint throughout your level, only thing you need to change with each new one is add a port to the memorizer, and move the checkpoint logic to that new port.
the following pics show what the next 2 should look like, you should see the pattern
http://i5.api.vita.lbp.me/img/ft/a65...ee9dac2f55.jpg
http://i6.api.vita.lbp.me/img/ft/f96...c91617e14f.jpg
Finally you will need to clear the memorizer when the player reaches the scoreboard, simply wiring a player sensor to the reset input of the memorizer will do the trick, this will prevent players replaying the final part of your level everytime they go to play it (unless they manually delete the memory)
have this just b4 your scoreboard. Player sensor should be set large enough that players cant get past without activating it.
http://ie.api.vita.lbp.me/img/ft/c9e...a686083d85.jpg
finally i'll show a way to continue a score between different levels in a series,
you can have a level select hub level to help with this, but i'm gonna focus on a more direct way.
ok, so the first level should contain the following chip just as the player reaches the scoreboard, all this one does is save the current score if it is higher that any score the player may have received in that level b4. and also preserves any score they may have achieved in any later levels (for people replaying earlier levels in the series after playing later ones).
again the player sensor should be set large enough so that players cant get past without activating it, and the score sensor is set to 1 point.
In the following pic all memorizer outputs are looped back to the same numbered input except the first (as it's the first level of an imaginary 8 level series), which first goes through an OR with the score sensor.
the wires are gonna get messy, so bare with me.
http://id.api.vita.lbp.me/img/ft/6bd...9ce2e8867d.jpg
the next level has the same chip near the end but the second port of the memorizer should loop through the OR instead of the first.
we also add the score giving logic we used for the "level progress" method, using the output from the level b4 the current level to give the score.
you should also wire the previous levels output to selector as shown, then use that output to block players from starting the level if it is inactive. for example if a player has not scored on the level b4 u could close any way forward and display a msg that tells players to first play previous levels in the series. (a level select hub level could easily be added using this system)
http://ib.api.vita.lbp.me/img/ft/b3b...38d1544b7b.jpg
for every following level just move down the memoriser with both the port looped through the OR and the output used for the score giver and selector.
the following would be in level 6 of 8
http://i5.api.vita.lbp.me/img/ft/945...2d47369ac5.jpg
both the "level progress" and "series progress" setups will work together, you just have to make a change to make sure players dont receive a score from both when they enter a level.
just keep in mind every level should have it's own level progress memorizer label , but there should be only one series progress memorizer label for the whole series
the following pic shows the change you need to make to the "series progress" system. the memoriser at the top should have that levels "level progress" label, and will block the "series progress" system giving the player the previous levels score if the player has "level progress" already saved for that level. (remembering "level progress" is reset when the player finishes the level)
http://i7.api.vita.lbp.me/img/ft/857...727c624e7e.jpg
i'm hoping i've explained this well enough, but i'll answer an question people may have and fix any mistakes i may have made.