Hello again,
After getting my basic HUD msg script working I've now moved on to try something a bit more complicated. In my proposed ATAG mission airfields will be one of the main tgt sets so I'm trying to figure out how to set this up. I'm not going to be adventurous as I'm happy to use (at this stage) what appears to be the standard method used on the ATAG missions ie bombs are dropped on the field, a percentage destroyed is displayed and once a certain number of bombs have been dropped this reaches 100% and the airfield is destroyed.
I've spent a few hours going thru the various script threads and have come across some stuff which seem to provide relevant info, but i cant yet find a single 'How to create an airfield tgt for a MP mission'. So i thought i would try and work it out and write it down so helpful people can correct my errors and its then available for future use for newbies like me struggling to work this all out.
My problem (the first of many) is where to start. I've had a look in the FMB and wondered if i could create a trigger for Tground destroyed and somehow link that to the airfield? This trigger has a percentage destruction slider and you can set the radius it seems. But i couldnt see any way to specify the kg required to destroy the base so i figured that this wasnt the approach that is used on the ATAG server missions.
Looking thru the various script forums i came across these lines of code which seem to relate to bomb explosions and mass and location and damage so I'm thinking they might be part of the puzzle?
Code:
public override void OnBombExplosion(string title, double mass, Point3d pos, AiDamageInitiator initiator, int eventArgInt)
{
base.OnBombExplosion(title, mass, pos, initiator, eventArgInt);
And then i saw these lines from one of Gruber's posts and these look like the answer or at least a good chunk of the answer - i think?
Code:
public override void OnBombExplosion(string title, double mass, Point3d pos, AiDamageInitiator initiator, int eventArgInt)
{
base.OnBombExplosion(title, mass, pos, initiator, eventArgInt);
foreach (AiAirport ap in AirfieldTargets.Keys)
{
if (AirfieldTargetsDamage[ap] >= AirfieldTargets[ap])
{//damage greater than or equal to that required to knock out so no need to add or further process
}
else
{
//Damage not greater than or equal to so need check if bomb fell inside radius and if so increment up
if (ap != null & ap.Pos().distance(ref pos) <= ap.FieldR())
{
AirfieldTargetsDamage[ap] = AirfieldTargetsDamage[ap] + mass;
GamePlay.gpHUDLogCenter(AirfieldTargetsName[ap] + " is hit with " + AirfieldTargetsDamage[ap] + "kg of bombs");
if ((AirfieldTargetsDamage[ap] >= AirfieldTargets[ap]) && (AirfieldTargetsName[ap].Contains("Tangmere")))
{
LoadAirfieldSpawns(); //loads airfield spawns and removes inactive airfields.
InitialBlueObjectiveCount = InitialBlueObjectiveCount + BlueObjective23;
GamePlay.gpHUDLogCenter("AJ20.2 - RAF Tangmere destroyed!!!");
double initTime = 0.0;
Timeout(initTime += 10, () =>
{
GamePlay.gpLogServer(null, "AJ20.2 - RAF Tangmere destroyed!!!", new object[] { });
Objective_Total_Blue += (Objective_W);
});
}
So it seems that AirfieldTargets. Keys is the list of all airfield targets in the mission? If so - how do i set up this list? Or, are all active airfields automatically on this list and the assigned airfield objective targets taken from within this list (ie only destruction of the objective airfields count towards rolling the map?)
And does AirfieldTargets[ap] define the mass of bombs (in kgs) required to destroy the airfield? If so, does it apply uniformly to all airfields or can it be specified individually (ie some airfields require more mass of bombs than others?)
And re this line if (ap != null & ap.Pos().distance(ref pos) <= ap.FieldR()); Does this line determines if the bomb explodes within the airfield radius (capture radius defined when creating the airfield?) and if it does then the mass of the bomb is added to the running damage count (AirfieldTargetsDamage[ap])?
So to set this up i need to
(a) Create all my airfields on my map - this will populate the AirfieldsTargets. Keys class?
(b) Work out how much weight of bombs i want to destroy the airfields and ........<i have no idea what i do here>
(c) Create a list of airfield objective targets (ie a smaller subset of all airfield targets) and use Gruber's script linking their name (ie Tangmere) with achieving 100% damaged and this then counts towards an objective.
Am i on the right path?
Ezzie
Bookmarks