Debian Codegraph @

dat/missions/zalek/sciencegonewrong/00_sciwrong.lua

raw
1 --[[
2 <?xml version='1.0' encoding='utf8'?>
3 <mission name="The one with the Shopping">
4 <flags>
5 <unique />
6 </flags>
7 <avail>
8 <priority>4</priority>
9 <chance>100</chance>
10 <location>Bar</location>
11 <planet>Gastan</planet>
12 </avail>
13 <notes>
14 <tier>2</tier>
15 </notes>
16 </mission>
17 --]]
18 --[[
19 Mission: The one with the Shopping
20
21 Description: A Za'lek scientist asks the player to fetch some raw material that he needs to build his prototype.
22 Multiple systems have to be visited and materials acquired from contact persons in the bar.
23
24 Difficulty: Easy to Medium? Depending on whether the player lingers around too much and gets caught.
25
26 Author: fart but based on Mission Ideas in wiki: wiki.naev.org/wiki/Mission_Ideas
27 --]]
28
29 require "numstring.lua"
30 require "proximity.lua"
31 require "fleethelper.lua"
32 require "missions/zalek/common.lua"
33
34
35 -- set mission variables
36 t_sys = {}
37 t_pla = {}
38 t_sys[1] = "Daravon"
39 t_pla[1] = "Vilati Vilata"
40 t_sys[2] = "Waterhole"
41 t_pla[2] = "Waterhole's Moon"
42 -- t_x[3] is empty bc it depends on where the mission will start finally. (To be set in mission.xml and then adjusted in the following campaign missions)
43 t_sys[3] = "Seiben"
44 t_pla[3] = "Gastan"
45 pho_mny = 50000
46 reward = 1000000
47 title = {}
48 text = {}
49 osd_msg = {}
50 -- set text variables
51 -- Mission details
52 misn_title = _("The one with the Shopping")
53 misn_reward = _("The gratitude of science and a bit of compensation")
54 misn_desc = _("You've been hired by Dr. Geller to collect some materials he urgently needs for his research.")
55 bar_desc = _("You see a scientist talking to various pilots. Perhaps you should see what he's looking for.")
56 trd1_desc = _("A scientist conspicuously sits in the corner. Perhaps he might be the person you're supposed to get this stuff for.")
57 trd2_desc = _("You see a shifty-looking dealer of some kind. Maybe he has what you're looking for.")
58
59 title[1] = _([[In the bar]])
60 text[1] = _([["Oh, hello! You look like you're a pilot; is that right? I've got a job for you. Allow me to introduce myself; my name is Dr. Geller, and I am on the brink of revolutionizing science! I've basically already done it; there's just some minor fiddling to do. Would you like to help me out? I just need you to find some samples that I can study."]])
61 text[2] = _([["Excellent! Here is the list." He hands you a memory chip and turns away even before you can say anything and without giving you any cash to actually do his shopping. Once you check the list you find that it contains not only a list of materials he needs, but also information where to retrieve these and a list of contact traders.]])
62 text[3] = _([["With what can I help you, my friend?" says the shifty figure. You hand him the memory chip the scientist handed you.]])
63 -- dialogue with first trader
64 text[4] = _([["Of course I have what you need. I'll trade it for some 3t phosphine. You can find it on %s in the %s system."]])
65 text[6] = _([["Ah, yes indeed," he says as he inspects a sample in front of him. "That will do. And here, as promised: a piece of a ghost ship from the nebula. 100% authentic! At least, according to my supplier."]])
66 text[7] = _([["What are you still doing here? No phosphine, no trade."]])
67 -- dialogue with 2nd trader
68 -- %s for pho_mny
69 text[8] = _([["You approach the dealer and explain what you are looking for. He raises his eyebrow. "It will be %s. But if you get caught by the authorities, you're on your own. Far as I'm concerned I never saw you. Deal?"]])
70 mnytitle = _([[In the bar]])
71 mnytext = _([["You don't have enough money. Stop wasting my time."]])
72 text[9] = _([["Pleasure to do business with you."]])
73 text[10] = _([["Then we have nothing to to discuss."]])
74 -- call of the police
75 title[2] = _([[On the intercom]])
76 text[11] = _([["We have reason to believe you are carrying controlled substances without a proper license. Please stop your ship and prepare to be boarded."]])
77 text[12] = _([["Stand down for inspection."]])
78 title[3] = _([[On your ship]])
79 text[13] = _([["You are accused of violating regulation on the transport of toxic materials. Your ship will be searched now. If there are no contraband substances, we will be out of your hair in just a moment."]])
80 text[14] = _([[The inspectors search through your ship and cargo hold. It doesn't take long for them to find the phosphine; they confiscate it and fine you %s.]])
81 text[15] = _([[Dr. Geller looks up at you as you approach. "Do you have what I was looking for?" You present the ghost ship piece and his face begins to glow. "Yes, that's it! Now I can continue my research. I've been looking everywhere for a sample!" You ask him about the so-called ghost ships. He seems amused by the question. "Some people believe in ridiculous nonsense related to this. There is no scientific explanation for the origin of these so-called ghost ships yet, but I think it has to do with some technology involved in the Incident. Hard to say exactly what, but hey, that's why we do research!"]])
82 text[16] = _([[As he turns away, you audibly clear your throat, prompting him to turn back to you. "Oh, yes, of course you want some payment for your service. My apologies for forgetting." He hands you a credit chip with your payment. "I might need your services again in the future, so do stay in touch!"]])
83 trd_disc = _([[This guy seems to be the trader, surrounded by bodyguards he looks a bit shifty.]])
84 -- osd_msg
85 osd_msg[1] = _("Go to the %s system and talk to the trader on %s")
86 osd_msg[2] = _("Go to the %s system and talk to the contact person on %s")
87 osd_msg[3] = _("Return to the %s system to the trader on %s")
88 osd_msg[4] = _("Return to the %s system and deliver to Dr. Geller on %s")
89 -- refusetext
90 refusetitle = _("No Science Today")
91 refusetext = _("I guess you don't care for science...")
92
93 log_text = _([[You helped Dr. Geller obtain a "ghost ship piece" for his research. When you asked about these so-called ghost ships, he seemed amused. "Some people believe in ridiculous nonsense related to this. There is no scientific explanation for the origin of these so-called ghost ships yet, but I think it has to do with some technology involved in the Incident. Hard to say exactly what, but hey, that's why we do research!"]])
94
95
96 function create ()
97 -- Spaceport bar stuff
98 misn.setNPC( _("A scientist"), "zalek/unique/geller" )
99 misn.setDesc( bar_desc )
100 end
101 function accept()
102 -- Mission details:
103 if not tk.yesno( title[1], text[1] ) then
104 tk.msg(refusetitle, refusetext)
105 misn.finish()
106 end
107 tk.msg( title[1], text[2] )
108 misn.accept()
109 misn.osdCreate(misn_title, {osd_msg[1]:format(t_sys[1], t_pla[1])})
110 misn.setDesc(misn_desc)
111 misn.setTitle(misn_title)
112 misn.setReward(misn_reward)
113 misn_mark = misn.markerAdd( system.get(t_sys[1]), "high" )
114 talked = false
115 lhook1 = hook.land("land1", "land")
116 end
117
118 function land1()
119 if planet.cur() == planet.get(t_pla[1]) and not talked and not traded then
120 bar1pir1 = misn.npcAdd("first_trd", _("Trader"), "neutral/scientist3", trd1_desc)
121 elseif planet.cur() == planet.get(t_pla[1]) and talked and traded1 then
122 bar1pir1 = misn.npcAdd("third_trd", _("Trader"), "neutral/scientist3", trd1_desc)
123 end
124 end
125
126 function land2()
127 if planet.cur() == planet.get(t_pla[2]) and talked and not traded1 then
128 bar2pir1 = misn.npcAdd("second_trd", _("Contact Person"), "neutral/unique/dealer", trd2_desc)
129 end
130 end
131
132 -- first trade: send player 2 2nd system, if he goes back here, tell them to get going...
133 function first_trd()
134 if talked then
135 tk.msg(title[1], text[7])
136 return
137 else
138 tk.msg(title[1], text[3])
139 tk.msg(title[1], text[4]:format(t_pla[2], t_sys[2]))
140 talked = true
141 end
142
143
144 osd_msg[2] = osd_msg[2]:format(t_sys[2], t_pla[2])
145 misn.osdCreate(misn_title, {osd_msg[2]})
146
147 misn.markerMove(misn_mark, system.get(t_sys[2]))
148
149 lhook2 = hook.land("land2", "land")
150
151 end
152 -- 2nd trade: Get player the stuff and make them pay, let them be hunted by the police squad
153 function second_trd()
154 misn.npcRm(bar2pir1)
155 if not tk.yesno( title[1], text[8]:format(creditstring(pho_mny)) ) then
156 tk.msg(title[1], text[10])
157 return
158 end
159 -- take money from player, if player does not have the money, refuse
160 if player.credits() < 50000 then
161 tk.msg(mnytitle, mnytext)
162 return
163 end
164 player.pay(-pho_mny)
165 carg_id = misn.cargoAdd("Phosphine", 3)
166 tk.msg(title[1], text[9])
167 osd_msg[3] = osd_msg[3]:format(t_sys[1],t_pla[1])
168 misn.osdCreate(misn_title, {osd_msg[3]})
169 -- create hook that player will be hailed by authorities bc of toxic materials
170 misn.markerMove(misn_mark, system.get(t_sys[1]))
171 hook.rm(lhook2)
172 hook.enter("sys_enter")
173 traded1 = true
174 end
175
176 -- 3rd trade: Get the stuff the scientist wants
177 function third_trd()
178 tk.msg(title[1], text[6])
179
180 misn.npcRm(bar1pir1)
181 misn.cargoRm(carg_id)
182 player.msg(t_sys[3])
183 osd_msg[4] = osd_msg[4]:format(t_sys[3], t_pla[3])
184 misn.osdCreate(misn_title, {osd_msg[4]})
185
186 misn.markerMove(misn_mark, system.get(t_sys[3]))
187
188 hook.rm(lhook1)
189
190 traded2 = true
191 lhook1 = hook.land("fnl_ld", "land")
192 end
193
194 -- final land: let the player land and collect the reward
195 function fnl_ld ()
196 if planet.cur() == planet.get(t_pla[3]) and traded2 then
197 tk.msg(title[1],text[15])
198 tk.msg(title[1],text[16])
199 player.pay(reward)
200 zlk_addSciWrongLog( log_text )
201 misn.finish(true)
202 end
203 end
204 -- when the player takes off the authorities will want them
205 function sys_enter ()
206 if system.cur() == system.get(t_sys[2]) then
207 hook.timer(7000, "call_the_police")
208 end
209 end
210 function call_the_police ()
211 spwn_police()
212 tk.msg(title[2],text[11])
213 tk.msg(title[2],text[12])
214 if boardh == nil then
215 boardh = hook.pilot(player.pilot(), "disable", "go_board")
216 end
217 end
218
219 function spwn_police ()
220 lance1 = pilot.add("Empire Lancelot", "empire", system.get("Provectus Nova"), "Empire")
221 lance1 = lance1[1]
222 lance2 = pilot.add("Empire Lancelot", "empire", system.get("Provectus Nova"), "Empire")
223 lance2 = lance2[1]
224 adm1 = pilot.add("Empire Admonisher", "empire", system.get("Provectus Nova"), "Empire")
225 adm1 = adm1[1]
226 -- Re-outfit the ships to use disable weapons. Make a proper function for that.
227 lance1:rmOutfit("all")
228 lance1:addOutfit("Heavy Ion Cannon", 1)
229 lance1:addOutfit("Ion Cannon", 1)
230 lance1:addOutfit("TeraCom Medusa Launcher", 2)
231 lance2:rmOutfit("all")
232 lance2:addOutfit("Heavy Ion Cannon", 1)
233 lance2:addOutfit("Ion Cannon", 1)
234 lance2:addOutfit("TeraCom Medusa Launcher", 2)
235
236 adm1:rmOutfit("all")
237 adm1:addOutfit("Heavy Ion Turret", 2)
238 adm1:addOutfit("EMP Grenade Launcher", 1)
239 adm1:addOutfit("Ion Cannon", 2)
240 lance1:setHostile(true)
241 lance2:setHostile(true)
242 adm1:setHostile(true)
243 end
244 -- move to the player ship
245
246 function go_board ()
247 if adm1:exists() then
248 adm1:control()
249 adm1:setHostile(false)
250 adm1:goto(player.pos())
251 admho = hook.pilot(adm1, "idle", "fine_vanish")
252 end
253 if lance1:exists() then
254 lance1:control()
255 lance1:setHostile(false)
256 lance1:goto(player.pos())
257 l1ho = hook.pilot(lance1, "idle", "fine_vanish")
258 end
259 if lance2:exists() then
260 lance2:control()
261 lance2:setHostile(false)
262 lance2:goto(player.pos())
263 l2ho = hook.pilot(lance2, "idle", "fine_vanish")
264 end
265 end
266 -- display msgs and have the ships disappear and fail the mission...
267 function fine_vanish ()
268 fine = 100000
269 tk.msg(title[3],text[13])
270 tk.msg(title[3],text[14]:format(creditstring(fine)))
271 if player.credits() > fine then
272 player.pay(-fine)
273 else
274 player.pay(-player.credits())
275 end
276 misn.cargoRm(carg_id)
277 if adm1:exists() then
278 adm1:hyperspace()
279 end
280 if lance1:exists() then
281 lance1:hyperspace()
282 end
283 if lance2:exists() then
284 lance2:hyperspace()
285 end
286 player.msgClear()
287 player.msg(_("Mission failed!"))
288 hook.rm(l1ho)
289 hook.rm(l2ho)
290 hook.rm(admho)
291 misn.finish(false)
292 end