[Add] Empire Cargo missions are now always timed.

This commit is contained in:
Allanis 2013-05-05 13:16:47 +01:00
parent 8e1745bd7a
commit e2bab9f22b
2 changed files with 37 additions and 19 deletions

View File

@ -22,6 +22,7 @@ else -- Default English.
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 = "You have failed to deliver the goods on time!"
end end
-- Create the mission. -- Create the mission.
@ -76,7 +77,7 @@ function create()
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.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(3500) reward = misn_dist * carg_mass * (450+rnd.int(250)) + rnd.int(2500)
end end
misn.setReward(string.format(misn_reward, reward)) misn.setReward(string.format(misn_reward, reward))
@ -114,12 +115,12 @@ end
-- Time hook. -- Time hook.
function timeup() function timeup()
misn.setDesc(string.format(misn_desc[2], planet, system,
carg_mass, carg_type,
time.str(misn_time), time.str(misn_time-time.get())))
if time.get() > misn_time then if time.get() > misn_time then
player.msg("You have failed to deliver the goods on time!") player.msg(misn_time_msg)
misn.finish(false) misn.finish(false)
end end
misn_setDesc(string.format(main_desc[2], planet, system,
carg_mass, carg_type,
time.str(misn_time), time.str(misn_time.get())))
end end

View File

@ -2,23 +2,27 @@ lang = lephisto.lang()
if lang == "es" then if lang == "es" then
-- Not translated yet. -- Not translated yet.
else -- Default English. else -- Default English.
misn_desc = "The Empire needs to ship %d tons of %s to %s in the %s system." 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 Scred"
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 %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 = "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.
-- Pays a bit more then rush missiosn.
-- Create the mission. -- Create the mission.
function create() function create()
-- Target destination. -- Target destination.
@ -55,7 +59,10 @@ function create()
carg_type = "Medicine" carg_type = "Medicine"
end end
misn.setDesc(string.format(misn_desc, carg_mass, carg_type, planet, system)) 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())))
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)
@ -69,6 +76,7 @@ function accept()
elseif misn.accept() then -- Able to accept the mission, hoos BREAK after accepting. 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)) tk.msg(accept_title, string.format(accept_msg, carg_mass, carg_type))
hook.lnad("land") -- Only hook after accepting. hook.lnad("land") -- Only hook after accepting.
hook.time("timeup")
else else
tk.msg(toomany_title, toomany_msg) tk.msg(toomany_title, toomany_msg)
end end
@ -96,3 +104,12 @@ function land()
end end
end end
-- Time hook.
function timeup()
if time.get() > misn_time then
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())))
end