Permalink
Browse files

Improvements to Gamma campaign scripts.

- Cam3-ad1 and cam3-ad2: Set the LasSat to fire every five seconds. Target droids over structures if in the y2 limit.
- Cam3-ad2: Set scroll limits as it previously had in past versions.
- LasSat now has a small damage radius for periodical damage similar to the multiplayer variant.
  • Loading branch information...
KJeff01 committed Nov 22, 2017
1 parent 70767fc commit 6c19b8dc0702bbf8371f5570ae939e6a8be79f0b
Showing with 52 additions and 41 deletions.
  1. +20 −19 data/base/script/campaign/cam3-ad1.js
  2. +29 −22 data/base/script/campaign/cam3-ad2.js
  3. +3 −0 data/base/stats/weapons.json
@@ -16,7 +16,6 @@ const NEXUS_RES = [
];
var capturedSilos; // victory flag letting us know if we captured any silos.
var mapLimit; //LasSat slowly creeps toward missile silos.
var retryTime; //Delay before next Lassat strike.
camAreaEvent("NEDefenseZone", function(droid) {
camEnableFactory("NXcyborgFac2Arti");
@@ -89,39 +88,42 @@ function enableAllFactories()
//when no target is found in the area.
function vaporizeTarget()
{
var targets = enumArea(0, 0, mapWidth, mapLimit, CAM_HUMAN_PLAYER, false);
var target;
var targets = enumArea(0, 0, mapWidth, Math.floor(mapLimit), CAM_HUMAN_PLAYER, false).filter(function(obj) {
return obj.type === DROID || (obj.type === STRUCTURE && obj.status === BUILT);
});
if (!targets.length)
{
const ONE_THIRD = Math.floor(mapHeight / 3);
//Choose random coordinate within the limits.
target = {
"x": camRand(mapWidth),
"y": camRand(mapLimit),
"y": camRand(Math.floor(mapLimit)),
};
if (mapLimit < mapHeight)
if (Math.floor(mapLimit) < mapHeight)
{
mapLimit = mapLimit + 2; //sector clear; move closer.
mapLimit = mapLimit + 0.178; //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 ((mapLimit >= ONE_THIRD) && (mapLimit < (2 * ONE_THIRD)))
if (dr.length)
{
retryTime = 10000; //Slow down cover cam1-a area.
target = camMakePos(dr[0]);
}
else if (mapLimit >= (2 * ONE_THIRD))
else if (st.length)
{
retryTime = 20000; //Slow down even more on cam3-c area.
target = camMakePos(st[0]);
}
}
else
{
target = camMakePos(targets[0]);
}
laserSatFuzzyStrike(target);
queue("vaporizeTarget", retryTime);
queue("vaporizeTarget", 5000);
}
//A simple way to fire the LasSat with a chance of missing.
@@ -148,9 +150,9 @@ function laserSatFuzzyStrike(obj)
{
yCoord = 0;
}
else if (yCoord > mapLimit)
else if (yCoord > Math.floor(mapLimit))
{
yCoord = mapLimit;
yCoord = Math.floor(mapLimit);
}
if (camRand(101) < 40)
@@ -200,8 +202,7 @@ function eventStartLevel()
var startpos = getObject("startPosition");
var lz = getObject("landingZone");
var lz2 = getObject("landingZone2");
mapLimit = 1;
retryTime = 5000;
mapLimit = 1.0;
camSetStandardWinLossConditions(CAM_VICTORY_STANDARD, "CAM3A-D2", {
callback: "checkMissileSilos"
@@ -1,6 +1,7 @@
include("script/campaign/libcampaign.js");
include("script/campaign/templates.js");
const Y_SCROLL_LIMIT = 137;
const LASSAT_FIRING = "pcv650.ogg"; // LASER SATELLITE FIRING!!!
const NEXUS_RES = [
"R-Defense-WallUpgrade09", "R-Struc-Materials09", "R-Struc-Factory-Upgrade06",
@@ -67,27 +68,23 @@ function phantomFactorySpawn()
var list;
var chosenFactory;
switch (camRand(4))
switch (camRand(3))
{
case 0:
with (camTemplates) list = [nxhgauss, nxmpulseh, nxmlinkh];
chosenFactory = "phantomFacNorth";
break;
case 1:
with (camTemplates) list = [nxcylas, nxcyrail, nxcyscou];
chosenFactory = "phantomFacWest";
break;
case 2:
case 1:
with (camTemplates) list = [nxhgauss, nxmpulseh, nxmlinkh];
chosenFactory = "phantomFacEast";
break;
case 3:
case 2:
with (camTemplates) list = [nxcylas, nxcyrail, nxcyscou, nxhgauss, nxmpulseh, nxmlinkh];
chosenFactory = "phantomFacMiddle";
break;
default:
with (camTemplates) list = [nxhgauss, nxmpulseh, nxmlinkh];
chosenFactory = "phantomFacNorth";
with (camTemplates) list = [nxcylas, nxcyrail, nxcyscou];
chosenFactory = "phantomFacWest";
}
if (countDroid(DROID_ANY, NEXUS) < 80)
@@ -104,16 +101,17 @@ function phantomFactorySpawn()
//when no target is found in the area.
function vaporizeTarget()
{
const MAP_THIRD = Math.floor(mapHeight / 3);
var targets = enumArea(0, 2 * MAP_THIRD, mapWidth, Math.floor(mapLimit), CAM_HUMAN_PLAYER, false);
var target;
var targets = enumArea(0, Y_SCROLL_LIMIT, mapWidth, Math.floor(mapLimit), CAM_HUMAN_PLAYER, false).filter(function(obj) {
return obj.type === DROID || (obj.type === STRUCTURE && obj.status === BUILT);
});
if (!targets.length)
{
//Choose random coordinate within the limits.
target = {
"x": camRand(mapWidth),
"y": Math.floor((2 * MAP_THIRD) + camRand(MAP_THIRD)),
"y": Y_SCROLL_LIMIT + camRand(mapHeight - Math.floor(mapLimit)),
};
if (target.y > Math.floor(mapLimit))
@@ -123,19 +121,30 @@ function vaporizeTarget()
if (Math.floor(mapLimit) < mapHeight)
{
mapLimit = mapLimit + 0.275; // sector clear; move closer.
mapLimit = mapLimit + 0.165; //sector clear; move closer
}
}
else
{
target = camMakePos(targets[0]);
// 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)
{
target = camMakePos(st[0]);
}
}
//Stop firing LasSat if the third missile unlock code was researched.
if (winFlag === false)
{
laserSatFuzzyStrike(target);
queue("vaporizeTarget", 12000);
queue("vaporizeTarget", 5000);
}
}
@@ -243,19 +252,17 @@ function eventStartLevel()
{
var startpos = getObject("startPosition");
var lz = getObject("landingZone");
mapLimit = 2 * Math.floor(mapHeight * 0.33);
mapLimit = 137.0;
winFlag = false;
camSetStandardWinLossConditions(CAM_VICTORY_STANDARD, "CAM_3_4S", {
callback: "checkMissileSilos"
});
//Destroy all non-defense structures above the last third of the map and
//prevent the player from building anything there as well
setNoGoArea(0, 0, 64, Math.floor(mapLimit), NEXUS);
var destroyZone = enumArea(0, 0, 64, Math.floor(mapLimit), CAM_HUMAN_PLAYER, false).filter(function(obj) {
return obj.type === STRUCTURE && (obj.stattype !== WALL && obj.stattype !== DEFENSE);
});
setScrollLimits(0, Y_SCROLL_LIMIT, 64, 256);
//Destroy everything above limits
var destroyZone = enumArea(0, 0, 64, Y_SCROLL_LIMIT, CAM_HUMAN_PLAYER, false);
for (var i = 0, l = destroyZone.length; i < l; ++i)
{
camSafeRemoveObject(destroyZone[i], false);
@@ -1393,6 +1393,9 @@
"muzzleGfx": "FXHBLas.PIE",
"name": "LasSat",
"numExplosions": 1,
"periodicalDamage": 360,
"periodicalDamageRadius": 384,
"periodicalDamageTime": 45,
"radius": 256,
"radiusDamage": 3000,
"rotate": 180,

0 comments on commit 6c19b8d

Please sign in to comment.