[Add] Fourth mission in tutorial campaign. Also fixed a few bugs preventing campaign form working.
This commit is contained in:
parent
a3009760b6
commit
ad12c52cd0
@ -57,6 +57,7 @@ function land()
|
||||
if misn_stage == 0 and planet == misn_target then
|
||||
tk.msg(title[1], string.format(text[4], misn_target:name()))
|
||||
misn_stage = 1
|
||||
misn.setDesc(string.format(misn_desc[1], misn_base:name(), misn_base_sys:name()))
|
||||
misn.setMarker(misn_base_sys)
|
||||
|
||||
-- Return bit.
|
||||
|
90
dat/missions/emp_collective03.lua
Normal file
90
dat/missions/emp_collective03.lua
Normal file
@ -0,0 +1,90 @@
|
||||
-- [[
|
||||
-- Collective Espionage III
|
||||
--
|
||||
-- Fourth mission in the collective mini campaign.
|
||||
--
|
||||
-- You must distract the collective forces by breaching into their systems
|
||||
-- while a commando lands to monitor wireless.
|
||||
-- ]]
|
||||
|
||||
lang = lephisto.lang()
|
||||
if lang == "es" then
|
||||
-- Not translated atm.
|
||||
else -- Default English.
|
||||
misn_title = "Collective Espionage"
|
||||
misn_reward = "None"
|
||||
misn_desc = {}
|
||||
misn_desc[1] = "Go to draw the Collective's attention in the %s system."
|
||||
misn_desc[2] = "Travel back to %s in %s."
|
||||
title = {}
|
||||
title[1] = "Collective Espionage"
|
||||
title[2] = "Mission Accomplished"
|
||||
text = {}
|
||||
text[1] = [[You find Sergeant Dimitri at the bar as usual. He looks somewhat excited as you approach.
|
||||
"It looks like you got something. It's not very clear because of %s's atmosphere creating a lot of noise, but it does seem to be similar to Empire transmissions. We've got another plan to try to get a cleaner signal. It'll be uglier than the last one. You in?"]]
|
||||
text[2] = [["Here's the plan: We want to drop a commando team on %s to set up more sophisticated surveillance. We've already got a team assembled. Your job would be to provide a distraction."
|
||||
"The idea would be to have you fly deep into Collective territory and start causing disturbances. This is no suicidal mission so you'll have to fly back when things start getting ugly. Meanwhile we'll send a fast convoy with the commandos to %s who will start monitoring."]]
|
||||
text[3] = [["If all goes well, the commandos will stay 10STU before returning here with the results. Then we'll have a definitive answer on the communication issues. We aren't anticipating problems on the return, but we'll have some ships ready just in case they get chased."
|
||||
"Good luck and be careful out there", he adds before saluting you off onto your mission.]]
|
||||
text[4] = [[Your ship touches ground and once again you see the face of sergeant Dimitri.
|
||||
"How was the trip? I trust you didn't have too many issues evading the Collective. We won't hear from the commandos until 10STU from now when they get back, but I believe everything went well."
|
||||
"Stay alert. We'll probably need your assistance when they get back. Take the free time as vacation. I heard the weather on Caladan is pretty nice this time of year, maybe you should visit them. We'll keep in touch."]]
|
||||
end
|
||||
|
||||
function create()
|
||||
commando_planet = "Eiroik"
|
||||
|
||||
-- Intro text.
|
||||
if tk.yesno(title[1, string.format(text[1], commando_planet)) then
|
||||
misn_accept()
|
||||
|
||||
misn_stage = 0
|
||||
misn_base, misn_base_sys = space.getPlanet("Omega Station")
|
||||
misn_target_sys = space.getSystem("C-28")
|
||||
misn.setMarker(misn_target_sys)
|
||||
|
||||
-- Mission details.
|
||||
misn.setTitle(misn_title)
|
||||
misn.setReward(misn_reward)
|
||||
misn.setDesc(string.format(misn_desc[1], misn_target_sys:name()))
|
||||
|
||||
tk.msg(title[1], string.format(text[2], commando_planet, commando_planet))
|
||||
tk.msg(title[1], text[3])
|
||||
|
||||
hook.enter("jump")
|
||||
end
|
||||
end
|
||||
|
||||
-- Handles jumping to target system.
|
||||
function jump()
|
||||
local sys = space.getSystem()
|
||||
local factions = sys:faction()
|
||||
|
||||
-- First mission part is landing on the planet.
|
||||
if misn_stage == 0 and sys == misn_target_sys then
|
||||
-- Maybe introducing a delay here would be interesting.
|
||||
misn_stage = 1
|
||||
misn_setDesc(string.format(misn_desc[2], misn_base:name(), misn_base_sys:name()))
|
||||
misn_setMarker(misn_base_sys)
|
||||
hook.land("land")
|
||||
|
||||
elseif misn_stage == 1 and (sys:name() == "NGC-7132" or factions["Collective"]) then
|
||||
pilot.add("Collective Sml Swarm")
|
||||
end
|
||||
end
|
||||
|
||||
-- Handle arrival back to base.
|
||||
function land()
|
||||
if misn_stage == 1 and planet == misn_base then
|
||||
tk.msg(title[2], text[4])
|
||||
|
||||
-- Store time commando theoretically landed.
|
||||
var.push("emp_commando", time_get() + time.units(10))
|
||||
|
||||
-- Rewards.
|
||||
player.modFaction("Empire", 5)
|
||||
|
||||
misn.finish(true)
|
||||
end
|
||||
end
|
||||
|
@ -209,9 +209,10 @@ static int pilot_addFleet(lua_State* L) {
|
||||
}
|
||||
else fltai = NULL;
|
||||
|
||||
/* Parse third argument - Position. */
|
||||
if(lua_gettop(L) > 2) {
|
||||
if(lua_isvector(L,2))
|
||||
lv = lua_tovector(L,2);
|
||||
if(lua_isvector(L,3))
|
||||
lv = lua_tovector(L,3);
|
||||
else LLUA_INVALID_PARAMETER();
|
||||
}
|
||||
else lv = NULL;
|
||||
|
@ -743,9 +743,11 @@ static int vectorL_distance(lua_State* L) {
|
||||
|
||||
/* Get rest of parameters. */
|
||||
v2 = NULL;
|
||||
if((lua_gettop(L) > 1) && lua_isvector(L,2))
|
||||
if(lua_gettop(L) > 1) {
|
||||
if(lua_isvector(L,2))
|
||||
v2 = lua_tovector(L, 2);
|
||||
else LLUA_INVALID_PARAMETER();
|
||||
}
|
||||
|
||||
/* Get distance. */
|
||||
if(v2 == NULL)
|
||||
|
@ -586,6 +586,8 @@ static int mission_saveData(xmlTextWriterPtr writer, char* type,
|
||||
static int mission_persistData(lua_State* L, xmlTextWriterPtr writer) {
|
||||
LuaPlanet* p;
|
||||
LuaSystem* s;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
lua_pushnil(L);
|
||||
/* nil. */
|
||||
while(lua_next(L, LUA_GLOBALSINDEX) != 0) {
|
||||
@ -596,8 +598,12 @@ static int mission_persistData(lua_State* L, xmlTextWriterPtr writer) {
|
||||
(char*)lua_tostring(L, -2), (char*)lua_tostring(L, -1));
|
||||
break;
|
||||
case LUA_TBOOLEAN:
|
||||
/* lua_tostring doesn't work on booleans. */
|
||||
if(lua_toboolean(L, -1)) buf[0] = '1';
|
||||
else buf[0] = '0';
|
||||
buf[1] = '\0';
|
||||
mission_saveData(writer, "bool",
|
||||
(char*)lua_tostring(L, -2), (char*)lua_tostring(L, -1));
|
||||
(char*)lua_tostring(L, -2), buf);
|
||||
break;
|
||||
case LUA_TSTRING:
|
||||
mission_saveData(writer, "string",
|
||||
|
Loading…
Reference in New Issue
Block a user