18,700
edits
(rewrote the tutorial top to bottom; the script has been tweaked and simplified, and some odd advice on forking corrected) |
(added info on usage of restore_game) |
||
Line 262: | Line 262: | ||
<tt>[[save_point]]</tt> is a built-in variable that can be read but not set, and which tells you the save point that the player loaded, so you can set up your level accordingly (clicking on the name of the level in Load Game registers as save point 0). To record the player reaching a save point in your level, you call <tt>[[save_game]] ''n''</tt>, where 'n' is 1-10. | <tt>[[save_point]]</tt> is a built-in variable that can be read but not set, and which tells you the save point that the player loaded, so you can set up your level accordingly (clicking on the name of the level in Load Game registers as save point 0). To record the player reaching a save point in your level, you call <tt>[[save_game]] ''n''</tt>, where 'n' is 1-10. | ||
To handle the player restoring a saved game, you use logic like the snippet above to read <tt>save_point</tt> and then set up the level accordingly by doing things such as turning trigger volumes on/off, spawning additional AIs, and whatever other changes are necessary to take the level from its default starting state to the state it should have as of the save point from which the player is loading. After making these changes, you call <tt>[[restore_game]]</tt> to restore the player's state. This function retrieves the player state that was saved in [[persist.dat]] for the current save point: Konoko's position in a level, her health, and her inventory. persist.dat does not store information on world state, which is why you are responsible for handling that manually with your own BSL calls. | |||
[[Category:Modding tutorials]] | [[Category:Modding tutorials]] |