Skip to content

Commit

Permalink
More Gamma campaign script updates.
Browse files Browse the repository at this point in the history
- Cam3-ad2: LasSat fires every ten seconds and has a chance to pick
either a droid or structure to target instead of only focusing on droids
within its strike limit. Also do not play videos again when loading a
save since eventResearched is triggered for each research item on load.

- Cam3-ad1, Cam3-ad2: Make sure to check if a droid or structure target
exists before using its coordinates, and always move the LasSat strike
limit.

- Cam3-4: Increase a factory throttle.

- Libcamaign: Remove groups from __camGroupInfo if there are no droids
in them.
  • Loading branch information
KJeff01 committed Jan 21, 2018
1 parent 8cad813 commit aaacc29
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 34 deletions.
2 changes: 1 addition & 1 deletion data/base/script/campaign/cam3-4.js
Expand Up @@ -223,7 +223,7 @@ function eventStartLevel()
"NX-NEFactory": {
order: CAM_ORDER_ATTACK,
groupSize: 4,
throttle: camChangeOnDiff(10000),
throttle: camChangeOnDiff(30000),
data: {
regroup: false,
repair: 45,
Expand Down
21 changes: 13 additions & 8 deletions data/base/script/campaign/cam3-ad1.js
Expand Up @@ -94,14 +94,6 @@ function vaporizeTarget()
"x": camRand(mapWidth),
"y": camRand(Math.floor(mapLimit)),
};

if (Math.floor(mapLimit) < Math.floor(mapHeight / 2))
{
//total tiles = 256. 256 / 2 = 128 tiles. 128 / 60 = 2.13 tiles per minute.
//2.13 / 60 = 0.0355 tiles per second. 0.0355 * 10 = ~0.36 tiles every 10 seconds.
//This assumes an hour to completely cover the upper half of the home map.
mapLimit = mapLimit + 0.36; //sector clear; move closer
}
}
else
{
Expand All @@ -119,6 +111,19 @@ function vaporizeTarget()
}
}

//Droid or structure was destroyed before firing so pick a new one.
if (!camDef(target))
{
queue("vaporizeTarget", 100);
return;
}
if (Math.floor(mapLimit) < Math.floor(mapHeight / 2))
{
//total tiles = 256. 256 / 2 = 128 tiles. 128 / 60 = 2.13 tiles per minute.
//2.13 / 60 = 0.0355 tiles per second. 0.0355 * 10 = ~0.36 tiles every 10 seconds.
//This assumes an hour to completely cover the upper half of the home map.
mapLimit = mapLimit + 0.36; //sector clear; move closer
}
laserSatFuzzyStrike(target);
queue("vaporizeTarget", 10000);
}
Expand Down
62 changes: 38 additions & 24 deletions data/base/script/campaign/cam3-ad2.js
Expand Up @@ -19,6 +19,7 @@ const VTOL_POSITIONS = [
];
var winFlag;
var mapLimit;
var videoInfo; //holds some info about when to play a video.

//Remove Nexus VTOL droids.
camAreaEvent("vtolRemoveZone", function(droid)
Expand Down Expand Up @@ -118,33 +119,42 @@ function vaporizeTarget()
{
target.y = Math.floor(mapLimit);
}

if (Math.floor(mapLimit) < mapHeight)
{
mapLimit = mapLimit + 0.165; //sector clear; move closer
}
}
else
{
// prefer droids over structures
var dr = targets.filter(function(obj) { return obj.type === DROID; });
var st = targets.filter(function(obj) { return obj.type === STRUCTURE; });

if (dr.length)
{
target = camMakePos(dr[0]);
}
else if (st.length)
if (st.length && !camRand(2)) //chance to focus on a structure
{
target = camMakePos(st[0]);
}
}


//Stop firing LasSat if the third missile unlock code was researched.
if (winFlag === false)
{
//Droid or structure was destroyed before firing so pick a new one.
if (!camDef(target))
{
queue("vaporizeTarget", 100);
return;
}
if (Math.floor(mapLimit) < mapHeight)
{
//Need to travel about 119 tiles in ~1 hour so:
//119 tiles / 60 minutes = 1.983 tiles per minute
//1.983 tile per minute / 60 seconds = 0.03305 tiles per second
//0.03305 * 10 sec = ~0.33 tiles per blast at 10 second intervals.
mapLimit = mapLimit + 0.33; //sector clear; move closer
}
laserSatFuzzyStrike(target);
queue("vaporizeTarget", 5000);
queue("vaporizeTarget", 10000);
}
}

Expand Down Expand Up @@ -196,23 +206,21 @@ function laserSatFuzzyStrike(obj)
//Play videos and allow winning once the final one is researched.
function eventResearched(research, structure, player)
{
if (research.name === "R-Sys-Resistance")
{
camPlayVideos("MB3_AD2_MSG3");
enableResearch("R-Comp-MissileCodes01", CAM_HUMAN_PLAYER);
}
else if (research.name === "R-Comp-MissileCodes01")
{
camPlayVideos("MB3_AD2_MSG4");
}
else if (research.name === "R-Comp-MissileCodes02")
for (var i = 0, l = videoInfo.length; i < l; ++i)
{
camPlayVideos("MB3_AD2_MSG5");
}
else if (research.name === "R-Comp-MissileCodes03")
{
camPlayVideos("MB3_AD2_MSG6");
winFlag = true;
if (research.name === videoInfo[i].res && !videoInfo[i].played)
{
videoInfo[i].played = true;
camPlayVideos(videoInfo[i].video);
if (videoInfo[i].res === "R-Sys-Resistance")
{
enableResearch("R-Comp-MissileCodes01", CAM_HUMAN_PLAYER);
}
else if (videoInfo[i].res === "R-Comp-MissileCodes03")
{
winFlag = true;
}
}
}
}

Expand Down Expand Up @@ -253,6 +261,12 @@ function eventStartLevel()
var lz = getObject("landingZone");
mapLimit = 137.0;
winFlag = false;
videoInfo = [
{played: false, video: "MB3_AD2_MSG3", res: "R-Sys-Resistance"},
{played: false, video: "MB3_AD2_MSG4", res: "R-Comp-MissileCodes01"},
{played: false, video: "MB3_AD2_MSG5", res: "R-Comp-MissileCodes02"},
{played: false, video: "MB3_AD2_MSG6", res: "R-Comp-MissileCodes03"},
];

camSetStandardWinLossConditions(CAM_VICTORY_STANDARD, "CAM_3_4S", {
callback: "checkMissileSilos"
Expand Down
8 changes: 7 additions & 1 deletion data/base/script/campaign/libcampaign.js
Expand Up @@ -371,7 +371,7 @@ function camMakeGroup(what, filter)
}

//;; \subsection{camBreakAlliances()}
//;; Break alliances between all players.
//;; Break alliances between all players.
function camBreakAlliances()
{
for (var i = 0; i < CAM_MAX_PLAYERS; ++i)
Expand Down Expand Up @@ -1627,6 +1627,12 @@ function __camTacticsTick()
var dt = CAM_TICKS_PER_FRAME;
for (var group in __camGroupInfo)
{
//Remove groups with no droids.
if (enumGroup(group).length === 0)
{
camStopManagingGroup(group);
break;
}
queue("__camTacticsTickForGroup", dt, group);
dt += CAM_TICKS_PER_FRAME;
}
Expand Down

0 comments on commit aaacc29

Please sign in to comment.