Debian Codegraph @

dat/missions/zalek/neburesearch/neburesearch_03.lua

raw
1 --[[
2 <?xml version='1.0' encoding='utf8'?>
3 <mission name="The Substitute Speaker">
4 <flags>
5 <unique />
6 </flags>
7 <avail>
8 <priority>4</priority>
9 <done>Emergency of Immediate Inspiration</done>
10 <chance>100</chance>
11 <location>Bar</location>
12 <planet>Jorla</planet>
13 </avail>
14 </mission>
15 --]]
16 --[[
17
18 Mission: The Substitute Speaker
19
20 Description: The player has to impersonate a scientist and give a scientific talk.
21
22 Difficulty: Easy
23
24 --]]
25
26 require "scripts/cargo_common.lua"
27 require "scripts/numstring.lua"
28 require "missions/zalek/common.lua"
29
30
31 bar_desc = _("The student is already awaiting you.")
32 mtitle = _("The Substitute Speaker")
33 mdesc = _("Fly to %s in the %s system before %s and give a scientific talk.")
34 misn_reward = _("a reputation as scientist (?)")
35 landing_title = _("Arriving on %s")
36 arriving_title = _("On your way to the institute")
37 cancel_title = _("Tactical Retreat")
38 talk_title = _("Scientific Talk")
39 lab_coat_title = _("Lab Coat Shop")
40 timeup_title = _("Time to visit the institute")
41 bar_text = _([[You join the student and explain him that Dr. Mensing actually hasn't told you what you are supposed to do.
42 "Ah, right. There is a conference on %s in the %s system soon. Actually she is supposed to be the substitution for professor Voges. He is absent for weeks by now. No one knows what he is doing on Ruadan. Anyway, back to topic. You have to bring me there as ersatz-substitution for Dr. Mensing as she got seriously ill. But you already know that as you brought her here."
43 You tell him that she looked perfectly fine and said she wants to conduct her research instead of going to the conference.
44 "WHAT?? It was MY idea, initially! She just wants to kick me out! I bet she thinks she could just pull it off entirely without me to be the only author! No way she could ever achieve that!"
45 "%s, you have to go to the conference instead! What do you mean you don't know anything about science? How about this, I just give you my presentation and while you're on the way I type the exact text I'd recite during my talk and send it to you. Just recite it on my behalf and it's going to be fine!"]])
46 leave_text = _([["No time for discussions, sorry. While we're talking Dr. Mensing is trying to get an advantage! I have no time to lose!"
47 He stands up and searches his pockets for something. "Here, the presentation," he says and hands you a small data chip. He further adds, "And don't be too late!" before rushing out of the bar in a hurry. Wait a minute, you haven't agreed to accept the mission!]])
48 arrival_text = _([[You arrived on %s on time. There is even some time left to prepare your talk. During the flight you threw a glance at the presentation on the data chip but you haven't managed to figure out the meaning of it. How is this supposed to work out??
49 Your thoughts are interrupted by an incoming message from the student. "As promised I'm sending you the text you have to recite. I hope you appreciate the time I wasted on typing that down. I hadn't considered that you'll have to answer questions after the talk, though. Do what every good scientist does and just talk about some random stuff that sounds like it may be related to the question. I'm sure you'll do it just fine. Good luck!" This message is followed by what you assume is the text you have to recite.]])
50 cancel_text = _([[This is too much! You better leave before doing anything embarrassing or humiliating.]])
51 learn_text = _([[You decide to learn your text rather than simply reciting the text. It turned out to be the right decision because you haven't ever seen most of those words.]])
52 spaceport_text = _([[You decide to explore the spaceport. There are a couple of shops here which may sell something useful for your mission.]])
53 lab_coat_text = _([[You enter a shop that sells only lab coats. The assortment of lab coats is impressive: lab coats of all colors, different materials, and cuts. There are distinct sections for casual and working lab coats. Whatever the difference is, it is too subtle for you to grasp. You settle on a "business" lab coat because something formal is probably suitable for your talk. The price tag reads %s. %s]])
54 electronics_text = _([[While walking through a store selling electronics you notice a pair of glasses with integrated displays. You could use them to display the text you are supposed to recite. They are rather expensive though, %s. %s]])
55 return_text = _([[You return to your ship.]])
56 timeup_text = _([[It's time to go to the institute.]])
57 institute_text = _([[You make your way to the institute where you are supposed to give the talk, following the signs. On arriving you ask around where you should head to for your talk. Apparently you were already awaited. You are lead to a rather small seminar room. Finally you are ready to give your talk and a few scientist take seat. Actually you expected more than 17 listener. Maybe this talk is not such a big deal as you expected. They wouldn't just send you to an important presentation, right?]])
58 no_lab_coat_text = _("It is just now that you realize that you're the only person now wearing a lab coat. That's a nightmare! Well, maybe it would be for a scientist?")
59 has_lab_coat_text = _("Wearing a lab coat you blend in nicely with your audience.")
60 talk_unprepared_text = _([[%s
61 You start reciting the text you got from the student. You realize that you should have learned the text as some of the occurring terms are difficult to pronounce correctly.]])
62 talk_prepared_text = _([[%s
63 You start reciting the text you got from the student. It turned out learning your text was the right choice. Some of the occurring terms are difficult to pronounce correctly.]])
64 talk_glasses_text = _([[%s
65 You start reciting the text you got from the student. With the text being displayed on your glasses you don't have to look down on a paper to read the text, but some of the occurring terms are difficult to pronounce correctly.]])
66 talk_finished_text = _([[Finally you are finished with your text and sigh in relief. After a brief applause someone raises his hand. Apparently he wants to ask a question. What should you do?]])
67 question_text = _([[You haven't understood the question, not even a single word.]])
68 run_text = _([[You decide to run towards the closest door and leave the building as fast as possible. You continue running until you reach the spaceport and enter your ship. You can't be the first one running from a talk, right?]])
69 avoid_question_text = _([[You try to avoid the question. The scientist seems to be upset. There are no further questions. Apparently there is another talk that starts very soon so people hurry off. You manage to leave without gaining much attention and return to your ship. Enough science for today!]])
70
71 choice_learn = _("Start learning your text")
72 choice_leave = _("Take off immediately")
73 choice_return = _("Return to your ship")
74 choice_run = _("Run!")
75 choice_institute = _("Go to the institute")
76 choice_spaceport = _("Explore the space port")
77 choice_lab_coat = _("Buy a lab coat")
78 choice_electronics = _("Visit the electronics store")
79 choice_open_question = _("It's an open question.")
80 choice_good_question = _("This is a good question.")
81
82 msg_timeup = _("You were too late. You're never going to be a great scientist!")
83
84 -- Mission info stuff
85 osd_msg = {}
86 osd_title = _("The Substitute Speaker")
87 osd_msg1 = _("Fly to %s in the %s system before %s\n(%s remaining)")
88
89 log_text = _([[You gave a scientific talk in %s. Did anyone noticed you're not a scientist?]])
90
91
92 function create()
93 -- mission variables
94 homeworld, homeworld_sys = planet.get("Jorla")
95 dest_planet, dest_sys = planet.get("Neo Pomerania")
96 lab_coat_price = 25000 -- 25K
97 glasses_price = 40000 -- 40K
98 local numjumps = homeworld_sys:jumpDist(dest_sys, false)
99 local traveldist = cargo_calculateDistance(homeworld_sys, homeworld:pos(), dest_sys, dest_planet)
100 local stuperpx = 0.225
101 local stuperjump = 10000
102 local stupertakeoff = 10500
103 local allowance = traveldist * stuperpx + numjumps * stuperjump + stupertakeoff + 250 * numjumps
104 timelimit = time.get() + time.create(0, 0, allowance)
105
106 -- Spaceport bar stuff
107 misn.setNPC(_("Robert"), "zalek/unique/student")
108 misn.setDesc(bar_desc)
109 end
110
111 function accept()
112 tk.msg("", bar_text:format(dest_planet:name(), dest_sys:name(), player:name()))
113 tk.msg("", leave_text)
114 learned_text = false
115 has_lab_coat = false
116 has_glasses = false
117 time_left = 4
118
119 -- Set up mission information
120 misn.setTitle(mtitle)
121 misn.setReward(misn_reward)
122 misn.setDesc(mdesc:format(dest_planet:name(), dest_sys:name(), timelimit:str()))
123 misn_marker = misn.markerAdd(dest_sys, "high")
124
125 misn.accept()
126 osd_msg[1] = osd_msg1:format(dest_planet:name(), dest_sys:name(), timelimit:str(), (timelimit - time.get()):str())
127 misn.osdCreate(osd_title, osd_msg)
128
129 hook.land("land")
130 hook.date(time.create(0, 0, 100), "tick") -- 100STU per tick
131 end
132
133
134 function land()
135 landed = planet.cur()
136 if landed == dest_planet then
137 tk.msg(landing_title:format(dest_planet:name()), arrival_text:format(dest_planet:name()))
138 enter_ship()
139 end
140 end
141
142 function enter_ship()
143 local c = 0
144 time_left = time_left - 1
145 if time_left < 0 then
146 tk.msg(timeup_title, timeup_text)
147 start_talk()
148 return
149 end
150 if learned_text then
151 c = tk.choice("", _("You wonder what to do..."), choice_spaceport, choice_leave)
152 else
153 c = tk.choice("", _("You wonder what to do..."), choice_spaceport, choice_leave, choice_learn)
154 end
155 if c == 1 then
156 tk.msg("", spaceport_text)
157 enter_spaceport()
158 return
159 elseif c == 2 then
160 tk.msg(cancel_title, cancel_text)
161 misn.finish(false)
162 return
163 elseif c == 3 then
164 learned_text = true
165 tk.msg("", learn_text)
166 time_left = time_left - 1
167 end
168 enter_ship()
169 end
170
171 function enter_spaceport()
172 local c = 0
173 time_left = time_left - 1
174 if time_left < 0 then
175 tk.msg(timeup_title, timeup_text)
176 start_talk()
177 return
178 end
179 if has_lab_coat then
180 if has_glasses then
181 c = tk.choice("", _("You wonder what to do..."), choice_return, choice_institute)
182 else
183 c = tk.choice("", _("You wonder what to do..."), choice_return, choice_institute, choice_electronics)
184 end
185 else
186 if has_glasses then
187 c = tk.choice("", _("You wonder what to do..."), choice_return, choice_institute, choice_lab_coat)
188 else
189 c = tk.choice("", _("You wonder what to do..."), choice_return, choice_institute, choice_lab_coat, choice_electronics)
190 end
191 end
192 if c == 1 then
193 tk.msg("", return_text)
194 enter_ship()
195 return
196 elseif c == 2 then
197 start_talk()
198 return
199 elseif not has_lab_coat and c == 3 then
200 if player.credits() < lab_coat_price then
201 tk.msg(lab_coat_title, lab_coat_text:format(creditstring(lab_coat_price), _("Apparently this is too expensive for you. Looks like you have to give your talk without a lab coat.")))
202 else
203 if tk.choice(lab_coat_title, lab_coat_text:format(creditstring(lab_coat_price), _("Will you buy the lab coat?")), _("Yes"), _("No")) == 1 then
204 player.pay(-lab_coat_price)
205 has_lab_coat = true
206 end
207 end
208 elseif (has_lab_coat and c == 3) or (not has_lab_coat and c == 4) then
209 if player.credits() < glasses_price then
210 tk.msg("", electronics_text:format(creditstring(glasses_price), _("Apparently this is too expensive for you.")))
211 else
212 if tk.choice("", electronics_text:format(creditstring(glasses_price), _("Will you buy the glasses?")), _("Yes"), _("No")) == 1 then
213 player.pay(-lab_coat_price)
214 has_glasses = true
215 end
216 end
217 end
218 enter_spaceport()
219 end
220
221 function start_talk()
222 local c = 0
223 local text1
224 if has_lab_coat then
225 text1 = has_lab_coat_text
226 faction.modPlayerSingle("Za'lek", 1)
227 else
228 text1 = no_lab_coat_text
229 end
230 tk.msg(talk_title, institute_text)
231 if learned_text then
232 tk.msg(talk_title, talk_prepared_text:format(text1))
233 faction.modPlayerSingle("Za'lek", 1)
234 elseif has_glasses then
235 tk.msg(talk_title, talk_glasses_text:format(text1))
236 faction.modPlayerSingle("Za'lek", 1)
237 else
238 tk.msg(talk_title, talk_unprepared_text:format(text1))
239 end
240 tk.msg(talk_title, talk_finished_text)
241 c = tk.choice(talk_title, question_text, choice_good_question, choice_open_question, choice_run)
242
243 if c == 3 then
244 tk.msg(cancel_title, run_text)
245 zlk_addNebuResearchLog(log_text:format(dest_planet:name()))
246 misn.finish(true)
247 return
248 end
249
250 tk.msg(talk_title, avoid_question_text)
251 zlk_addNebuResearchLog(log_text:format(dest_planet:name()))
252 faction.modPlayerSingle("Za'lek", 1)
253 misn.finish(true)
254 end
255
256 -- Date hook
257 function tick()
258 local osd_msg = {}
259 if timelimit <= time.get() then
260 -- Case missed second deadline
261 player.msg(msg_timeup)
262 misn.finish(false)
263 else
264 osd_msg[1] = osd_msg1:format(dest_planet:name(), dest_sys:name(), timelimit:str(), (timelimit - time.get()):str())
265 misn.osdCreate(osd_title, osd_msg)
266 end
267 end
268