Permalink
Browse files

Cleanup cam1-7 and cam3-ad1 scripts.

- Remove some ugly looking code in cam1-7. Fixes failure condition.
- Correct a few things in the new cam3-ad1 script and remove
camTraces().
  • Loading branch information...
KJeff01 committed Nov 3, 2017
1 parent 1cdd7bd commit 10b39fc53cf020e5f65f12d0ab6841afc1e77e1d
Showing with 22 additions and 31 deletions.
  1. +14 −23 data/base/script/campaign/cam1-7.js
  2. +8 −8 data/base/script/campaign/cam3-ad1.js
@@ -82,36 +82,26 @@ function eventTransporterLanded(transport)
{
if ((transport.player === NEW_PARADIGM) && enemyHasArtifact)
{
for (var s = 0; s < 5; ++s)
enemyStoleArtifact = true;
var crew = enumRange(transport.x, transport.y, 6, NEW_PARADIGM, false).filter(function(obj) {
return obj.type === DROID && obj.group === artiGroup;
});
for (var i = 0, l = crew.length; i < l; ++i)
{
var crew = enumRange(transport.x, transport.y, 5, ALL_PLAYERS, false);
crew = crew.filter(function(obj) {
return ((obj.type === DROID
&& obj.player === NEW_PARADIGM
&& !camIsTransporter(obj)
&& !camIsSystemDroid(obj))
|| (obj.type === FEATURE && obj.stattype === ARTIFACT)
);
});
for (var i = 0, l = crew.length; i < l; ++i)
{
var obj = crew[i];
if (obj.type === FEATURE && obj.stattype === ARTIFACT)
{
enemyStoleArtifact = true;
}
camSafeRemoveObject(obj, false);
}
var obj = crew[i];
camSafeRemoveObject(obj, false);
}
}
}
function eventTransporterExit(transport)
{
if (transport.player === NEW_PARADIGM && camDef(enemyStoleArtifact) && enemyStoleArtifact)
if (transport.player === NEW_PARADIGM)
{
gameOverMessage(false);
if (enemyStoleArtifact)
{
gameOverMessage(false);
}
}
}
@@ -197,6 +187,7 @@ 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");
@@ -292,5 +283,5 @@ function eventStartLevel()
hackAddMessage("C1-7_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER, true); //Canyon
queue("enableReinforcements", 15000);
queue("getArtifact", 120000);
queue("getArtifact", time);
}
@@ -149,19 +149,16 @@ function laserSatFuzzyStrike(obj)
//Introduce some randomness
var xRand = camRand(2);
var yRand = camRand(2);
var xCoord = camRand(2) ? LOC.x - xRand : LOC.x + xRand;
var yCoord = camRand(2) ? LOC.y - yRand : LOC.y + yRand;
camTrace("targeting at: " + xCoord + " " + yCoord);
if (xCoord < 0)
{
xCoord = 0;
}
else if (xCoord > mapWidth)
{
xCoord = MAP_WIDTH;
xCoord = mapWidth;
}
if (yCoord < 0)
@@ -173,24 +170,27 @@ function laserSatFuzzyStrike(obj)
yCoord = mapLimit;
}
camTrace("firing at: " + xCoord + " " + yCoord);
playSound(LASSAT_FIRING, xCoord, yCoord);
if (camRand(101) < 40)
{
playSound(LASSAT_FIRING, xCoord, yCoord);
}
fireWeaponAtLoc(xCoord, yCoord, "LasSat");
}
//Donate the silos to the player. Allow capturedSilos victory flag to be true.
function allySiloWithPlayer()
{
playSound("pcv621.ogg"); //Objective captured
hackRemoveMessage("CM3D1_OBJ1", CAM_HUMAN_PLAYER);
hackRemoveMessage("CM3D1_OBJ1", PROX_MSG, CAM_HUMAN_PLAYER);
camAbsorbPlayer(SILO_PLAYER, CAM_HUMAN_PLAYER);
capturedSilos = true;
}
//Check if the silos still exist and only allow winning if the player captured them.
function checkMissileSilos()
{
if (!enumArea("missileSilos", ALL_PLAYERS, false).length)
if (!countStruct("NX-ANTI-SATSite", CAM_HUMAN_PLAYER)
&& !countStruct("NX-ANTI-SATSite", SILO_PLAYER))
{
playSound("pcv622.ogg"); //Objective failed.
return false;

0 comments on commit 10b39fc

Please sign in to comment.