[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>
</mission>
<mission name = "Empire Recruitment">
<lua>emp_empire00</lua>
<lua>emp_cargo00</lua>
<flags>
<unique>1</unique>
</flags>
@ -39,5 +39,17 @@
<alliance>Neutral</alliance>
</avail>
</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>

View File

@ -1,11 +1,11 @@
lang = lephisto.lang()
if lang == "es" then
-- Not translated.
else -- Default English.
-- Not translated atm
else -- Default english
misn_desc = {}
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_reward = "%d Scred."
misn_reward = "%d credits"
title = {}
title[1] = "Cargo delivery to %s"
title[2] = "Freight delivery to %s"
@ -13,47 +13,47 @@ else -- Default English.
title[4] = "Delivery to %s"
title[5] = "Rush Delivery to %s"
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_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_msg = "You have too many active missions."
finish_title = "Succesful Delivery"
finish_msg = "The workers unload the %s at the docks."
miss_title = "Cargo missing"
miss_msg = "You are missing the %d tons of %s!"
misn_time_msg = "MISSION FAILED: You have failed to deliver the goods on time!"
miss_title = "Cargo Missing"
miss_msg = "You are missing the %d tons of %s!."
misn_time_msg = "MISSION FAILED: You have failed to delivery the goods on time!"
end
-- Create the mission.
-- Create the mission
function create()
-- Target destination.
-- Target destination
local i = 0
repeat
planet = space.getPlanet(misn.factions())
planet = space.getPlanet( misn.factions() )
i = i + 1
until planet ~= space.landName() or i > 10
-- Protect against inf loop.
-- Infinite loop protection
if i > 10 then
misn.finish(false)
end
system = space.getSystem(planet)
misn_dist = space.jumpDist(system)
system = space.getSystem( planet )
misn_dist = space.jumpDist( system )
-- Missions generic.
-- Mission generics
i = rnd.int(4)
if i < 3 then -- Cargo delivery.
if i < 3 then -- Cargo delivery
misn_type = "Cargo"
i = rnd.int(3)
misn.setTitle(string.format(title[i+1], planet))
else -- Rush delivery.
misn.setTitle( string.format(title[i+1], planet) )
else -- Rush delivery
misn_type = "Rush"
misn.setTitle(string.format(title[5], planet))
misn.setTitle( string.format(title[5], planet) )
end
-- More mission specifics.
carg_mass = rnd.int(10, 30)
i = rnd.int(12) -- Set the goods.
-- More mission specifics
carg_mass = rnd.int( 10, 30 )
i = rnd.int(12) -- Set the goods
if i < 5 then
carg_type = "Food"
elseif i < 8 then
@ -67,60 +67,63 @@ function create()
end
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)) +
carg_mass * (150+rnd.int(75)) +
rnd.int(1500)
elseif misn_type == "Rush" then
misn_time = time.get() + time.units(2) +
rnd.int(time.units(2), time.units(4)) * misn_dist
misn.setDesc(string.format(misn_desc[2], planet, system,
carg_mass, carg_type, time.str(misn_time),
time.str(misn_time), time.str(misn_time-time.get())))
reward = misn_dist * carg_mass * (450+rnd.int(250)) + rnd.int(2500)
misn.setDesc( string.format( misn_desc[2], planet, system,
carg_mass, carg_type,
time.str(misn_time), time.str(misn_time-time.get()) ) )
reward = misn_dist * carg_mass * (450+rnd.int(250)) +
carg_mass * (250+rnd.int(125)) +
rnd.int(2500)
end
misn.setReward(string.format(misn_reward, reward))
misn.setReward( string.format( misn_reward, reward ) )
end
-- Mission is accepted
function accept()
if player.freeCargo() < carg_mass then
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))
tk.msg( full_title, string.format( full_msg, carg_mass-player.freeCargo() ))
-- Set the hooks.
hook.land("land"); -- Only hook after accepting.
if misn_type == "Rush" then -- Rush needs additional time hook.
hook.time("timeup")
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
tk.msg(toomany_title, toomany_msg)
tk.msg( toomany_title, toomany_msg )
end
end
-- Land hook
function land()
if space.landName() == planet then
if player.rmCargo(carg_id) then
player.pay(reward)
tk.msg(finish_title, string.format(finish_msg, carg_type))
misn_finish(true)
if player.rmCargo( carg_id ) then
player.pay( reward )
tk.msg( finish_title, string.format( finish_msg, carg_type ))
misn.finish(true)
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
-- Time hook.
-- Time hook
function timeup()
if time.get() > misn_time then
player.msg(misn_time_msg)
player.msg( misn_time_msg )
misn.finish(false)
end
misn_setDesc(string.format(main_desc[2], planet, system,
misn.setDesc( string.format( misn_desc[2], planet, system,
carg_mass, carg_type,
time.str(misn_time), time.str(misn_time.get())))
time.str(misn_time), time.str(misn_time-time.get()) ) )
end

View File

@ -1,40 +1,42 @@
lang = lephisto.lang()
if lang == "es" then
-- Not translated.
else -- Default English.
-- Not translated atm
else -- Default english
misn_title = "Empire Recruitment"
misn_reward = "%d Scred"
misn_reward = "%d credits"
misn_desc = "Deliver some parcels for the Empire to %s."
title = {}
title[1] = "Spaceport Bar"
title[2] = "Empire Recruitment"
title[3] = "Mission Accomplished"
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[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[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."
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."]]
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[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 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 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.
"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 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
function create()
-- Intro message.
tk.msg(title[1], text[2])
if tk.yesno(title[1], text[2]) then
-- Intro text
tk.msg( title[1], text[1] )
if tk.yesno( title[1], text[2] )
then
misn.accept()
dest = space.getPlanet("Empire");
-- Mission details.
-- Mission details
reward = 3000
misn.setTitle(misn_title)
misn.setReward(string.format(misn_reward, reward))
misn.setDesc(string.format(misn_desc, dest))
misn.setReward( string.format(misn_reward, reward) )
misn.setDesc( string.format(misn_desc,dest))
tk.msg(title[2], string.format(text[3], dest))
-- Flavour text and mini-briefing
tk.msg( title[2], string.format( text[3], dest ))
-- Set up the goal.
-- Set up the goal
parcels = player.addCargo("Parcels", 0)
hook.land("land")
end
@ -44,8 +46,9 @@ function land()
if space.landName() == dest then
if player.rmCargo(parcels) then
player.pay(reward)
-- More flavour text :)
tk.msg(title[3], string.format(text[4], dest))
-- More flavour text
tk.msg(title[3], string.format( text[4], dest ))
var.push("es_cargo", true)
misn.finish(true)
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,51 +1,50 @@
lang = lephisto.lang()
if lang == "es" then
-- Not translated yet.
else -- Default English.
-- Not translated atm
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_reward = "%d Scred"
misn_reward = "%d credits"
title = {}
title[1] = "ES: Ship to %s"
title[2] = "ES: Delivery to %s"
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."
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_msg = "You have too many active missions."
finish_title = "Succesful Delivery"
finish_msg = "The Empire workers unload the %s at the docks."
miss_title = "Cargo Missing"
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_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!"
end
-- Empire shipping missions are always timed, but quite lax on the schedules.
-- Pays a bit more then rush missiosn.
-- Empire shipping missions are always timed, but quite lax on the schedules
-- pays a bit more then the rush missions
-- Create the mission.
-- Create the mission
function create()
-- Target destination.
-- Target destination
local i = 0
repeat
planet = space.getPlanet(misn.factions())
planet = space.getPlanet( misn.factions() )
i = i + 1
until planet ~= space.landName() or i > 10
-- Protect against inf loop.
-- Infinite loop protection
if i > 10 then
misn.finish(false)
end
system = space.getSystem(planet)
system = space.getSystem( planet )
misn_dist = space.jumpDist(system)
-- Mission generics.
-- Mission generics
misn_type = "Cargo"
i = rnd.int(1)
misn.setTitle(string.format(title[i+1], planet))
misn.setTitle( string.format(title[i+1], planet) )
-- More mission specifics.
carg_mass = rnd.int(10, 30)
-- More mission specifics
carg_mass = rnd.int( 10, 30 )
i = rnd.int(12)
if i < 5 then
carg_type = "Food"
@ -61,55 +60,57 @@ function create()
misn_time = time.get() + time.units(5) +
rnd.int(time.units(5), time.units(8)) * misn_dist
misn.setDesc(string.format(misn_desc, carg_mass, carg_type, planet, system,
time.str(misn_time), time.str(misn_time-time.get())))
misn.setDesc( string.format( misn_desc, carg_mass, carg_type, planet, system,
time.str(misn_time), time.str(misn_time-time.get())) )
reward = misn_dist * carg_mass * (500+rnd.int(250)) +
carg_mass * (250+rnd.int(150)) +
rnd.int(2500)
misn.setReward(string.format(misn_reward, reward))
misn.setReward( string.format( misn_reward, reward ) )
end
-- Mission is accepted.
-- Mission is accepted
function accept()
if player.freeCargo() < carg_mass then
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.
tk.msg(accept_title, string.format(accept_msg, carg_mass, carg_type))
hook.lnad("land") -- Only hook after accepting.
hook.time("timeup")
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 ))
hook.land( "land" ) -- Only hook after accepting
hook.time( "timeup" )
else
tk.msg(toomany_title, toomany_msg)
tk.msg( toomany_title, toomany_msg )
end
end
-- Land hook.
-- Land hook
function land()
if space.landName() == planet then
if player.rmCargo(carg_id) then
player.pay(reward)
tk.msg(finish_title, string.format(finish_msg, carg_type))
if player.rmCargo( carg_id ) then
player.pay( reward )
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")
if n ~= nil then
var_push("es_misn", n+1)
var.push("es_misn", n+1)
else
var.push("es_misn", 1)
end
misn.finish(true)
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
-- Time hook.
-- Time hook
function timeup()
if time.get() > misn_time then
player.msg(miss_timeup)
player.msg( miss_timeup )
misn.finish(false)
end
misn.setDesc(string.format(misn_desc, carg_mass, carg_type, planet, system,
time.str(misn_time), time.str(misn_time-time.get())))
misn.setDesc( string.format( misn_desc, carg_mass, carg_type, planet, system,
time.str(misn_time), time.str(misn_time-time.get())) )
end