Skip to content

Commit

Permalink
Campaign videos handled in libcampaign.
Browse files Browse the repository at this point in the history
- cam1-7: Make artifact group move at different times depending on difficulty.
- cam2-6: Add two VTOL rearming pads for the VTOL droids on map and use water triangle correction and move or remove overlapped objects. Remove truck management. Detecting the main base activates the scouts and defenders and enables the rest of the factories.

- Reduce repeated, and ugly, code relating to playing video sequences. Now it is all handled by the campaign library.
  • Loading branch information
KJeff01 committed Nov 5, 2017
1 parent 3438382 commit 1dda935
Show file tree
Hide file tree
Showing 44 changed files with 139 additions and 464 deletions.
2 changes: 1 addition & 1 deletion data/base/script/campaign/cam1-1.js
Expand Up @@ -65,7 +65,7 @@ function eventStartLevel()
"artifactLocation": { tech: "R-Wpn-MG3Mk1" }, //Heavy machine gun
});

hackAddMessage("FLIGHT", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("FLIGHT");
hackAddMessage("C1-1_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER, true);

}
4 changes: 2 additions & 2 deletions data/base/script/campaign/cam1-1s.js
Expand Up @@ -13,13 +13,13 @@ function eventChat(from, to, message)
//Video if player does not yet have power module built
function resPowModVideo()
{
hackAddMessage("MB1_B2_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("MB1_B2_MSG");
}

//Sector clear commander!
function secondVideo()
{
hackAddMessage("SB1_1_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("SB1_1_MSG");
}

//Has player built the power module?
Expand Down
3 changes: 1 addition & 2 deletions data/base/script/campaign/cam1-2.js
Expand Up @@ -5,7 +5,7 @@ include("script/campaign/templates.js");
function exposeNorthBase()
{
camDetectEnemyBase("NorthGroup"); // no problem if already detected
hackAddMessage("SB1_2_MSG2", MISS_MSG, CAM_HUMAN_PLAYER, true); // that's what it was for
camPlayVideos("SB1_2_MSG2");
}

function camArtifactPickup_ScavLab()
Expand Down Expand Up @@ -100,7 +100,6 @@ function eventStartLevel()
},
});

hackAddMessage("SB1_2_MSG", MISS_MSG, CAM_HUMAN_PLAYER, false);
camDetectEnemyBase("ScavLabGroup");

camSetArtifacts({
Expand Down
2 changes: 1 addition & 1 deletion data/base/script/campaign/cam1-2s.js
Expand Up @@ -7,6 +7,6 @@ function eventStartLevel()
centreView(13, 52);
setNoGoArea(10, 51, 12, 53, CAM_HUMAN_PLAYER);
setMissionTime(camChangeOnDiff(1800));
hackAddMessage("SB1_2_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("SB1_2_MSG");
camSetStandardWinLossConditions(CAM_VICTORY_PRE_OFFWORLD, "SUB_1_2");
}
6 changes: 3 additions & 3 deletions data/base/script/campaign/cam1-3.js
Expand Up @@ -55,7 +55,7 @@ camAreaEvent("WestConvoyTrigger", function(droid)

function playYouAreInContraventionOfTheNewParadigm()
{
hackAddMessage("SB1_3_MSG4", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("SB1_3_MSG4");
camManageGroup(NPScoutGroup, CAM_ORDER_COMPROMISE, {
pos: camMakePos("RTLZ"),
repair: 66,
Expand Down Expand Up @@ -139,7 +139,7 @@ function camEnemyBaseEliminated_ScavBaseGroup()

function playNPWarningMessage()
{
hackAddMessage("SB1_3_MSG3", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("SB1_3_MSG3");
}

function playNPWarningSound()
Expand Down Expand Up @@ -202,7 +202,7 @@ function eventStartLevel()
},
});

hackAddMessage("SB1_3_MSG", MISS_MSG, CAM_HUMAN_PLAYER, false);
camPlayVideos("SB1_3_MSG");
hackAddMessage("C1-3_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER, false); // south-west beacon

camSetArtifacts({
Expand Down
2 changes: 1 addition & 1 deletion data/base/script/campaign/cam1-3s.js
Expand Up @@ -7,6 +7,6 @@ function eventStartLevel()
centreView(13, 52);
setNoGoArea(10, 51, 12, 53, CAM_HUMAN_PLAYER);
setMissionTime(camChangeOnDiff(3600));
hackAddMessage("SB1_3_UPDATE", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("SB1_3_UPDATE");
camSetStandardWinLossConditions(CAM_VICTORY_PRE_OFFWORLD, "SUB_1_3");
}
7 changes: 2 additions & 5 deletions data/base/script/campaign/cam1-4a.js
Expand Up @@ -73,7 +73,7 @@ camAreaEvent("LandingZoneTrigger", function()

function moreLandingZoneTrigger()
{
hackAddMessage("SB1_4_B", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("SB1_4_B");
// Give extra 30 minutes.
setMissionTime(camChangeOnDiff(1800) + getMissionTime());
camSetStandardWinLossConditions(CAM_VICTORY_OFFWORLD, "SUB_1_5S", {
Expand Down Expand Up @@ -153,11 +153,8 @@ function eventStartLevel()
},
});

// These seem to be in a different order this time,
// first PROX then MISS, not sure if matters.
hackAddMessage("C1-4_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER, false);
hackAddMessage("SB1_4_MSG", MISS_MSG, CAM_HUMAN_PLAYER, false);


camSetArtifacts({
"NPCommandCenter": { tech: "R-Vehicle-Metals01" },
"NPResearchFacility": { tech: "R-Vehicle-Body04" },
Expand Down
2 changes: 1 addition & 1 deletion data/base/script/campaign/cam1-4as.js
Expand Up @@ -7,6 +7,6 @@ function eventStartLevel()
centreView(13, 52);
setNoGoArea(10, 51, 12, 53, CAM_HUMAN_PLAYER);
setMissionTime(camChangeOnDiff(1800));
hackAddMessage("SB1_4_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("SB1_4_MSG");
camSetStandardWinLossConditions(CAM_VICTORY_PRE_OFFWORLD, "SUB_1_4A");
}
5 changes: 2 additions & 3 deletions data/base/script/campaign/cam1-5s.js
Expand Up @@ -2,11 +2,10 @@ include("script/campaign/libcampaign.js");

function eventStartLevel()
{
var ti = camChangeOnDiff(3600); //60 min
camSetupTransporter(11, 52, 100, 126);
centreView(13, 52);
setNoGoArea(10, 51, 12, 53, CAM_HUMAN_PLAYER);
setMissionTime(ti);
hackAddMessage("SB1_5_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
setMissionTime(camChangeOnDiff(3600)); //60 min
camPlayVideos("SB1_5_MSG");
camSetStandardWinLossConditions(CAM_VICTORY_PRE_OFFWORLD, "SUB_1_5");
}
5 changes: 2 additions & 3 deletions data/base/script/campaign/cam1-7.js
Expand Up @@ -67,7 +67,7 @@ camAreaEvent("artifactCheckNP", function()
var artifact = camGetArtifacts();
camSafeRemoveObject(artifact[0], false);

hackAddMessage("SB1_7_MSG3", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("SB1_7_MSG3");
hackAddMessage("C1-7_LZ2", PROX_MSG, CAM_HUMAN_PLAYER, true); //NPLZ blip
camCallOnce("removeCanyonBlip");

Expand Down Expand Up @@ -187,7 +187,6 @@ function eventStartLevel()
{
enemyHasArtifact = false;
enemyStoleArtifact = false;
var time = (difficulty === INSANE) ? 25000 : 50000;
var startpos = getObject("startPosition");
var lz = getObject("landingZone"); //player lz
var tent = getObject("transporterEntry");
Expand Down Expand Up @@ -283,5 +282,5 @@ function eventStartLevel()

hackAddMessage("C1-7_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER, true); //Canyon
queue("enableReinforcements", 15000);
queue("getArtifact", time);
queue("getArtifact", camChangeOnDiff(90000));
}
19 changes: 1 addition & 18 deletions data/base/script/campaign/cam1-7s.js
@@ -1,28 +1,11 @@
include("script/campaign/libcampaign.js");

var index;

function eventVideoDone()
{
const VIDEOS = ["SB1_7_MSG", "SB1_7_MSG2"];
if (!camDef(index))
{
index = 0;
}

if (index < VIDEOS.length)
{
hackAddMessage(VIDEOS[index], MISS_MSG, CAM_HUMAN_PLAYER, true);
index = index + 1;
}
}

function eventStartLevel()
{
camSetupTransporter(11, 52, 55, 1);
centreView(13, 52);
setNoGoArea(10, 51, 12, 53, CAM_HUMAN_PLAYER);
setMissionTime(camChangeOnDiff(1800)); //30 min
eventVideoDone();
camPlayVideos(["SB1_7_MSG", "SB1_7_MSG2"]);
camSetStandardWinLossConditions(CAM_VICTORY_PRE_OFFWORLD, "SUB_1_7");
}
20 changes: 1 addition & 19 deletions data/base/script/campaign/cam1-ds.js
@@ -1,29 +1,11 @@
include("script/campaign/libcampaign.js");

var index;

function eventVideoDone()
{
const VIDEOS = ["MB1D_MSG", "MB1D_MSG2"];
if (!camDef(index))
{
index = 0;
}

if (index < VIDEOS.length)
{
hackAddMessage(VIDEOS[index], MISS_MSG, CAM_HUMAN_PLAYER, true);
index = index + 1;
}
}


function eventStartLevel()
{
camSetupTransporter(11, 52, 126, 112);
centreView(13, 52);
setNoGoArea(10, 51, 12, 53, CAM_HUMAN_PLAYER);
setMissionTime(camChangeOnDiff(7200)); //2 hours
eventVideoDone();
camPlayVideos(["MB1D_MSG", "MB1D_MSG2"]);
camSetStandardWinLossConditions(CAM_VICTORY_PRE_OFFWORLD, "SUB_1_D");
}
18 changes: 1 addition & 17 deletions data/base/script/campaign/cam1a-c.js
Expand Up @@ -23,22 +23,6 @@ const NEW_PARADIGM_RES = [
];
var index; //Current LZ (SE, N, canyon, south hill, road north of base)
var switchLZ; //Counter for incrementing index every third landing
var videoIndex;

function eventVideoDone()
{
const VIDEOS = ["MB1A-C_MSG", "MB1A-C_MSG2"];
if (!camDef(videoIndex))
{
videoIndex = 0;
}

if (videoIndex < VIDEOS.length)
{
hackAddMessage(VIDEOS[videoIndex], MISS_MSG, CAM_HUMAN_PLAYER, true);
videoIndex = videoIndex + 1;
}
}

//Check if all enemies are gone and win after 15 transports
function extraVictoryCondition()
Expand Down Expand Up @@ -160,7 +144,7 @@ function eventStartLevel()
}

camCompleteRequiredResearch(NEW_PARADIGM_RES, NEW_PARADIGM);
eventVideoDone();
camPlayVideos(["MB1A-C_MSG", "MB1A-C_MSG2"]);

index = 0;
switchLZ = 0;
Expand Down
2 changes: 1 addition & 1 deletion data/base/script/campaign/cam1a.js
Expand Up @@ -11,7 +11,7 @@ camAreaEvent("LaunchScavAttack", function(droid)
var spos = getObject("scav1soundpos");
playSound("pcv375.ogg", spos.x, spos.y, 0);
playSound("pcv456.ogg");
hackAddMessage("MB1A_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("MB1A_MSG");
hackAddMessage("C1A_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER, false);
// send scavengers on war path if triggered above
camManageGroup(
Expand Down
2 changes: 1 addition & 1 deletion data/base/script/campaign/cam1b.js
Expand Up @@ -117,7 +117,7 @@ function eventStartLevel()
},
});

hackAddMessage("MB1B_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("MB1B_MSG");
camDetectEnemyBase("base4group"); // power surge detected

with (camTemplates) camSetFactories({
Expand Down
16 changes: 3 additions & 13 deletions data/base/script/campaign/cam1c.js
Expand Up @@ -142,7 +142,7 @@ camAreaEvent("NPLZ1Trigger", function()
{
// Message4 here, Message3 for the second LZ, and
// please don't ask me why they did it this way
hackAddMessage("MB1C4_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("MB1C4_MSG");
camDetectEnemyBase("NPLZ1Group");

camSetBaseReinforcements("NPLZ1Group", camChangeOnDiff(300000), "getDroidsForNPLZ",
Expand All @@ -155,7 +155,7 @@ camAreaEvent("NPLZ1Trigger", function()

camAreaEvent("NPLZ2Trigger", function()
{
hackAddMessage("MB1C3_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("MB1C3_MSG");
camDetectEnemyBase("NPLZ2Group");

camSetBaseReinforcements("NPLZ2Group", camChangeOnDiff(300000), "getDroidsForNPLZ",
Expand All @@ -166,16 +166,6 @@ camAreaEvent("NPLZ2Trigger", function()
);
});

function playSecondVideo()
{
hackAddMessage("MB1C2_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
}

function eventVideoDone()
{
camCallOnce("playSecondVideo");
}

function eventStartLevel()
{
camSetStandardWinLossConditions(CAM_VICTORY_STANDARD, "CAM_1CA");
Expand Down Expand Up @@ -274,7 +264,7 @@ function eventStartLevel()
});

hackAddMessage("C1C_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER, false); // initial beacon
hackAddMessage("MB1C_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos(["MB1C_MSG", "MB1C2_MSG"]);

camSetArtifacts({
"ScavSouthFactory": { tech: "R-Wpn-Rocket05-MiniPod" },
Expand Down
2 changes: 1 addition & 1 deletion data/base/script/campaign/cam1ca.js
Expand Up @@ -136,7 +136,7 @@ function eventStartLevel()
}

setMissionTime(camChangeOnDiff(1800));
hackAddMessage("MB1CA_MSG", MISS_MSG, CAM_HUMAN_PLAYER, true);
camPlayVideos("MB1CA_MSG");

// first transport after 10 seconds; will re-queue itself
queue('sendTransport', 10000);
Expand Down
19 changes: 1 addition & 18 deletions data/base/script/campaign/cam1end.js
@@ -1,28 +1,11 @@
include("script/campaign/libcampaign.js");

var index;

function eventVideoDone()
{
const VIDEOS = ["CAM1_OUT", "CAM1_OUT2", "CAM2_BRIEF"];
if (!camDef(index))
{
index = 0;
}

if (index < VIDEOS.length)
{
hackAddMessage(VIDEOS[index], MISS_MSG, CAM_HUMAN_PLAYER, true);
index = index + 1;
}
}

function eventStartLevel()
{
camSetupTransporter(11, 52, 40, 1);
centreView(13, 52);
setNoGoArea(10, 51, 12, 53, CAM_HUMAN_PLAYER);
setMissionTime(900); //15 min
eventVideoDone();
camPlayVideos(["CAM1_OUT", "CAM1_OUT2", "CAM2_BRIEF"]);
camSetStandardWinLossConditions(CAM_VICTORY_PRE_OFFWORLD, "CAM_2A");
}
18 changes: 1 addition & 17 deletions data/base/script/campaign/cam2-1s.js
Expand Up @@ -3,22 +3,6 @@ SUB_2_1S campaign script
Authors: Cristian Odorico (Alpha93) / KJeff01
*/
include("script/campaign/libcampaign.js");
var index;

function eventVideoDone()
{
const VIDEOS = ["MB2_1_MSG", "MB2_1_MSG2"];
if (!camDef(index))
{
index = 0;
}

if (index < VIDEOS.length)
{
hackAddMessage(VIDEOS[index], MISS_MSG, CAM_HUMAN_PLAYER, true);
index = index + 1;
}
}

function eventStartLevel()
{
Expand All @@ -33,5 +17,5 @@ function eventStartLevel()
//Set Mission Time
setMissionTime(camChangeOnDiff(1800));
//Give player briefings
eventVideoDone();
camPlayVideos(["MB2_1_MSG", "MB2_1_MSG2"]);
}

0 comments on commit 1dda935

Please sign in to comment.