author | Wuzzy <almikes@aol.com> |
Mon, 25 Sep 2017 21:41:38 +0200 | |
changeset 12523 | f2a19a6056be |
parent 11965 | 72be38f6d0c0 |
child 12524 | a5ddc6b4abbd |
permissions | -rw-r--r-- |
11965
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
1 |
local missionsNum = 14 |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
2 |
|
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
3 |
function saveCompletedStatus(planetNum) |
9636
e1921235fc78
cosmos, after death01 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9630
diff
changeset
|
4 |
-- 1 2 3 4 5 6 7 |
e1921235fc78
cosmos, after death01 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9630
diff
changeset
|
5 |
-- order: moon01, fruit01, fruit02, ice01, desert01, death01, final |
e1921235fc78
cosmos, after death01 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9630
diff
changeset
|
6 |
local status = "0000000" |
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
7 |
if tonumber(GetCampaignVar("MainMissionsStatus")) then |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
8 |
status = GetCampaignVar("MainMissionsStatus") |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
9 |
end |
9718
563a34cd8398
unbreak various parts of campaign variable loading/saving
sheepluva
parents:
9636
diff
changeset
|
10 |
|
11952
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
11 |
local planetToLevelMapping = { |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
12 |
[1] = 2, |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
13 |
[2] = 3, |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
14 |
[3] = 8, |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
15 |
[4] = 5, |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
16 |
[5] = 4, |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
17 |
[6] = 9, |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
18 |
[7] = 14 |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
19 |
} |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
20 |
|
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
21 |
local level = planetToLevelMapping[planetNum] |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
22 |
if level ~= nil then |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
23 |
SaveCampaignVar("Mission"..level.."Won", "true") |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
24 |
end |
63988f36debf
Save mission success for A Space Adventure missions
Wuzzy <almikes@aol.com>
parents:
9810
diff
changeset
|
25 |
|
9718
563a34cd8398
unbreak various parts of campaign variable loading/saving
sheepluva
parents:
9636
diff
changeset
|
26 |
if planetNum == 1 then |
563a34cd8398
unbreak various parts of campaign variable loading/saving
sheepluva
parents:
9636
diff
changeset
|
27 |
status = "1"..status:sub(2) |
563a34cd8398
unbreak various parts of campaign variable loading/saving
sheepluva
parents:
9636
diff
changeset
|
28 |
elseif planetNum == status:len() then |
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
29 |
status = status:sub(1,planetNum-1).."1" |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
30 |
else |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
31 |
status = status:sub(1,planetNum-1).."1"..status:sub(planetNum+1) |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
32 |
end |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
33 |
SaveCampaignVar("MainMissionsStatus",status) |
11965
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
34 |
|
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
35 |
checkAllMissionsCompleted() |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
36 |
end |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
37 |
|
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
38 |
function checkAllMissionsCompleted() |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
39 |
local allMissions = true |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
40 |
for i=2, missionsNum do |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
41 |
if GetCampaignVar("Mission"..i.."Won") ~= "true" then |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
42 |
allMissions = false |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
43 |
break |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
44 |
end |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
45 |
end |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
46 |
if allMissions then |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
47 |
SaveCampaignVar("Mission1Won", "true") |
72be38f6d0c0
Complete space campaign's spacetrip mission if all main+side missions are completed
Wuzzy <almikes@aol.com>
parents:
11964
diff
changeset
|
48 |
end |
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
49 |
end |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
50 |
|
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
51 |
function getCompletedStatus() |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
52 |
local allStatus = "" |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
53 |
if tonumber(GetCampaignVar("MainMissionsStatus")) then |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
54 |
allStatus = GetCampaignVar("MainMissionsStatus") |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
55 |
end |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
56 |
local status = { |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
57 |
moon01 = false, |
11964
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
58 |
moon02 = false, |
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
59 |
fruit01 = false, |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
60 |
fruit02 = false, |
11964
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
61 |
fruit03 = false, |
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
62 |
ice01 = false, |
11964
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
63 |
ice02 = false, |
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
64 |
desert01 = false, |
11964
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
65 |
desert02 = false, |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
66 |
desert03 = false, |
9636
e1921235fc78
cosmos, after death01 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9630
diff
changeset
|
67 |
death01 = false, |
11964
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
68 |
death02 = false, |
9636
e1921235fc78
cosmos, after death01 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9630
diff
changeset
|
69 |
final = false |
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
70 |
} |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
71 |
if allStatus ~= "" then |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
72 |
if allStatus:sub(1,1) == "1" then |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
73 |
status.moon01 = true |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
74 |
end |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
75 |
if allStatus:sub(2,2) == "1" then |
9802
00216d609140
desert01 fixed destructible terrain marks and cosmos marks for completed main missions
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9783
diff
changeset
|
76 |
status.fruit01 = true |
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
77 |
end |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
78 |
if allStatus:sub(3,3) == "1" then |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
79 |
status.fruit02 = true |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
80 |
end |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
81 |
if allStatus:sub(4,4) == "1" then |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
82 |
status.ice01 = true |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
83 |
end |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
84 |
if allStatus:sub(5,5) == "1" then |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
85 |
status.desert01 = true |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
86 |
end |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
87 |
if allStatus:sub(6,6) == "1" then |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
88 |
status.death01 = true |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
89 |
end |
9636
e1921235fc78
cosmos, after death01 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9630
diff
changeset
|
90 |
if allStatus:sub(7,7) == "1" then |
e1921235fc78
cosmos, after death01 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9630
diff
changeset
|
91 |
status.final = true |
e1921235fc78
cosmos, after death01 dialogs
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9630
diff
changeset
|
92 |
end |
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
93 |
end |
11964
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
94 |
-- Bonus missions |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
95 |
if GetCampaignVar("Mission13Won") == "true" then |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
96 |
status.moon02 = true |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
97 |
end |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
98 |
if GetCampaignVar("Mission6Won") == "true" then |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
99 |
status.ice02 = true |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
100 |
end |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
101 |
if GetCampaignVar("Mission7Won") == "true" then |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
102 |
status.desert02 = true |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
103 |
end |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
104 |
if GetCampaignVar("Mission10Won") == "true" then |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
105 |
status.fruit03 = true |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
106 |
end |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
107 |
if GetCampaignVar("Mission11Won") == "true" then |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
108 |
status.death02 = true |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
109 |
end |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
110 |
if GetCampaignVar("Mission12Won") == "true" then |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
111 |
status.desert03 = true |
f3c1679694d3
Draw 2 flowers for fully completed (w/ side missions) planets in space campaign
Wuzzy <almikes@aol.com>
parents:
11952
diff
changeset
|
112 |
end |
9578
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
113 |
return status |
16139270448f
save main missions' status
Periklis Ntanasis <pntanasis@gmail.com>
parents:
diff
changeset
|
114 |
end |
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
115 |
|
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
116 |
function initCheckpoint(mission) |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
117 |
local checkPoint = 1 |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
118 |
if GetCampaignVar("CurrentMission") ~= mission then |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
119 |
SaveCampaignVar("CurrentMission", mission) |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
120 |
SaveCampaignVar("CurrentMissionCheckpoint", 1) |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
121 |
else |
12523
f2a19a6056be
ASA: Reset mission checkpoints when going to Spacetrip
Wuzzy <almikes@aol.com>
parents:
11965
diff
changeset
|
122 |
checkPoint = tonumber(GetCampaignVar("CurrentMissionCheckpoint")) |
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
123 |
end |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
124 |
return checkPoint |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
125 |
end |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
126 |
|
12523
f2a19a6056be
ASA: Reset mission checkpoints when going to Spacetrip
Wuzzy <almikes@aol.com>
parents:
11965
diff
changeset
|
127 |
function resetCheckpoint(mission) |
f2a19a6056be
ASA: Reset mission checkpoints when going to Spacetrip
Wuzzy <almikes@aol.com>
parents:
11965
diff
changeset
|
128 |
SaveCampaignVar("CurrentMissionCheckpoint", 1) |
f2a19a6056be
ASA: Reset mission checkpoints when going to Spacetrip
Wuzzy <almikes@aol.com>
parents:
11965
diff
changeset
|
129 |
end |
f2a19a6056be
ASA: Reset mission checkpoints when going to Spacetrip
Wuzzy <almikes@aol.com>
parents:
11965
diff
changeset
|
130 |
|
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
131 |
function saveCheckpoint(cp) |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
132 |
SaveCampaignVar("CurrentMissionCheckpoint", cp) |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
133 |
end |
9630 | 134 |
|
135 |
-- saves what bonuses are available |
|
136 |
-- times is how many times the bonus will be available, this will be mission specific |
|
137 |
function saveBonus(index, times) |
|
138 |
-- 1 2 3 |
|
139 |
-- order: desert03, fruit03, death02 |
|
140 |
local bonus = "000" |
|
141 |
if tonumber(GetCampaignVar("SideMissionsBonuses")) then |
|
142 |
bonus = GetCampaignVar("SideMissionsBonuses") |
|
143 |
end |
|
9718
563a34cd8398
unbreak various parts of campaign variable loading/saving
sheepluva
parents:
9636
diff
changeset
|
144 |
if index == 1 then |
563a34cd8398
unbreak various parts of campaign variable loading/saving
sheepluva
parents:
9636
diff
changeset
|
145 |
bonus = times..bonus:sub(2) |
563a34cd8398
unbreak various parts of campaign variable loading/saving
sheepluva
parents:
9636
diff
changeset
|
146 |
elseif index == bonus:len() then |
9630 | 147 |
bonus = bonus:sub(1,index-1)..times |
148 |
else |
|
149 |
bonus = bonus:sub(1,index-1)..times..bonus:sub(index+1) |
|
150 |
end |
|
151 |
SaveCampaignVar("SideMissionsBonuses",bonus) |
|
152 |
end |
|
153 |
||
154 |
function getBonus(index) |
|
155 |
local bonus = 0 |
|
156 |
if tonumber(GetCampaignVar("SideMissionsBonuses")) then |
|
157 |
bonusString = GetCampaignVar("SideMissionsBonuses") |
|
158 |
bonus = bonusString:sub(index,index) |
|
159 |
end |
|
160 |
return bonus |
|
161 |
end |
|
9782
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
162 |
|
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
163 |
-- splits number by delimiter |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
164 |
function split(s, delimiter) |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
165 |
local res = {} |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
166 |
local first = "" |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
167 |
for i=1,s:len() do |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
168 |
if s:sub(1,1) == delimiter then |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
169 |
table.insert(res, tonumber(first)) |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
170 |
first = "" |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
171 |
else |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
172 |
first = first..s:sub(1,1) |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
173 |
end |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
174 |
s = s:sub(2) |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
175 |
end |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
176 |
if first:len() > 0 then |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
177 |
table.insert(res, tonumber(first)) |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
178 |
end |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
179 |
return res |
6c3cad32d4f4
fixed getting device crates with rc plane,end game when device crates destroyed,save/load hero position for checkpoint 5 in desert01
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9718
diff
changeset
|
180 |
end |