-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsaves.lua
More file actions
65 lines (59 loc) · 1.48 KB
/
saves.lua
File metadata and controls
65 lines (59 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function SaveGame(episodeNumber)
local suffix = ""
if episodeNumber == 1 then
suffix = "st"
elseif episodeNumber == 2 then
suffix = "nd"
elseif episodeNumber == 3 then
suffix = "rd"
elseif episodeNumber == 4 or episodeNumber == 5 then
suffix = "th"
end
System.SaveData(
nextscene,
episodeNumber .. suffix .. " episode save",
"Minecraft Story Mode Save",
"EBOOT.PBP",
"assets/ui/saves_icon.png",
"assets/ui/saves_bg.png"
)
wr(episodeNumber .. "_status", "continue")
for i = episodeNumber + 1, 5 do
rm(i .. "_status")
_G["status_" .. i] = nil
end
if episodeNumber == 1 then
local saveDir = "assets/saves/"
local variablesFilePath = string.format("%s%d_variables.txt", saveDir, episodeNumber)
local variables = {
reuben = reuben,
building = building,
sword = sword,
}
local file, err = io.open(variablesFilePath, "w")
if file then
for key, value in pairs(variables) do
if value ~= nil then
file:write(string.format('%s = "%s"\n', key, tostring(value)))
end
end
file:close()
end
elseif episodeNumber == 5 then
local saveDir = "assets/saves/"
local variablesFilePath = string.format("%s%d_variables.txt", saveDir, episodeNumber)
local variables = {
save = save,
mi = mi,
}
local file, err = io.open(variablesFilePath, "w")
if file then
for key, value in pairs(variables) do
if value ~= nil then
file:write(string.format('%s = "%s"\n', key, tostring(value)))
end
end
file:close()
end
end
end