Yes that sounds interesting so i could upload my campaign when I've finished making it.
This is the mission.abl for being able to capture a MobileHQ and four units under its command;
//*********************************************************************************
module rdmap2 : integer;
//--------------------------------------------------------
// Mission Name: rdmap2
// Created: 14/02/15
//--------------------------------------------------------
//------------------------------------------------------------------
// Constant Definitions
//------------------------------------------------------------------
const
#include_ "misconst.abi"
//------------------------------------------------------------------
// Type Definitions
//------------------------------------------------------------------
type
//------------------------------------------------------------------
// Variable Declarations
//------------------------------------------------------------------
var
static integer ScenarioResult;
eternal real gametime;
static real nextsecond;
eternal boolean GeneralAlarm;
static boolean PlayPASound;
static boolean PlayGASound;
eternal integer GeneralAlarmCounter;
boolean PerimeterBreach;
//------------------------------------------------
// Mission Specific Variables
//------------------------------------------------
static integer[12] UnitList; // defines an array to hold vehicle ID's
static boolean GotaHQ; // Sets a check for not repeating this once captured
static integer MobileHQ; // defines the MobileHQ UnitID by editor SquadID
static integer Unit1; // defines a unit under the MHQ command by editor SquadID
static integer Unit2; // defines a unit under the MHQ command by editor SquadID
static integer Unit3; // defines a unit under the MHQ command by editor SquadID
static integer Unit4; // defines a unit under the MHQ command by editor SquadID
//------------------------------------------------------------------
// Init Function (automatically run first time through)
//------------------------------------------------------------------
function init;
code
ScenarioResult = PLAYING;
NextSecond = 1.0;
GeneralAlarmCounter = -1;
GeneralAlarm = FALSE;
PlayPASound = FALSE;
PlayGASound = FALSE;
//------------------------------------------------
// Mission Specific initializations
//------------------------------------------------
//Airstrikes, sensors, copters, artillery, minelayers, repair trucks & salvage craft have all been disabled in the editor/mission.fit
//----------------------------------------------------------------------------------------
//**You Can Edit This ** This lists the squadID's for the units under a Mobile HQ's control
//----------------------------------------------------------------------------------------
MobileHQ = 4; // The editor SquadID for the MobileHQ
Unit1 = 5; // The editor SquadID for a unit under command from this HQ
Unit2 = 6; // The editor SquadID for a unit under command from this HQ
Unit3 = 7; // The editor SquadID for a unit under command from this HQ
Unit4 = 8; // The editor SquadID for a unit under command from this HQ
//----------------------------------------------------------------------------------------
// **End Editable Section **
//----------------------------------------------------------------------------------------
GotaHQ = FALSE; // Open the captured loop check
// Here we convert the given SquadID's into Part/VehicleID's and set the MHQ to be capturable
GetUnitMates(MobileHQ,UnitList); // Gets the Vehicle ID from the editor SquadID and stores it in the list array
MobileHQ = UnitList[0]; // Assigns the VehID to this name
SetCapturable(MobileHQ,TRUE); // Sets the unit to be capturable
GetUnitMates(Unit1,UnitList); // Gets the Vehicle ID from the editor SquadID and stores it in the list array
Unit1 = UnitList[0]; // Assigns the VehID to this name
GetUnitMates(Unit2,UnitList); // Gets the Vehicle ID from the editor SquadID and stores it in the list array
Unit2 = UnitList[0]; // Assigns the VehID to this name
GetUnitMates(Unit3,UnitList); // Gets the Vehicle ID from the editor SquadID and stores it in the list array
Unit3 = UnitList[0]; // Assigns the VehID to this name
GetUnitMates(Unit4,UnitList); // Gets the Vehicle ID from the editor SquadID and stores it in the list array
Unit4 = UnitList[0]; // Assigns the VehID to this name
endfunction;
//------------------------------------------------------------------
// Main Code
//------------------------------------------------------------------
code
//------------------------------------------------
// Debug Window Game Clock Second Counter
// Note: This is used by some ingame functions.
// I think it's used by the mission timer and if there are any perimeter towers
//------------------------------------------------
// Used by many functions as a general time counter
gametime = gettime;
If (gametime >= nextsecond) Then
nextsecond = gametime + 1;
If (GeneralAlarm) then
GeneralAlarmCounter = GeneralAlarmCounter + 1;
endif;
endif;
// Plays a general alert at some point
if ((PlayGASound) and (NextSecond == gametime + 1)) then
playSoundEffect(GENERAL_ALARM_SOUND);
endif;
// Loops playing the perimeter breach sound if there is one in the map
if (PlayPASound) then
playSoundEffect(PERIMETER_ALARM_SOUND);
endif;
PerimeterBreach = FALSE;
//---------------------------------------
// Mission Specific Code
//---------------------------------------
if (GotaHQ == FALSE) then // If the HQ is not captured ...
if (objectside(MobileHQ) == 500) then // when it is captured...on the player side 500, 501 = enemy, 502 = ally
addmovertoplayer(MobileHQ, 0, 2); // set this unit to the player team, ally commander
addmovertoplayer(Unit1, 0, 0); // set this unit to the player team, player commander
addmovertoplayer(Unit2, 0, 0); // set this unit to the player team, player commander
addmovertoplayer(Unit3, 0, 0); // set this unit to the player team, player commander
addmovertoplayer(Unit4, 0, 0); // set this unit to the player team, player commander
SetBrain(Unit1, "pbrain"); // make the unit repond to player commands
SetBrain(Unit2, "pbrain"); // make the unit repond to player commands
SetBrain(Unit3, "pbrain"); // make the unit repond to player commands
SetBrain(Unit4, "pbrain"); // make the unit repond to player commands
// Alert the player by pop-up message that some units have come directly into thier command
SetTextMsg(1," MechWarrior Report -
Commander, the units under command from this MobileHQ have agreed to work for us until our mission is complete,
or they are dead. ",1);
GotaHQ = TRUE; // Close the loop
endif;
endif;
//---------------------------------------
// END SCENARIO
//---------------------------------------
if (getMissionStatus <> PLAYING) then
//Just set scenarioResult to 9999 here and you're all set!!
endif;
//---------------------------------------
return (ScenarioResult);
//---------------------------------------
endmodule.
//******************************************************************
It works very well. I don't understand why it won't work as a warriorbrain;
//----------------------------------------------------------------------------------------
// Captureable Unit Warrior Brain for Mech Commander Omnitech
// Created by RustyDios 12 / Feb / 15
// RustyDios_UniversalWarriorBrain_FreeSupportUnit
//----------------------------------------------------------------------------------------
// The original was copied from the null_order warrior brain
// CREATED:10/14/98 BY:Mike Lee
// This is a 'Do nothing' warrior brain that defects to the player side when captured
// Useful for units with weapons by proxy
// Basically giving the player a free lance, should they find and capture the MHQ
// To use this brain the MHQ should be initially set to the ally team in the editor
//
// By default this brain assumes that SquadID's 1,2,3 are the player dropzone locations
// 4 is actually this unit
// and 5,6,7,8 are the units under it's command
//----------------------------------------------------------------------------------------
fsm RD_UWB_MHQ; //does NOT need to be unique for each vehicle in map
// but you will need to have multiple file copies if you have more then one MHQ in one map
// with different squad ID's under it's command
//----------------------------------------------------------------------------------------
var
static integer Order1Status; // Defines Order1
static boolean GotaHQ; // Sets a check for not doing this once captured
static boolean HQDead; // Sets a check for not checking if dead, once dead
static integer[12] UnitList; // defines an array to hold vehicle ID's
static integer MobileHQ; // defines the MobileHQ UnitID by editor SquadID
static integer Unit1; // defines a unit under the MHQ command by editor SquadID
static integer Unit2; // defines a unit under the MHQ command by editor SquadID
static integer Unit3; // defines a unit under the MHQ command by editor SquadID
static integer Unit4; // defines a unit under the MHQ command by editor SquadID
//----------------------------------------------------------------------------------------
// Initialise Warrior Brain. This code is run Once only and sets up the unit behaviour
//----------------------------------------------------------------------------------------
function Init;
code
//----------------------------------------------------------------------------------------
//**You Can Edit This ** This lists the squadID's for the units under this units control
//----------------------------------------------------------------------------------------
MobileHQ = 4; // The editor SquadID for the MobileHQ
Unit1 = 5; // The editor SquadID for a unit under command from this HQ
Unit2 = 6; // The editor SquadID for a unit under command from this HQ
Unit3 = 7; // The editor SquadID for a unit under command from this HQ
Unit4 = 8; // The editor SquadID for a unit under command from this HQ
//----------------------------------------------------------------------------------------
// **End Editable Section **
//----------------------------------------------------------------------------------------
//include_ "UBInit.abi",the only thing in UBInit.abi is the below line
// why include a whole file for one line?
//DefaultBrain;
// OrderStatus, this sets up the unit to only do the startup routine once
Order1Status = INCOMPLETE;
SetEngageRadius(0); // Don't engage anything
IdentifySensorContactsOFF; // Don't call out sensor contacts
MoveToEngageOFF; // Don't move
StopFighting; // Don't fight
ReturnFireOFF; // Don't fight if attacked
SetWillHelp(FALSE); // Don't go to help our mates
SetCapturable(GetID,TRUE); // Sets the unit to be capturable
GotaHQ = FALSE; // Open the captured loop check
// Here we convert the given SquadID's into VehicleID's
GetUnitMates(MobileHQ,UnitList); // Gets the Vehicle ID from the editor SquadID and stores it in the list array
MobileHQ = UnitList[0]; // Assigns the VehID to this name
GetUnitMates(Unit1,UnitList); // Gets the Vehicle ID from the editor SquadID and stores it in the list array
Unit1 = UnitList[0]; // Assigns the VehID to this name
GetUnitMates(Unit2,UnitList); // Gets the Vehicle ID from the editor SquadID and stores it in the list array
Unit2 = UnitList[0]; // Assigns the VehID to this name
GetUnitMates(Unit3,UnitList); // Gets the Vehicle ID from the editor SquadID and stores it in the list array
Unit3 = UnitList[0]; // Assigns the VehID to this name
GetUnitMates(Unit4,UnitList); // Gets the Vehicle ID from the editor SquadID and stores it in the list array
Unit4 = UnitList[0]; // Assigns the VehID to this name
endfunction;
//----------------------------------------------------------------------------------------
// Main Code
//----------------------------------------------------------------------------------------
state start;
code
//Initialize Orders Library
initOrders;
// Order1 - ie the do nothing set up
if (TRUE) then
if (Order1Status == INCOMPLETE) then
SetEngageRadius(0);
Order1Status = SUCCESS;
endif;
endif;
if (GotaHQ == FALSE) then // If the HQ is not captured ...
if (objectside(MobileHQ) == 500) then // when it is captured...on the player side 500, 501 = enemy, 502 = ally
addmovertoplayer(MobileHQ, 0, 2); // set this unit to the ally commander, so this doesn't get done again!
addmovertoplayer(Unit1, 0, 0); // set this unit to the player commander
addmovertoplayer(Unit2, 0, 0); // set this unit to the player commander
addmovertoplayer(Unit3, 0, 0); // set this unit to the player commander
addmovertoplayer(Unit4, 0, 0); // set this unit to the player commander
SetBrain(Unit1, "pbrain"); // make the unit repond to player commands
SetBrain(Unit2, "pbrain"); // make the unit repond to player commands
SetBrain(Unit3, "pbrain"); // make the unit repond to player commands
SetBrain(Unit4, "pbrain"); // make the unit repond to player commands
// Alert the player by pop-up message that some units have come directly into thier command
SetTextMsg(1," MechWarrior Report -
Commander, the units under command from this MobileHQ have agreed to work for us until our mission is complete,
or they are dead. ",1);
GotaHQ = TRUE; // Close the loop
endif;
endif;
endstate;
//--------------------------------------------------------------------------------------------
endfsm.
It does work, but both the MobileHQ AND the first unit go direct to the ally commander, the other three units go to the player ?!? Any Ideas?
I've also put together a list of all the ABL commands, see the separate thread.
And I believe the trick to not get people/enemy/computer ai/turrets to not target resource trucks was in the command "SetPotentialContact(PartID,Integer)" .... but I can't find any of my old MCG scripts that used it, and can't get it working in MCO... ...