| 1 |
--[[ |
| 2 |
<?xml version='1.0' encoding='utf8'?> |
| 3 |
<mission name="The one with the Visit"> |
| 4 |
<flags> |
| 5 |
<unique /> |
| 6 |
</flags> |
| 7 |
<avail> |
| 8 |
<priority>4</priority> |
| 9 |
<done>The one with the Shopping</done> |
| 10 |
<chance>100</chance> |
| 11 |
<location>Bar</location> |
| 12 |
<planet>Gastan</planet> |
| 13 |
</avail> |
| 14 |
</mission> |
| 15 |
--]] |
| 16 |
--[[ |
| 17 |
-- |
| 18 |
-- MISSION: The one with the Visit |
| 19 |
-- DESCRIPTION: Dr. Geller asks you to disable a Soromid ship to retrieve some technology |
| 20 |
-- that he needs for his prototype. Za'lek science can obviously not fall behind Soromid. |
| 21 |
-- Obviously Soromid will not like this and will try to attack the player. |
| 22 |
-- |
| 23 |
-- Difficulty: Easy to Medium? |
| 24 |
-- |
| 25 |
-- Author: fart but based on Mission Ideas in wiki: wiki.naev.org/wiki/Mission_Ideas |
| 26 |
--]] |
| 27 |
|
| 28 |
require "missions/zalek/common.lua" |
| 29 |
|
| 30 |
|
| 31 |
-- mission variables |
| 32 |
t_sys = {} |
| 33 |
t_pla = {} |
| 34 |
t_pla[1] = "Gastan" |
| 35 |
t_sys[1] = "Seiben" |
| 36 |
t_sys[2] = "Shikima" |
| 37 |
reward = 1000000 |
| 38 |
shpnm = _("Tokera") |
| 39 |
-- Mission details |
| 40 |
title = {} |
| 41 |
text = {} |
| 42 |
osd_msg = {} |
| 43 |
misn_title = _("The one with the Visit") |
| 44 |
misn_reward = _("The gratitude of science and a bit of compensation") |
| 45 |
misn_desc = _("You've been hired by Dr. Geller to retrieve technology he urgently needs to build his prototype.") |
| 46 |
bar_desc = _("You see Dr. Geller waving you over. Apparently he has another job for you.") |
| 47 |
|
| 48 |
|
| 49 |
title[1] = _([[In the bar]]) |
| 50 |
text[1] = _([["Ah, there you are! I've got a job for you. Specifically, some... acquisition... of technology from the Soromid, who haven't been very cooperative. Are you up for it?" It sounds like he wants you to do something that would get you in trouble with Soromid authorities. Do you accept the job?]]) |
| 51 |
text[2] = _([["Excellent. From what I have been told it looks like this." He gestures with his hands to no merit. "You will recognize it; it should be in a box that's kept separately from the remaining stuff and labeled "Top Secret". Oh, and you might need this." He hands you a handheld device. "The ship is called the %s." |
| 52 |
So he wants you to steal something top secret from the Soromid. Quirky people, those Za'leks. With the coordinates, the signature of the target ship and the handheld, which you hope helps you detect the box, you set off on your way.]]) |
| 53 |
-- msgs by Soromid forces |
| 54 |
title[3] = _([[In the ship]]) |
| 55 |
text[4] = _([[You make your way through the living ship after taking care of its crew. You note the feeling that the ship is personally angry at you which, given the rumors that Soromid ships are alive, gives you the creeps. In any case, you begin to search through the ship and the handheld in your pocket starts beeping. |
| 56 |
You manage to locate a box on a table in the crew's chambers. Apparently nobody expected anyone to be foolish enough to try to do what you are doing. You grab the box and head back to your ship.]]) |
| 57 |
|
| 58 |
text[5] = _([["How'd it go?" asks Dr. Geller. You show him the box. "Ah, marvelous! Do you know what this is? This is a quantum sharpener. It's like a quantum eraser, but it does not erase but sharpen. This is exactly what I needed. I think with this I should be able to finish my prototype." He tosses you a credit chip before walking off, smiling.]]) |
| 59 |
-- if the player kills the ship before getting the tech |
| 60 |
title[4] = _([[What have you done?]]) |
| 61 |
text[6] = _([[The ship explodes before your eyes and you realize that you will never be able to get the secret tech now.]]) |
| 62 |
OSDtitle = _("The one with the Visit") |
| 63 |
osd_msg = {} |
| 64 |
osd_msg[1] = _("Go to the %s system and find the %s") |
| 65 |
osd_msg[2] = _("Board the %s and retrieve the secret technology") |
| 66 |
osd_msg[3] = _("Return to %s in the %s system") |
| 67 |
|
| 68 |
-- refuestext |
| 69 |
refusetitle = _("No Science Today") |
| 70 |
refusetext = _("But I really thought you were into science...") |
| 71 |
|
| 72 |
log_text = _([[You stole something called a "quantum sharpener" from a Soromid ship for Dr. Geller.]]) |
| 73 |
|
| 74 |
|
| 75 |
function create () |
| 76 |
-- Spaceport bar stuff |
| 77 |
misn.setNPC( _("Dr. Geller"), "zalek/unique/geller") |
| 78 |
misn.setDesc( bar_desc ) |
| 79 |
end |
| 80 |
function accept() |
| 81 |
-- Mission details: |
| 82 |
if not tk.yesno( title[1], text[1] ) then |
| 83 |
tk.msg(refusetitle, refusetext) |
| 84 |
misn.finish() |
| 85 |
end |
| 86 |
tk.msg( title[1], text[2]:format(shpnm) ) |
| 87 |
misn.accept() |
| 88 |
misn.osdCreate(misn_title, {osd_msg[1]:format(t_sys[2],shpnm),osd_msg[2]:format(shpnm),osd_msg[3]:format(t_pla[1],t_sys[1])}) |
| 89 |
misn.setDesc(misn_desc) |
| 90 |
misn.setTitle(misn_title) |
| 91 |
misn.setReward(misn_reward) |
| 92 |
misn.osdActive(1) |
| 93 |
misn_mark = misn.markerAdd( system.get(t_sys[2]), "high" ) |
| 94 |
targetalive = true |
| 95 |
hook.enter("sys_enter") |
| 96 |
end |
| 97 |
|
| 98 |
|
| 99 |
function sys_enter () |
| 100 |
if system.cur() == system.get(t_sys[2]) and targetalive then |
| 101 |
dist = rnd.rnd() * system.cur():radius() *1/2 |
| 102 |
angle = rnd.rnd() * 2 * math.pi |
| 103 |
location = vec2.new(dist * math.cos(angle), dist * math.sin(angle)) -- Randomly spawn the Ship in the system |
| 104 |
target = pilot.add("Soromid Odium", nil, location)[1] |
| 105 |
target:control() |
| 106 |
target:rename(shpnm) |
| 107 |
target:setFaction("Soromid") |
| 108 |
target:memory().aggressive = true |
| 109 |
target:setHilight(true) |
| 110 |
target:setVisplayer(true) |
| 111 |
hidle = hook.pilot(target, "idle", "targetIdle") |
| 112 |
hexp = hook.pilot(target, "exploded", "targetExploded") |
| 113 |
hboard = hook.pilot(target, "board", "targetBoard") |
| 114 |
targetIdle() |
| 115 |
end |
| 116 |
end |
| 117 |
|
| 118 |
function targetIdle() |
| 119 |
if not pilot.exists(target) then -- Tear down now-useless hooks. |
| 120 |
hook.rm(hidle) |
| 121 |
return |
| 122 |
end |
| 123 |
if target:hostile() then |
| 124 |
hook.rm(hidle) |
| 125 |
target:control(false) |
| 126 |
return |
| 127 |
end |
| 128 |
location = target:pos() |
| 129 |
dist = 750 |
| 130 |
angle = rnd.rnd() * 2 * math.pi |
| 131 |
newlocation = vec2.new(dist * math.cos(angle), dist * math.sin(angle)) -- New location is 750px away in a random direction |
| 132 |
target:taskClear() |
| 133 |
target:goto(location + newlocation, false, false) |
| 134 |
hook.timer(5000, "targetIdle") |
| 135 |
end |
| 136 |
|
| 137 |
function targetExploded() |
| 138 |
hook.timer( 2000, "targetDeath" ) |
| 139 |
end |
| 140 |
|
| 141 |
function targetDeath() |
| 142 |
sor= faction.get("Soromid") |
| 143 |
hook.rm(hexp) |
| 144 |
if boarded then |
| 145 |
sor.modPlayer(-5) |
| 146 |
return |
| 147 |
end |
| 148 |
tk.msg(title[4],text[6]) |
| 149 |
sor.modPlayer(-5) |
| 150 |
misn.finish(false) |
| 151 |
end |
| 152 |
|
| 153 |
function targetBoard() |
| 154 |
player.unboard() |
| 155 |
tk.msg(title[3], text[4]) |
| 156 |
target:setHilight(false) |
| 157 |
target:setVisplayer(false) |
| 158 |
cargoID = misn.cargoAdd("Secret Technology",0) |
| 159 |
misn.osdActive(3) |
| 160 |
misn.markerRm(misn_mark) |
| 161 |
misn_mark = misn.markerAdd( system.get(t_sys[1]), "high" ) |
| 162 |
hland = hook.land("land") |
| 163 |
boarded = true |
| 164 |
hook.rm(hboard) |
| 165 |
end |
| 166 |
|
| 167 |
function land() |
| 168 |
if planet.cur() == planet.get(t_pla[1]) then |
| 169 |
tk.msg(title[1], text[5]) |
| 170 |
hook.rm(hland) |
| 171 |
misn.markerRm(misn_mark) |
| 172 |
player.pay(reward) |
| 173 |
zlk_addSciWrongLog( log_text ) |
| 174 |
misn.finish(true) |
| 175 |
end |
| 176 |
end |
| 177 |
|
| 178 |
function abort () |
| 179 |
if target then |
| 180 |
target:setHilight(false) |
| 181 |
target:setVisplayer(false) |
| 182 |
end |
| 183 |
misn.finish(false) |
| 184 |
end |