Permalink
Browse files

Improve campaign library vtol spawner.

- Allows a script to force it to alternate between each template and
send them one at a time with whatever limit is specified, if any.
- cam3-b, cam3-2: Use alternating template behavior.

More early Beta campaign research reordering.
  • Loading branch information...
KJeff01 committed Jan 2, 2018
1 parent e4b7113 commit c7bb50bec81a4f9a12632850271fb144bc013dc8
@@ -211,7 +211,8 @@ function cam2Setup()
camCompleteRequiredResearch(PLAYER_RES_BETA, CAM_HUMAN_PLAYER);
camCompleteRequiredResearch(COLLECTIVE_RES, THE_COLLECTIVE);
camCompleteRequiredResearch(ALPHA_RESEARCH, CAM_HUMAN_PLAYER);
enableResearch("R-Wpn-Cannon-Accuracy02", CAM_HUMAN_PLAYER);
enableResearch("R-Wpn-Cannon-Damage04", CAM_HUMAN_PLAYER);
enableResearch("R-Wpn-Rocket-Damage04", CAM_HUMAN_PLAYER);
preDamageStuff();
}
@@ -51,7 +51,9 @@ function playVideos()
//Activate edge map queues and play videos, donate alpha to the player, setup reinforcements.
camAreaEvent("phantomFacTrigger", function(droid)
{
sendEdgeMapDroids();
queue("phantomFactoryNE", camChangeOnDiff(180000)); //3 min;
queue("phantomFactorySW", camChangeOnDiff(240000)); //4 min;
queue("phantomFactorySE", camChangeOnDiff(360000)); //6 min;
setAlliance(ALPHA, NEXUS, false);
playSound("pcv456.ogg"); //Incoming transmission...
@@ -89,35 +91,40 @@ function getAlphaUnitIDs()
}
}
function sendEdgeMapDroids()
function phantomFactoryNE()
{
var list; with (camTemplates) list = [nxcyrail, nxcyscou, nxcylas, nxlflash];
sendEdgeMapDroids(4, "NE-PhantomFactory", list);
queue("phantomFactoryNE", camChangeOnDiff(180000)); //3 min;
}
function phantomFactorySW()
{
var list; with (camTemplates) list = [nxcyrail, nxcyscou, nxcylas, nxlflash];
sendEdgeMapDroids(6, "SW-PhantomFactory", list);
queue("phantomFactorySW", camChangeOnDiff(240000)); //4 min;
}
function phantomFactorySE()
{
const COUNT = 9 + camRand(8); // 9 - 16.
const EDGE = ["NE-PhantomFactory", "SW-PhantomFactory", "SE-PhantomFactory"];
var list; with (camTemplates) list = [nxcyrail, nxcyscou, nxcylas, nxlflash, nxmrailh, nxmlinkh];
if (!camDef(edgeMapIndex))
{
edgeMapIndex = 0;
}
sendEdgeMapDroids(8 + camRand(5), "SE-PhantomFactory", list);
queue("phantomFactorySE", camChangeOnDiff(360000)); //6 min;
}
function sendEdgeMapDroids(droidCount, location, list)
{
var droids = [];
for (var i = 0; i < COUNT; ++i)
for (var i = 0; i < droidCount; ++i)
{
droids.push(list[camRand(list.length)]);
}
camSendReinforcement(NEXUS, camMakePos(EDGE[edgeMapIndex]), droids,
camSendReinforcement(NEXUS, camMakePos(location), droids,
CAM_REINFORCE_GROUND, {
data: {regroup: true, count: -1}
}
);
edgeMapIndex += 1;
if (edgeMapIndex === EDGE.length)
{
edgeMapIndex = 0;
}
queue("sendEdgeMapDroids", camChangeOnDiff(150000)); // ~2.5 min.
}
function setupPatrolGroups()
@@ -193,7 +200,12 @@ function setupPatrolGroups()
function vtolAttack()
{
var list; with (camTemplates) list = [nxlscouv, nxmtherv];
camSetVtolData(NEXUS, "vtolAppearPos", "vtolRemovePos", list, camChangeOnDiff(240000)); //4 min
var ext = {
limit: [2, 4], //paired with template list
alternate: true,
altIdx: 0
};
camSetVtolData(NEXUS, "vtolAppearPos", "vtolRemovePos", list, camChangeOnDiff(120000), undefined, ext); //2 min
}
//reinforcements not available until team Alpha brief about VTOLS.
@@ -44,8 +44,14 @@ camAreaEvent("mockBattleTrigger", function(droid)
//Setup Nexus VTOL hit and runners.
function vtolAttack()
{
var list; with (camTemplates) list = [nxmheapv, nxmtherv, nxlscouv];
camSetVtolData(NEXUS, "vtolAppearPos", "vtolRemovePos", list, camChangeOnDiff(120000), "NXCommandCenter"); //2 min
var list; with (camTemplates) list = [nxmheapv, nxlscouv, nxmtherv, nxlscouv];
var ext = {
limit: [5, 2, 5, 2], //paired with template list
alternate: true,
altIdx: 0
};
camSetVtolData(NEXUS, "vtolAppearPos", "vtolRemovePos", list, camChangeOnDiff(120000), "NXCommandCenter", ext); //2 min
}
function enableAllFactories()
@@ -2727,14 +2727,15 @@ function camSetupTransporter(x, y, x1, y1)
//Setup hit and runner VTOLs. Passing in obj is optional and will automatically
//disable the vtol spawner once that object is dead.
function camSetVtolData(player, startPos, exitPos, templates, timer, obj)
function camSetVtolData(player, startPos, exitPos, templates, timer, obj, extras)
{
__camVtolPlayer = player;
__camVtolStartPosition = startPos;
__camVtolExitPosition = camMakePos(exitPos);
__camVtolTemplates = templates;
__camVtolTimer = timer;
__camVtolSpawnStopObject = obj;
__camVtolExtras = extras;
camSetVtolSpawn(true);
__checkVtolSpawnObject();
@@ -2755,6 +2756,7 @@ var __camVtolExitPosition;
var __camVtolTimer;
var __camVtolSpawnActive;
var __camVtolSpawnStopObject;
var __camVtolExtras;
function __checkVtolSpawnObject()
{
@@ -2774,7 +2776,9 @@ function __checkVtolSpawnObject()
function __camSpawnVtols()
{
if (__camVtolSpawnActive === false)
{
return;
}
var amount = 5 + camRand(2);
var droids = [];
@@ -2790,10 +2794,59 @@ function __camSpawnVtols()
pos = __camVtolStartPosition;
}
//Pick some droids randomly.
for (var i = 0; i < amount; ++i)
if (!camDef(__camVtolExtras))
{
droids.push(__camVtolTemplates[camRand(__camVtolTemplates.length)]);
//Pick some droids randomly.
for (var i = 0; i < amount; ++i)
{
droids.push(__camVtolTemplates[camRand(__camVtolTemplates.length)]);
}
}
else
{
var lim = amount;
var alternate = false;
if (camDef(__camVtolExtras.alternate))
{
alternate = __camVtolExtras.alternate; //Only use one template type
}
if (!camDef(__camVtolExtras.altIdx))
{
__camVtolExtras.altIdx = 0;
}
if (camDef(__camVtolExtras.limit))
{
//support an array of limits for each template
if (__camVtolExtras.limit instanceof Array)
{
lim = __camVtolExtras.limit[__camVtolExtras.altIdx]; //max templates to use
}
else
{
lim = __camVtolExtras.limit;
}
}
for (var i = 0; i < lim; ++i)
{
if (!alternate)
{
droids.push(__camVtolTemplates[camRand(__camVtolTemplates.length)]);
}
else
{
droids.push(__camVtolTemplates[__camVtolExtras.altIdx]);
}
}
if (__camVtolExtras.altIdx < __camVtolTemplates.length)
{
++__camVtolExtras.altIdx;
}
else
{
__camVtolExtras.altIdx = 0;
}
}
//...And send them.
@@ -2821,15 +2874,15 @@ function __camRetreatVtols()
for (var i = 0, l = vtols.length; i < l; ++i)
{
var vt = vtols[i];
if (!camDef(vt) || (vt.id === 0))
if (!camDef(vt))
{
continue;
}
for (var c = 0, d = vt.weapons.length; c < d; ++c)
{
if ((vt.order == DORDER_RTB)
|| (vt.weapons[c].armed < 1) || (vt.health < 40))
if ((vt.order === DORDER_RTB) || (vt.weapons[c].armed < 1) || (vt.health < 40))
{
orderDroidLoc(vt, DORDER_MOVE, __camVtolExitPosition.x,
__camVtolExitPosition.y);
orderDroidLoc(vt, DORDER_MOVE, __camVtolExitPosition.x, __camVtolExitPosition.y);
break;
}
}
@@ -3192,6 +3245,7 @@ function cam_eventStartLevel()
__camVtolExitPosition = {};
__camVtolTimer = 0;
__camVtolSpawnActive = false;
__camVtolExtras = {};
__camLastNexusAttack = 0;
__camNexusActivated = false;
__camNewGroupCounter = 0;
@@ -99,8 +99,8 @@ const STRUCTS_GAMMA = [
"A0VtolPad", "Sys-CB-Tower01", "Sys-SensoTower02", "Sys-VTOL-CB-Tower01",
"Sys-VTOL-RadarTower01", "AASite-QuadBof", "AASite-QuadRotMg",
"Emplacement-HPVcannon", "Emplacement-Howitzer105", "Emplacement-Howitzer150",
"Emplacement-Rocket06-IDF", "Emplacement-RotMor", "Emplacement-Rocket06-IDF",
"Emplacement-HvyATrocket", "Wall-RotMg", "Wall-VulcanCan", "WallTower-HvATrocket",
"Emplacement-Rocket06-IDF", "Emplacement-RotMor", "Emplacement-HvyATrocket",
"Wall-RotMg", "Wall-VulcanCan", "WallTower-HvATrocket",
"WallTower-HPVcannon", "Tower-Projector", "Pillbox-RotMG",
];
@@ -127,6 +127,7 @@ const PLAYER_RES_GAMMA = [
"R-Cyborg-Wpn-RotMG", "R-Defense-AASite-QuadRotMg", "R-Defense-Emplacement-HPVcannon",
"R-Defense-Howitzer", "R-Defense-HvyFlamer", "R-Defense-RotMG", "R-Defense-Wall-VulcanCan",
"R-Defense-WallTower-HPVcannon", "R-Defense-HvyHowitzer", "R-Defense-Wall-RotMg",
"R-Defense-IDFRocket",
];
//This is used for giving allies in Gamma technology (3-b/3-2/3-c)
@@ -3172,7 +3172,7 @@
"msgName": "RES_W_SRK_AC2",
"name": "Rocket Laser Designator",
"requiredResearch": [
"R-Wpn-Cannon-Accuracy02",
"R-Wpn-RocketSlow-Damage04",
"R-Wpn-RocketSlow-Accuracy01"
],
"researchPoints": 4800,
@@ -3558,7 +3558,7 @@
"R-Defense-WallTower-HvyFlamer": {
"iconID": "IMAGE_RES_DEFENCE",
"id": "R-Defense-WallTower-HvyFlamer",
"keyTopic": 1,
"keyTopic": 1,
"msgName": "RES_WT11_HFL",
"name": "Inferno Hardpoint",
"requiredResearch": [
@@ -4779,11 +4779,11 @@
"R-Wpn-Cannon-Accuracy02": {
"iconID": "IMAGE_RES_WEAPONTECH",
"id": "R-Wpn-Cannon-Accuracy02",
"keyTopic": 1,
"msgName": "RES_W_CNAC2",
"name": "Cannon Laser Designator",
"requiredResearch": [
"R-Wpn-Cannon-Accuracy01"
"requiredResearch": [
"R-Wpn-Cannon-Accuracy01",
"R-Wpn-Cannon-Damage04"
],
"researchPoints": 4800,
"researchPower": 150,
@@ -4802,11 +4802,11 @@
"R-Wpn-Cannon-Damage04": {
"iconID": "IMAGE_RES_WEAPONTECH",
"id": "R-Wpn-Cannon-Damage04",
"keyTopic": 1,
"msgName": "RES_W_CN_D4",
"name": "APFSDS Cannon Rounds",
"requiredResearch": [
"R-Wpn-Cannon-Accuracy02",
"R-Wpn-Cannon-Damage03"
"R-Wpn-Cannon-Damage03"
],
"researchPoints": 6000,
"researchPower": 187,
@@ -5840,11 +5840,12 @@
"R-Wpn-Rocket-Damage04": {
"iconID": "IMAGE_RES_WEAPONTECH",
"id": "R-Wpn-Rocket-Damage04",
"keyTopic": 1,
"msgName": "RES_W_RK_D4",
"name": "HEAP Mini-Rockets",
"requiredResearch": [
"R-Wpn-Cannon-Damage04",
"R-Wpn-Rocket-Damage03"
"R-Wpn-Rocket-Damage03"
],
"researchPoints": 4800,
"researchPower": 150,
@@ -5967,7 +5968,7 @@
"name": "HESH Rocket Warhead",
"requiredResearch": [
"R-Wpn-Rocket03-HvAT",
"R-Wpn-Rocket-Damage04",
"R-Wpn-Rocket-Damage06",
"R-Wpn-RocketSlow-Damage03"
],
"researchPoints": 6000,
@@ -6025,7 +6026,8 @@
"id": "R-Wpn-RocketSlow-Damage06",
"name": "HESH Rocket Warhead Mk3",
"requiredResearch": [
"R-Wpn-RocketSlow-Damage05"
"R-Wpn-RocketSlow-Damage05",
"R-Wpn-Rocket06-IDF"
],
"researchPoints": 10000,
"researchPower": 312,
@@ -7331,7 +7333,7 @@
"name": "HVAPFSDS Cannon Rounds",
"requiredResearch": [
"R-Wpn-MG-Damage08",
"R-Wpn-Cannon-Damage06"
"R-Wpn-Cannon-Damage06"
],
"researchPoints": 9600,
"researchPower": 300,

0 comments on commit c7bb50b

Please sign in to comment.