[Add] Scouting mission type.

This commit is contained in:
Allanis 2013-05-07 18:40:39 +01:00
parent 1bec93918e
commit 41e2174c64
5 changed files with 262 additions and 159 deletions

View File

@ -18,7 +18,7 @@
</avail> </avail>
</mission> </mission>
<mission name = "Empire Recruitment"> <mission name = "Empire Recruitment">
<lua>emp_empire00</lua> <lua>emp_cargo00</lua>
<flags> <flags>
<unique>1</unique> <unique>1</unique>
</flags> </flags>
@ -39,5 +39,17 @@
<alliance>Neutral</alliance> <alliance>Neutral</alliance>
</avail> </avail>
</mission> </mission>
<mission name = "Empire Scouting">
<lua>emp_scout00</lua>
<flags>
<unique>1</unique>
</flags>
<avail>
<req>es_cargo</req>
<chance>70</chance>
<location>Bar</location>
<alliance>Empire United</alliance>
</avail>
</mission>
</Missions> </Missions>

View File

@ -1,126 +1,129 @@
lang = lephisto.lang() lang = lephisto.lang()
if lang == "es" then if lang == "es" then
-- Not translated. -- Not translated atm
else -- Default English. else -- Default english
misn_desc = {} misn_desc = {}
misn_desc[1] = "%s in the %s system needs a delivery of %d tons of %s." misn_desc[1] = "%s in the %s system needs a delivery of %d tons of %s."
misn_desc[2] = "%s in the %s system needs a rush delivery of %d tons of %s before %s (%s left)." misn_desc[2] = "%s in the %s system needs a rush delivery of %d tons of %s before %s (%s left)."
misn_reward = "%d Scred." misn_reward = "%d credits"
title = {} title = {}
title[1] = "Cargo delivery to %s" title[1] = "Cargo delivery to %s"
title[2] = "Freight delivery to %s" title[2] = "Freight delivery to %s"
title[3] = "Transport to %s" title[3] = "Transport to %s"
title[4] = "Delivery to %s" title[4] = "Delivery to %s"
title[5] = "Rush Delivery to %s" title[5] = "Rush Delivery to %s"
full_title = "Ship is full" full_title = "Ship is full"
full_msg = "Your ship is too full. You need to make room for %d tons if you want to be able to accept the mission." full_msg = "Your ship is too full. You need to make room for %d more tons if you want to be able to accept the mission."
accept_title = "Mission Accepted" accept_title = "Mission Accepted"
accept_msg = "The workers load %d tons of %s onto your ship." accept_msg = "The workers load the %d tons of %s onto your ship."
toomany_title = "Too many missions" toomany_title = "Too many missions"
toomany_msg = "You have too many active missions." toomany_msg = "You have too many active missions."
finish_title = "Succesful Delivery" finish_title = "Succesful Delivery"
finish_msg = "The workers unload the %s at the docks." finish_msg = "The workers unload the %s at the docks."
miss_title = "Cargo missing" miss_title = "Cargo Missing"
miss_msg = "You are missing the %d tons of %s!" miss_msg = "You are missing the %d tons of %s!."
misn_time_msg = "MISSION FAILED: You have failed to deliver the goods on time!" misn_time_msg = "MISSION FAILED: You have failed to delivery the goods on time!"
end end
-- Create the mission. -- Create the mission
function create() function create()
-- Target destination. -- Target destination
local i = 0 local i = 0
repeat repeat
planet = space.getPlanet(misn.factions()) planet = space.getPlanet( misn.factions() )
i = i + 1 i = i + 1
until planet ~= space.landName() or i > 10 until planet ~= space.landName() or i > 10
-- Protect against inf loop. -- Infinite loop protection
if i > 10 then if i > 10 then
misn.finish(false) misn.finish(false)
end end
system = space.getSystem(planet) system = space.getSystem( planet )
misn_dist = space.jumpDist(system) misn_dist = space.jumpDist( system )
-- Missions generic. -- Mission generics
i = rnd.int(4) i = rnd.int(4)
if i < 3 then -- Cargo delivery. if i < 3 then -- Cargo delivery
misn_type = "Cargo" misn_type = "Cargo"
i = rnd.int(3) i = rnd.int(3)
misn.setTitle(string.format(title[i+1], planet)) misn.setTitle( string.format(title[i+1], planet) )
else -- Rush delivery. else -- Rush delivery
misn_type = "Rush" misn_type = "Rush"
misn.setTitle(string.format(title[5], planet)) misn.setTitle( string.format(title[5], planet) )
end end
-- More mission specifics. -- More mission specifics
carg_mass = rnd.int(10, 30) carg_mass = rnd.int( 10, 30 )
i = rnd.int(12) -- Set the goods. i = rnd.int(12) -- Set the goods
if i < 5 then if i < 5 then
carg_type = "Food" carg_type = "Food"
elseif i < 8 then elseif i < 8 then
carg_type = "Ore" carg_type = "Ore"
elseif i < 10 then elseif i < 10 then
carg_type = "Industrial Goods" carg_type = "Industrial Goods"
elseif i < 12 then elseif i < 12 then
carg_type = "Luxury Goods" carg_type = "Luxury Goods"
else else
carg_type = "Medicine" carg_type = "Medicine"
end end
if misn_type == "Cargo" then if misn_type == "Cargo" then
misn.setDesc(string.format(misn_desc[1], planet, system, carg_mass, carg_type)) misn.setDesc( string.format( misn_desc[1], planet, system, carg_mass, carg_type ) )
reward = misn_dist * carg_mass * (250+rnd.int(150)) + reward = misn_dist * carg_mass * (250+rnd.int(150)) +
carg_mass * (150+rnd.int(75)) + carg_mass * (150+rnd.int(75)) +
rnd.int(1500) rnd.int(1500)
elseif misn_type == "Rush" then elseif misn_type == "Rush" then
misn_time = time.get() + time.units(2) + misn_time = time.get() + time.units(2) +
rnd.int(time.units(2), time.units(4)) * misn_dist rnd.int(time.units(2), time.units(4)) * misn_dist
misn.setDesc(string.format(misn_desc[2], planet, system, misn.setDesc( string.format( misn_desc[2], planet, system,
carg_mass, carg_type, time.str(misn_time), carg_mass, carg_type,
time.str(misn_time), time.str(misn_time-time.get()))) time.str(misn_time), time.str(misn_time-time.get()) ) )
reward = misn_dist * carg_mass * (450+rnd.int(250)) + rnd.int(2500) reward = misn_dist * carg_mass * (450+rnd.int(250)) +
carg_mass * (250+rnd.int(125)) +
rnd.int(2500)
end end
misn.setReward( string.format( misn_reward, reward ) )
misn.setReward(string.format(misn_reward, reward))
end end
-- Mission is accepted
function accept() function accept()
if player.freeCargo() < carg_mass then if player.freeCargo() < carg_mass then
tk.msg(full_title, string.format(full_msg, carg_mass-player.freeCargo())) tk.msg( full_title, string.format( full_msg, carg_mass-player.freeCargo() ))
elseif misn.accept() then -- Able to accept the mission, hooks BREAK after accepting.
carg_id = player.addCargo(carg_type, carg_mass)
tk.msg(accept_title, string.format(accept_msg, carg_mass, carg_type))
-- Set the hooks.
hook.land("land"); -- Only hook after accepting.
if misn_type == "Rush" then -- Rush needs additional time hook.
hook.time("timeup")
end
else elseif misn.accept() then -- Able to accept the mission, hooks BREAK after accepting
tk.msg(toomany_title, toomany_msg) carg_id = player.addCargo( carg_type, carg_mass )
tk.msg( accept_title, string.format( accept_msg, carg_mass, carg_type ))
-- Set the hooks
hook.land( "land" ) -- Only hook after accepting
if misn_type == "Rush" then -- Rush needs additional time hook
hook.time( "timeup" )
end end
else
tk.msg( toomany_title, toomany_msg )
end
end end
-- Land hook
function land() function land()
if space.landName() == planet then if space.landName() == planet then
if player.rmCargo(carg_id) then if player.rmCargo( carg_id ) then
player.pay(reward) player.pay( reward )
tk.msg(finish_title, string.format(finish_msg, carg_type)) tk.msg( finish_title, string.format( finish_msg, carg_type ))
misn_finish(true) misn.finish(true)
else else
tk.msg(miss_title, string.format(miss_msg, carg_mass, carg_type)) tk.msg( miss_title, string.format( miss_msg, carg_mass, carg_type ))
end end
end end
end end
-- Time hook. -- Time hook
function timeup() function timeup()
if time.get() > misn_time then if time.get() > misn_time then
player.msg(misn_time_msg) player.msg( misn_time_msg )
misn.finish(false) misn.finish(false)
end end
misn_setDesc(string.format(main_desc[2], planet, system, misn.setDesc( string.format( misn_desc[2], planet, system,
carg_mass, carg_type, carg_mass, carg_type,
time.str(misn_time), time.str(misn_time.get()))) time.str(misn_time), time.str(misn_time-time.get()) ) )
end end

View File

@ -1,40 +1,42 @@
lang = lephisto.lang() lang = lephisto.lang()
if lang == "es" then if lang == "es" then
-- Not translated. -- Not translated atm
else -- Default English. else -- Default english
misn_title = "Empire Recruitment" misn_title = "Empire Recruitment"
misn_reward = "%d Scred" misn_reward = "%d credits"
misn_desc = "Deliver some parcels for the Empire to %s." misn_desc = "Deliver some parcels for the Empire to %s."
title = {} title = {}
title[1] = "Spaceport Bar" title[1] = "Spaceport Bar"
title[2] = "Empire Recruitment" title[2] = "Empire Recruitment"
title[3] = "Mission Accomplished" title[3] = "Mission Accomplished"
text = {} text = {}
text[1] = [[As you enter the bar you can't help but notice that a fellow at a table has been looking at you since you came in. You tend to your business as if you hadn't noticed. A while later you feel a tap on your shoulder and see it's the same man.]] text[1] = [[As you enter the bar you can't help to notice that a fellow at a table is looking at you since you came in. You tend to your business as if you hadn't noticed. A while later you feel a tap on your shoulder and see it's the same fellow.]]
text[2] = [["Hello, sorry to interupt you. I'm lieutenant Tamrit from the empire Armada, shipping division. We're having another recruitment operation and would be interested in having another pilot among us. Would you be interested in working for the Empire?"]] text[2] = [["Hello, sorry about interrupting you. I'm Lieutenant medek from the Empire Armada Shipping Division. We're having another recruitment operation and would be interested in having another pilot among us. Would be interesting in working for the Empire?"]]
text[3] = [["Welcome aboard.", says Tamrit before giving you a firm handshake. "At first you'll be tested with cargo missions while we get data on your flying skills. Later you could get called for more important missions. Who knows? You could be the next Medek, greatest pilot we ever had on the Armada." text[3] = [["Welcome aboard.", says medek before giving you a firm handshake. "At first you'll just be tested with cargo missions while we get data on your flying skills. Later you could get called for more important mission. Who knows? You could be the next dfighter, greatest pilot we ever had on the armada."
He hits a couple buttons on his wrist computer that springs into action. He hits a couple buttons on his wrist computer that springs into action.
"It looks like we already have a simple task for you. Deliver these parcels to %s. The best pilots started out delivering papers and ended up flying into combat against large warships in the interception division."]] "It looks like we already have a simple task for you. Deliver these parcels to %s. The best pilots started delivering papers and ended up flying into combat against gigantic warships with the Interception Division."]]
text[4] = [["You deliver the parcels to the Empire station at the %s spaceport. Afterwards they make you do some paperwork to formalize your participation with the Empire. You aren't too sure of your encounter with the Empire, only time will tell.]] text[4] = [[You deliver the parcels to the Empire Shipping station at the %s spaceport. Afterwards they make you do some paperwork to formalize your participation with the Empire. They tell you to keep an eye out for missions labeled ES in the mission computer which stand for Empire Shipping which you now have access to.
You aren't too sure of what to make of your encounter with the Empire, only time will tell...]]
end end
function create() function create()
-- Intro message. -- Intro text
tk.msg(title[1], text[2]) tk.msg( title[1], text[1] )
if tk.yesno(title[1], text[2]) then if tk.yesno( title[1], text[2] )
misn.accept() then
misn.accept()
dest = space.getPlanet("Empire");
dest = space.getPlanet("Empire");
-- Mission details. -- Mission details
reward = 3000 reward = 3000
misn.setTitle(misn_title) misn.setTitle(misn_title)
misn.setReward(string.format(misn_reward, reward)) misn.setReward( string.format(misn_reward, reward) )
misn.setDesc(string.format(misn_desc, dest)) misn.setDesc( string.format(misn_desc,dest))
tk.msg(title[2], string.format(text[3], dest))
-- Set up the goal. -- Flavour text and mini-briefing
tk.msg( title[2], string.format( text[3], dest ))
-- Set up the goal
parcels = player.addCargo("Parcels", 0) parcels = player.addCargo("Parcels", 0)
hook.land("land") hook.land("land")
end end
@ -44,8 +46,9 @@ function land()
if space.landName() == dest then if space.landName() == dest then
if player.rmCargo(parcels) then if player.rmCargo(parcels) then
player.pay(reward) player.pay(reward)
-- More flavour text :) -- More flavour text
tk.msg(title[3], string.format(text[4], dest)) tk.msg(title[3], string.format( text[4], dest ))
var.push("es_cargo", true)
misn.finish(true) misn.finish(true)
end end
end end

View File

@ -0,0 +1,84 @@
lang = lephisto.lang()
if lang == "es" then
-- Not translated atm
else -- Default english
misn_title = "Collective Scout"
misn_reward = ""
misn_desc = {}
misn_desc[1] = "Find a scout near %s."
misn_desc[2] = "Travel back to %s in %s."
title = {}
title[1] = "Empire Officer"
title[2] = "Briefing"
title[3] = "Mission Accomplished"
text = {}
text[1] = [[As you enter the bar you notice some one signal to you from the counter. You notice he's wearing an Empire insignia on his uniform.
"Hello %s, we have a reconnaissance you might be interested. You up for the challenge?"]]
text[2] = [["I don't think we've met. I'm Sargent Dimitri. If all goes well you'll be reporting to me for the next assignments."
"This week Collective activity has increased heavily around NCG-7291. We've been trying to contain them, but reports detect that a scout broke through. The scout was last detected near %s. We expect it to not have gone far. You are to locate the scout and report back to %s in the %s system. It seems like the Collective is planning something and we want to follow their game a bit more"
"It is of vital important that you do not engage the drone. Report back as soon as you locate it."]]
text[3] = [[After landing you head to the Empire military headquarters and find Sgt. Dimitri there.
"Well it seems like the drone has some strange fixation with %s. We aren't quite sure what to make of it, but intelligence is on it. Report back at the bar in bit and we'll see what we can do about the Collective"]]
msg_killdrone = "MISSION FAILED: You weren't supposed to kill the drone!"
end
function create()
-- Intro text
if tk.yesno( title[1], string.format(text[1], player.name()) )
then
misn.accept()
misn_stage = 0
misn_nearby = "Coriolis"
misn_target = "Dune"
misn_base = "Omega Station"
misn_base_sys = "NCG-7291"
-- Mission details
misn.setTitle(misn_title)
misn.setReward( misn_reward )
misn.setDesc( string.format(misn_desc[1],misn_nearby))
-- Flavour text and mini-briefing
tk.msg( title[2], string.format( text[2], misn_nearby, misn_base, misn_base_sys ))
hook.enter("enter")
hook.land("land")
end
end
function enter()
sys = space.system()
-- Additional fleets
if sys == "NCG-7291" then -- Increase action for realism
pilot.add("Empire Sml Defense")
pilot.add("Collective Sml Swarm")
elseif sys == misn_target then
p = pilot.add("Collective Drone")
for k,v in pairs(p) do
hook.pilotDeath( v, "kill")
end
end
-- update mission
if misn_stage == 0 and sys == misn_target then
misn.setDesc( string.format(misn_desc[2],misn_base,misn_base_sys) )
misn_stage = 1
end
end
function land()
planet = space.landName()
if misn_stage == 1 and planet == misn_base then
tk.msg( title[3], string.format(text[3],misn_target) )
misn.finish(true)
end
end
function kill()
player.msg( msg_killdrone )
misn.finish(false)
end

View File

@ -1,115 +1,116 @@
lang = lephisto.lang() lang = lephisto.lang()
if lang == "es" then if lang == "es" then
-- Not translated yet. -- Not translated atm
else -- Default English. else -- Default english
misn_desc = "The Empire needs to ship %d tons of %s to %s in the %s system by %s (%s left)." misn_desc = "The Empire needs to ship %d tons of %s to %s in the %s system by %s (%s left)."
misn_reward = "%d Scred" misn_reward = "%d credits"
title = {} title = {}
title[1] = "ES: Ship to %s" title[1] = "ES: Ship to %s"
title[2] = "ES: Delivery to %s" title[2] = "ES: Delivery to %s"
full_title = "Ship is full" full_title = "Ship is full"
full_msg = "Your ship is too full. You need to make room for %d more tons if you want to be able to accept the mission." full_msg = "Your ship is too full. You need to make room for %d more tons if you want to be able to accept the mission."
accept_title = "Mission Accepted" accept_title = "Mission Accepted"
accept_msg = "The Empire workers load %d tons of %s onto your ship." accept_msg = "The Empire workers load the %d tons of %s onto your ship."
toomany_title = "Too many missions" toomany_title = "Too many missions"
toomany_msg = "You have too many active missions." toomany_msg = "You have too many active missions."
finish_title = "Succesful Delivery" finish_title = "Succesful Delivery"
finish_msg = "The Empire workers unload the %s at the docks." finish_msg = "The Empire workers unload the %s at the docks."
miss_title = "Cargo Missing" miss_title = "Cargo Missing"
miss_msg = "You are missing the %d tons of %s!" miss_msg = "You are missing the %d tons of %s!."
miss_timeup = "MISSION FAILED: You have failed to deliver the goods to the empire on time!" miss_timeup = "MISSION FAILED: You have failed to deliver the goods to the Empire on time!"
end end
-- Empire shipping missions are always timed, but quite lax on the schedules. -- Empire shipping missions are always timed, but quite lax on the schedules
-- Pays a bit more then rush missiosn. -- pays a bit more then the rush missions
-- Create the mission. -- Create the mission
function create() function create()
-- Target destination. -- Target destination
local i = 0 local i = 0
repeat repeat
planet = space.getPlanet(misn.factions()) planet = space.getPlanet( misn.factions() )
i = i + 1 i = i + 1
until planet ~= space.landName() or i > 10 until planet ~= space.landName() or i > 10
-- Infinite loop protection
-- Protect against inf loop.
if i > 10 then if i > 10 then
misn.finish(false) misn.finish(false)
end end
system = space.getSystem(planet) system = space.getSystem( planet )
misn_dist = space.jumpDist(system) misn_dist = space.jumpDist(system)
-- Mission generics. -- Mission generics
misn_type = "Cargo" misn_type = "Cargo"
i = rnd.int(1) i = rnd.int(1)
misn.setTitle(string.format(title[i+1], planet)) misn.setTitle( string.format(title[i+1], planet) )
-- More mission specifics. -- More mission specifics
carg_mass = rnd.int(10, 30) carg_mass = rnd.int( 10, 30 )
i = rnd.int(12) i = rnd.int(12)
if i < 5 then if i < 5 then
carg_type = "Food" carg_type = "Food"
elseif i < 8 then elseif i < 8 then
carg_type = "Ore" carg_type = "Ore"
elseif i < 10 then elseif i < 10 then
carg_type = "Industrial Goods" carg_type = "Industrial Goods"
elseif i < 12 then elseif i < 12 then
carg_type = "Luxury Goods" carg_type = "Luxury Goods"
else else
carg_type = "Medicine" carg_type = "Medicine"
end end
misn_time = time.get() + time.units(5) + misn_time = time.get() + time.units(5) +
rnd.int(time.units(5), time.units(8)) * misn_dist rnd.int(time.units(5), time.units(8)) * misn_dist
misn.setDesc(string.format(misn_desc, carg_mass, carg_type, planet, system, misn.setDesc( string.format( misn_desc, carg_mass, carg_type, planet, system,
time.str(misn_time), time.str(misn_time-time.get()))) time.str(misn_time), time.str(misn_time-time.get())) )
reward = misn_dist * carg_mass * (500+rnd.int(250)) + reward = misn_dist * carg_mass * (500+rnd.int(250)) +
carg_mass * (250+rnd.int(150)) + carg_mass * (250+rnd.int(150)) +
rnd.int(2500) rnd.int(2500)
misn.setReward(string.format(misn_reward, reward)) misn.setReward( string.format( misn_reward, reward ) )
end end
-- Mission is accepted. -- Mission is accepted
function accept() function accept()
if player.freeCargo() < carg_mass then if player.freeCargo() < carg_mass then
tk.msg(full_title, string.format(full_msg, carg_mass-player.freeCargo())) tk.msg( full_title, string.format( full_msg, carg_mass-player.freeCargo() ))
elseif misn.accept() then -- Able to accept the mission, hoos BREAK after accepting. elseif misn.accept() then -- Able to accept the mission, hooks BREAK after accepting
tk.msg(accept_title, string.format(accept_msg, carg_mass, carg_type)) carg_id = player.addCargo( carg_type, carg_mass )
hook.lnad("land") -- Only hook after accepting. tk.msg( accept_title, string.format( accept_msg, carg_mass, carg_type ))
hook.time("timeup") hook.land( "land" ) -- Only hook after accepting
hook.time( "timeup" )
else else
tk.msg(toomany_title, toomany_msg) tk.msg( toomany_title, toomany_msg )
end end
end end
-- Land hook. -- Land hook
function land() function land()
if space.landName() == planet then if space.landName() == planet then
if player.rmCargo(carg_id) then if player.rmCargo( carg_id ) then
player.pay(reward) player.pay( reward )
tk.msg(finish_title, string.format(finish_msg, carg_type)) tk.msg( finish_title, string.format( finish_msg, carg_type ))
-- Increase empire shipping mission counter. -- Increase empire shipping mission counter
n = var.peek("es_misn") n = var.peek("es_misn")
if n ~= nil then if n ~= nil then
var_push("es_misn", n+1) var.push("es_misn", n+1)
else else
var.push("es_misn", 1) var.push("es_misn", 1)
end end
misn.finish(true) misn.finish(true)
else else
tk.msg(miss_title, string.format(miss_msg, carg_mass, carg_type)) tk.msg( miss_title, string.format( miss_msg, carg_mass, carg_type ))
end end
end end
end end
-- Time hook. -- Time hook
function timeup() function timeup()
if time.get() > misn_time then if time.get() > misn_time then
player.msg(miss_timeup) player.msg( miss_timeup )
misn.finish(false) misn.finish(false)
end end
misn.setDesc(string.format(misn_desc, carg_mass, carg_type, planet, system, misn.setDesc( string.format( misn_desc, carg_mass, carg_type, planet, system,
time.str(misn_time), time.str(misn_time-time.get()))) time.str(misn_time), time.str(misn_time-time.get())) )
end end