Debian Codegraph @

dat/missions/zalek/neburesearch/neburesearch_00.lua

raw
1 --[[
2 <?xml version='1.0' encoding='utf8'?>
3 <mission name="Novice Nebula Research">
4 <flags>
5 <unique />
6 </flags>
7 <avail>
8 <priority>4</priority>
9 <chance>100</chance>
10 <location>Bar</location>
11 <planet>Jorla</planet>
12 </avail>
13 <notes>
14 <campaign>Nebula Research</campaign>
15 <tier>2</tier>
16 </notes>
17 </mission>
18 --]]
19 --[[
20
21 Mission: Novice Nebula Research
22
23 Description: A Za'lek student asks the player to help him with his research. The player has to visit Doeston and Iris.
24 Some minor complications on the way have to be expected.
25
26 Difficulty: Easy
27
28 ]]--
29
30 require "numstring.lua"
31 require "missions/zalek/common.lua"
32
33
34 -- Mission Text
35 bar_ask_text = _([["Hello there! You are a pilot, right? For my project I require a ship that can go to the Nebula. Certainly you must be interested in the proposal of researching the phenomenon that cut us off from mankind's patrimony.
36 "As this is the point where any other pilots I asked backed out, I should start by mentioning that due to some unfortunate circumstances the payment for this mission will be only %s. But rest assured, you will be mentioned in the acknowledgment section of my next paper!"]])
37 bar_ask_again_text = _([["Hold up! Look, the problem is that my grant was not permitted to the extent that I asked for. Those assholes cut my funds because they just don't understand the relevance of my research. Just because I'm still a student they completely underestimate my abilities!
38 "Now I've spent all my credits on this sensor suit without the ability to use it. You must know how this feels. I mean, your ship obviously could use some work. So why don't you just help me out here?"]])
39 takeoff_text = _([[As you enter your ship you notice dozens of cables of various colors stretched across your ship's corridors. It is a complete mess. You follow the direction most of the cables seem to lead to and find the culprit.
40 "Oh, hello again, Captain! I'm done with my work here, so we can take off whenever you're ready. I have to calibrate the sensors during the flight so there is no need to rush. Our first destination is %s." You try to maintain composure as you ask him what he has done to your ship. "Oh, I just installed the sensors. It should have no unwanted side effects on your ship.
41 "A mess, you say? Haven't you noticed the color coding? Don't worry, I know exactly what I'm doing!" His last words are supposed to be reassuring but instead you start to think that accepting this mission was not the best idea.]])
42 scan_1_text = _([[The student enters your cockpit as you arrive in the %s system. "Greetings, Captain! I realize I forgot to introduce myself. My name is Robert Hofer, student of Professor Voges himself! I'm sure you must have heard of him?" You tell him that the name doesn't sound familiar to you. "How can that be? Well, you would understand if you were a Za'lek.
43 "Anyway, I will now start with the measurements. The density of the nebula is lower in this sector, so it's not particularly volatile. For the real measurements we have to enter %s. I will let you know when we're done here."]])
44 problems_text = _([[Suddenly you lose control of your ship. Apparently most core systems were shut down. Something drains your ship's energy and there are black outs in several parts of your ship.
45 You realize that your shields are down as well. In an environment like this... That's it, you're going to die here! You knew accepting this mission was a mistake from the very first moment.]])
46 problems_end_text = _([[You breathe a sigh of relief. It seems you're still alive. You try not to glare at Robert Hofer, but apparently aren't particularly successful considering his response. "Sorry for causing trouble. I'm not quite familiar with the electronics of this ship type. You really should fly a Za'lek ship instead. Those are so much better!"
47 "I should investigate the damage it caused to the armor once we land. But first we must go to the %s system. Don't worry, the blackout will not occur again!"]])
48 problems_end_text_has_zalek = _([[You breathe a sigh of relief. It seems you're still alive. You try not to glare at Robert Hofer, but apparently aren't particularly successful considering his response. "Sorry for causing trouble. I seem to have underestimated the polarity feedback loop granularity. If it weren't for your Za'lek ship the problem would have been much worse!"
49 "I should investigate the damage it caused to the armor once we land. But first we must go to the %s system. Don't worry, the blackout will not occur again!"]])
50 finish_text = _([[The student has already removed all the cables and sensors inside your ship during the flight back to %s. Everything is packed into a couple of crates by the time you land.
51 "Once again, thank you for your help. I still have to analyze the data but it looks promising so far. With these results no one is going to question my theories anymore! Also, I decided to increase your reward to compensate for the trouble I caused."
52 He gives you a credit chip worth %s and heads off. The money is nice, but not worth as much as the insight that working for the Za'lek will be dangerous and tiresome.]])
53
54 -- Target Systems
55 t_sys = {}
56 t_sys[1] = "Doeston"
57 t_sys[2] = "Iris"
58
59
60 function create()
61 -- mission variables
62 misn_stage = 0
63 homeworld, homeworld_sys = planet.get("Jorla")
64 credits = 100000
65
66 -- Spaceport bar stuff
67 misn.setNPC(_("A young scientist"), "zalek/unique/student")
68 misn.setDesc( _("You see a young scientist talking with some pilots, apparently without success.") )
69 end
70
71 function accept()
72 local bar_title = _("Science Needs You")
73
74 -- Check for cargo space
75 if player.pilot():cargoFree() < 5 then
76 tk.msg( "", _([["Sorry, I need a ship with more cargo space than you have."]]) )
77 misn.finish()
78 end
79
80 if not tk.yesno(bar_title, string.format(bar_ask_text, creditstring(50000))) then
81 if not tk.yesno(bar_title, bar_ask_again_text ) then
82 misn.finish()
83 else
84 tk.msg( bar_title, string.format(
85 _([["Great! I'll start loading the sensors into your ship right away. We should be ready to take off soon."]]),
86 t_sys[1] ) )
87 end
88 else
89 tk.msg( bar_title, string.format(
90 _([["So it is not a problem at all? I'm still a student and spent all funds I got on the sensor suit. Thank you for helping me out here! I'll start to load the sensors into your ship right away. We should be ready to take off soon."]]),
91 t_sys[1] ) )
92 end
93
94 -- Add cargo
95 cargo = misn.cargoAdd("Nebula Sensor Suit", 5)
96
97 -- Set up mission information
98 misn.setTitle( _("Novice Nebula Research") )
99 misn.setReward( string.format(
100 _("%s and the gratitude of a student"), creditstring(50000) ) )
101 misn.setDesc( _("You have been asked by a Za'lek student to fly into the Nebula for some kind of research.") )
102 misn_marker = misn.markerAdd(system.get(t_sys[1]), "low")
103
104 -- Add mission
105 misn.accept()
106 local osd_title = _("Novice Nebula Research")
107 local osd_msg = {}
108 osd_msg[1] = string.format( _("Fly to the %s system"), t_sys[1] )
109 osd_msg[2] = string.format( _("Fly to the %s system"), t_sys[2] )
110 osd_msg[3] = string.format(
111 _("Return to %s in the %s system"), homeworld:name(),
112 homeworld_sys:name() )
113 misn.osdCreate(osd_title, osd_msg)
114
115 thook = hook.takeoff("takeoff")
116 hook.land("land")
117 hook.enter("jumpin")
118 end
119
120 function land()
121 landed = planet.cur()
122 if misn_stage == 3 and landed == homeworld then
123 tk.msg( "", finish_text:format(
124 homeworld:name(), creditstring(credits) ) )
125 misn.cargoRm(cargo)
126 player.pay(credits)
127 misn.markerRm(misn_marker)
128 zlk_addNebuResearchLog(
129 _("You helped a Za'lek student to collect sensor data in the Nebula.") )
130 misn.finish(true)
131 end
132 end
133
134 function takeoff()
135 local title = _("A Mess On Your Ship")
136 tk.msg(title, string.format(takeoff_text, t_sys[1]))
137 hook.rm(thook)
138 end
139
140 function jumpin()
141 sys = system.cur()
142 if misn_stage == 0 and sys == system.get(t_sys[1]) then
143 hook.timer(5000, "beginFirstScan")
144 elseif misn_stage == 1 and sys == system.get(t_sys[2]) then
145 misn_stage = 2
146 hook.timer(5000, "beginSecondScan")
147 end
148 end
149
150 function beginFirstScan()
151 tk.msg("", string.format(scan_1_text, t_sys[1], t_sys[2]))
152 shook = hook.timer(30000, "startProblems")
153 end
154
155 function startProblems()
156 -- Cancel autonav.
157 player.cinematics(true)
158 player.cinematics(false)
159 ps = player.pilot()
160 ps:control()
161 phook = hook.timer(100, "drainShields")
162 hook.timer(4000, "noticeProblems")
163 end
164
165 function drainShields()
166 ps = player.pilot()
167 armour, shield, stress, dis = ps:health()
168 ps:setHealth(armour, 0)
169 ps:setEnergy(0)
170 phook = hook.timer(100, "drainShields")
171 end
172
173 function noticeProblems()
174 tk.msg("", problems_text)
175 hook.timer(10000, "stopProblems")
176 end
177
178 function stopProblems()
179 ps:control(false)
180 ps:setEnergy(100)
181 if zlk_hasZalekShip() then
182 tk.msg("", string.format(problems_end_text_has_zalek, t_sys[2]))
183 else
184 tk.msg("", string.format(problems_end_text, t_sys[2]))
185 end
186 misn_stage = 1
187 misn.markerMove(misn_marker, system.get(t_sys[2]))
188 misn.osdActive(2)
189 hook.rm(phook)
190 hook.enter("jumpin")
191 end
192
193 function beginSecondScan()
194 tk.msg( "", string.format(
195 _("You arrive in the %s system and Robert Hofer tells you that he will let you know when his scan is complete. This had better not cause another blackout..."),
196 t_sys[2] ) )
197 hook.timer(30000, "endSecondScan")
198 end
199
200 function endSecondScan()
201 tk.msg( "", string.format(
202 _([["OK, my measurements are complete! Let's go back to %s."]]),
203 homeworld:name() ) )
204 misn_stage = 3
205 misn.markerMove(misn_marker, homeworld_sys)
206 misn.osdActive(3)
207 end
208