Skip to content

Commit

Permalink
Campaign script updates.
Browse files Browse the repository at this point in the history
- Libcampaign: All available non player trucks take orders rather than one at a time.
- Cam1-4a: Only the north pass that is south of the main base will cause an early base detection like in v1.10.
- Cam2-1x: Set the transport team to be green color right away.
- Cam3-1, Cam3-2: Use less code or simply remove unnecessary evaluation logic.
- Cam2-c: scavengers use the civilian texture again.
  • Loading branch information
KJeff01 committed Nov 27, 2017
1 parent 25de299 commit fa6e0cb
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 47 deletions.
36 changes: 21 additions & 15 deletions data/base/script/campaign/cam1-4a.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,7 @@ const SCAVENGER_RES = [
//Pursue player when nearby but do not go too far away from defense zone.
function camEnemyBaseDetected_NPBaseGroup()
{
// Send tanks
camManageGroup(camMakeGroup("AttackGroupLight"), CAM_ORDER_DEFEND, {
pos: camMakePos("nearSensor"),
radius: 10,
regroup: true
});

camManageGroup(camMakeGroup("AttackGroupMedium"), CAM_ORDER_DEFEND, {
pos: camMakePos("nearSensor"),
radius: 10,
regroup: true
});
camCallOnce("NPBaseDetect");
}

function enableSouthScavFactory()
Expand All @@ -47,8 +36,6 @@ camAreaEvent("NorthScavFactoryTrigger", function()
camAreaEvent("NPBaseDetectTrigger", function()
{
camDetectEnemyBase("NPBaseGroup");
camEnableFactory("HeavyNPFactory");
camEnableFactory("MediumNPFactory");
});

camAreaEvent("removeRedObjectiveBlip", function()
Expand All @@ -71,6 +58,25 @@ camAreaEvent("LandingZoneTrigger", function()
queue("moreLandingZoneTrigger", 4000);
});

function NPBaseDetect()
{
// Send tanks
camManageGroup(camMakeGroup("AttackGroupLight"), CAM_ORDER_DEFEND, {
pos: camMakePos("nearSensor"),
radius: 10,
regroup: true
});

camManageGroup(camMakeGroup("AttackGroupMedium"), CAM_ORDER_DEFEND, {
pos: camMakePos("nearSensor"),
radius: 10,
regroup: true
});

camEnableFactory("HeavyNPFactory");
camEnableFactory("MediumNPFactory");
}

function moreLandingZoneTrigger()
{
camPlayVideos("SB1_4_B");
Expand Down Expand Up @@ -154,7 +160,7 @@ function eventStartLevel()
});

hackAddMessage("C1-4_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER, false);

camSetArtifacts({
"NPCommandCenter": { tech: "R-Vehicle-Metals01" },
"NPResearchFacility": { tech: "R-Vehicle-Body04" },
Expand Down
5 changes: 3 additions & 2 deletions data/base/script/campaign/cam2-1x.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ camAreaEvent("crashSite", function(droid)
const GOODSND = "pcv615.ogg";
playSound(GOODSND);

//set downed transport team colour to be Project Green.
changePlayerColour(TRANSPORT_TEAM, 0);
hackRemoveMessage("C21_OBJECTIVE", PROX_MSG, CAM_HUMAN_PLAYER);

var downedTransportUnits = enumDroid(TRANSPORT_TEAM);
Expand Down Expand Up @@ -156,6 +154,9 @@ function eventStartLevel()
setAlliance(CAM_HUMAN_PLAYER, TRANSPORT_TEAM, true);
setPower(AI_POWER, THE_COLLECTIVE);

//set downed transport team colour to be Project Green.
changePlayerColour(TRANSPORT_TEAM, 0);

camCompleteRequiredResearch(COLLECTIVE_RES, THE_COLLECTIVE);

camSetEnemyBases({
Expand Down
4 changes: 2 additions & 2 deletions data/base/script/campaign/cam3-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function missileSilosDestroyed()
destroyed += (getObject(SILO_ALIAS + (i + 1)) === null) ? 1 : 0;
}

return destroyed === SILO_COUNT ? true : false;
return destroyed === SILO_COUNT;
}

//Nuclear missile destroys everything not in safe zone.
Expand Down Expand Up @@ -175,7 +175,7 @@ function setupNextMission()
//Play countdown sounds. Elements are shifted out of the sound arrays as they play.
function getCountdown()
{
var missilesDead = missileSilosDestroyed() ? true : false;
var missilesDead = missileSilosDestroyed();
var times = missilesDead ? detTimes : launchTimes;
var sounds = missilesDead ? detSounds : launchSounds;
var skip = false;
Expand Down
6 changes: 1 addition & 5 deletions data/base/script/campaign/cam3-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ camAreaEvent("phantomFacTrigger", function(droid)
playSound("pcv456.ogg"); //Incoming transmission...
queue("playVideos", 2000);
//Donate All of alpha to the player.
var alphaStuff = enumArea(0, 0, mapWidth, mapHeight, ALPHA, false);
for (var i = 0, l = alphaStuff.length; i < l; ++i)
{
donateObject(alphaStuff[i], CAM_HUMAN_PLAYER);
}
camAbsorbPlayer(ALPHA, CAM_HUMAN_PLAYER);

hackRemoveMessage("C3-2_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER);
queue("getAlphaUnitIDs", 3000);
Expand Down
45 changes: 29 additions & 16 deletions data/base/script/campaign/libcampaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@ function __camTruckTick()
var ti = __camTruckInfo[player];

// First, build things that were explicitly ordered.
if (ti.queue.length > 0)
while (ti.queue.length > 0)
{
var qi = ti.queue[0];
var pos = qi.pos;
Expand All @@ -1935,38 +1935,43 @@ function __camTruckTick()
// Find the truck most suitable for the job.
truck = __camGetClosestTruck(player, pos);
if (!camDef(truck))
continue;
{
break;
}
}
else
{
// Build near any truck if pos was not specified.
var droids = __camEnumFreeTrucks(player);
if (droids.length <= 0)
continue;
{
break;
}
truck = droids[0];
pos = truck;
}

enableStructure(qi.stat, player);
var loc = pickStructLocation(truck, qi.stat, pos.x, pos.y);
if (camDef(loc) && camDef(truck) && (truck.id !== 0))
if (camDef(loc) && camDef(truck))
{
if (orderDroidBuild(truck, DORDER_BUILD,
qi.stat, loc.x, loc.y))
{
ti.queue.shift(); // consider it handled
continue;
}
}
}

// Then, capture free oils.
var oils = enumFeature(-1, "OilResource");
if (oils.length === 0)
{
continue;
}
var oil = oils[0];
var truck = __camGetClosestTruck(player, oil);
if (camDef(truck) && (truck.id !== 0))
if (camDef(truck))
{
enableStructure("A0ResourceExtractor", player);
orderDroidBuild(truck, DORDER_BUILD, "A0ResourceExtractor",
Expand Down Expand Up @@ -2839,18 +2844,18 @@ function camNexusLaugh()
}
}

function camAbsorbPlayer(playerNumber, to)
function camAbsorbPlayer(who, to)
{
if (!camDef(playerNumber))
if (!camDef(who))
{
playerNumber = CAM_HUMAN_PLAYER;
who = CAM_HUMAN_PLAYER;
}
if (!camDef(to))
{
to = NEXUS;
}

var units = enumDroid(playerNumber);
var units = enumDroid(who);
for (var i = 0, l = units.length; i < l; i++)
{
if (!donateObject(units[i], to))
Expand All @@ -2859,7 +2864,7 @@ function camAbsorbPlayer(playerNumber, to)
}
}

var structs = enumStruct(playerNumber);
var structs = enumStruct(who);
for (var i = 0, l = structs.length; i < l; i++)
{
if (!donateObject(structs[i], to))
Expand All @@ -2868,8 +2873,8 @@ function camAbsorbPlayer(playerNumber, to)
}
}

camTrace("Player " + playerNumber + " has been absorbed by player" + to);
changePlayerColour(playerNumber, to); // Black painting.
camTrace("Player " + who + " has been absorbed by player" + to);
changePlayerColour(who, to);
}

//Steal a droid or structure from a player.
Expand Down Expand Up @@ -3280,7 +3285,7 @@ function cam_eventGameLoaded()
isReceivingAllEvents = true;
const SCAV_KEVLAR_MISSIONS = [
"CAM_1CA", "SUB_1_4AS", "SUB_1_4A", "SUB_1_5S", "SUB_1_5",
"CAM_1A-C", "SUB_1_7S", "SUB_1_7", "SUB_1_DS", "CAM_1END"
"CAM_1A-C", "SUB_1_7S", "SUB_1_7", "SUB_1_DS", "CAM_1END", "SUB_2_5S"
];

//Need to set the scavenger kevlar vests when loading a save from later Alpha
Expand All @@ -3289,8 +3294,16 @@ function cam_eventGameLoaded()
{
if (__camNextLevel === SCAV_KEVLAR_MISSIONS[i])
{
replaceTexture("page-7-barbarians-arizona.png",
"page-7-barbarians-kevlar.png");
if (tilesetType === "ARIZONA")
{
replaceTexture("page-7-barbarians-arizona.png",
"page-7-barbarians-kevlar.png");
}
else if (tilesetType === "URBAN")
{
replaceTexture("page-7-barbarians-arizona.png",
"page-7-barbarians-urban.png");
}
break;
}
}
Expand Down
1 change: 1 addition & 0 deletions data/base/script/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function setupGame()
{
if (tilesetType == "URBAN")
{
replaceTexture("page-7-barbarians-arizona.png", "page-7-barbarians-urban.png");
replaceTexture("page-8-player-buildings-bases.png", "page-8-player-buildings-bases-urban.png");
replaceTexture("page-9-player-buildings-bases.png", "page-9-player-buildings-bases-urban.png");
}
Expand Down
14 changes: 7 additions & 7 deletions data/base/wrf/cam1/sub1-4/labels.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@
"pos1": [7232, 4416],
"pos2": [7744, 4928]
},
"area_9": {
"label": "NPBaseDetectTrigger",
"subscriber": 0,
"pos1": [3500, 4480],
"pos2": [5120, 5376]
},

"object_0": {
"label": "SouthScavFactory",
Expand Down Expand Up @@ -156,18 +162,12 @@
"radius": 1280
},
"radius_1": {
"label": "NPBaseDetectTrigger",
"subscriber": 0,
"pos": [3840, 5504],
"radius": 800
},
"radius_2": {
"label": "removeRedObjectiveBlip",
"subscriber": 0,
"pos": [4096, 3640],
"radius": 700
},
"radius_3": {
"radius_2": {
"label": "triggerLZ2Blip",
"subscriber": 0,
"pos": [6160, 3840],
Expand Down

0 comments on commit fa6e0cb

Please sign in to comment.