author | Wuzzy <almikes@aol.com> |
Mon, 25 Sep 2017 20:09:33 +0200 | |
changeset 12520 | 22f2a586b9ca |
parent 11965 | 72be38f6d0c0 |
child 12523 | f2a19a6056be |
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) |
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
|
121 |
SaveCampaignVar("HogsPosition", "") |
9582
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
122 |
else |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
123 |
checkPoint = tonumber(GetCampaignVar("currentMissionCheckpoint")) |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
124 |
end |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
125 |
return checkPoint |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
126 |
end |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
127 |
|
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
128 |
function saveCheckpoint(cp) |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
129 |
SaveCampaignVar("CurrentMissionCheckpoint", cp) |
bf314b2258b3
less variables used to save the checkpoints - potential breakage xD
Periklis Ntanasis <pntanasis@gmail.com>
parents:
9578
diff
changeset
|
130 |
end |
9630 | 131 |
|
132 |
-- saves what bonuses are available |
|
133 |
-- times is how many times the bonus will be available, this will be mission specific |
|
134 |
function saveBonus(index, times) |
|
135 |
-- 1 2 3 |
|
136 |
-- order: desert03, fruit03, death02 |
|
137 |
local bonus = "000" |
|
138 |
if tonumber(GetCampaignVar("SideMissionsBonuses")) then |
|
139 |
bonus = GetCampaignVar("SideMissionsBonuses") |
|
140 |
end |
|
9718
563a34cd8398
unbreak various parts of campaign variable loading/saving
sheepluva
parents:
9636
diff
changeset
|
141 |
if index == 1 then |
563a34cd8398
unbreak various parts of campaign variable loading/saving
sheepluva
parents:
9636
diff
changeset
|
142 |
bonus = times..bonus:sub(2) |
563a34cd8398
unbreak various parts of campaign variable loading/saving
sheepluva
parents:
9636
diff
changeset
|
143 |
elseif index == bonus:len() then |
9630 | 144 |
bonus = bonus:sub(1,index-1)..times |
145 |
else |
|
146 |
bonus = bonus:sub(1,index-1)..times..bonus:sub(index+1) |
|
147 |
end |
|
148 |
SaveCampaignVar("SideMissionsBonuses",bonus) |
|
149 |
end |
|
150 |
||
151 |
function getBonus(index) |
|
152 |
local bonus = 0 |
|
153 |
if tonumber(GetCampaignVar("SideMissionsBonuses")) then |
|
154 |
bonusString = GetCampaignVar("SideMissionsBonuses") |
|
155 |
bonus = bonusString:sub(index,index) |
|
156 |
end |
|
157 |
return bonus |
|
158 |
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
|
159 |
|
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
|
160 |
-- 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
|
161 |
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
|
162 |
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
|
163 |
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
|
164 |
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
|
165 |
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
|
166 |
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
|
167 |
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
|
168 |
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
|
169 |
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
|
170 |
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
|
171 |
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
|
172 |
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
|
173 |
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
|
174 |
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
|
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 |
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
|
177 |
end |