Permalink
Browse files

More for cam3-b mission.

- Cam3-b: Check that transporter only comes to a base if there are Nexus
structures in them.
- Cam2-b: Change morale of ambush group so that it runs away later.
- Libcampaign: Allow an optional player to be passed to
camCountStructuresInArea().
  • Loading branch information...
KJeff01 committed Jan 5, 2018
1 parent 4d6ff70 commit df29772f5470d6020fb126f11f0a963c1c443774
@@ -68,7 +68,7 @@ function ambushPlayer()
{
camManageGroup(camMakeGroup("centralBaseGroup"), CAM_ORDER_ATTACK, {
fallback: camMakePos("COCybFacR-b2Assembly"),
morale: 20,
morale: 50,
regroup: false,
});
}
@@ -95,7 +95,8 @@ function getDroidsForNXLZ(isTransport)
//Send Nexus transport units
function sendNXTransporter()
{
if (!enumArea("NXEastBaseCleanup", NEXUS, false).length && !enumArea("NXWestBaseCleanup", NEXUS, false).length)
if (camCountStructuresInArea("NXEastBaseCleanup", NEXUS) === 0
&& camCountStructuresInArea("NXWestBaseCleanup", NEXUS) === 0)
{
return; //Call off transport when both west and east Nexus bases are destroyed.
}
@@ -105,13 +106,13 @@ function sendNXTransporter()
var lzNum;
var pos;
if (enumArea("NXEastBaseCleanup", NEXUS, false).length)
if (camCountStructuresInArea("NXEastBaseCleanup", NEXUS) > 0)
{
lzNum = 1;
pos = "nexusEastTransportPos";
}
if (enumArea("NXWestBaseCleanup", NEXUS, false).length && (camRand(2) || !camDef(pos)))
if (camCountStructuresInArea("NXWestBaseCleanup", NEXUS) > 0 && (camRand(2) || !camDef(pos)))
{
lzNum = 2;
pos = "nexusWestTransportPos";
@@ -233,11 +233,15 @@ function camRemoveDuplicates(array)
});
}
//;; \subsection{camCountStructuresInArea(label)}
//;; \subsection{camCountStructuresInArea(label, [player])}
//;; Mimics wzscript's numStructsButNotWallsInArea().
function camCountStructuresInArea(lab)
function camCountStructuresInArea(lab, player)
{
var list = enumArea(lab, CAM_HUMAN_PLAYER, false);
if (!camDef(player))
{
player = CAM_HUMAN_PLAYER;
}
var list = enumArea(lab, player, false);
var ret = 0;
for (var i = 0, l = list.length; i < l; ++i)
{

0 comments on commit df29772

Please sign in to comment.