Results 1 to 10 of 10

Thread: Setting up an airfield as a target/objective

  1. #1
    Manual Creation Group ATAG_Ezzie's Avatar
    Join Date
    Feb 2014
    Posts
    2,301
    Post Thanks / Like
    Total Downloaded
    115.2 KB

    Setting up an airfield as a target/objective

    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

  2. #2
    Ace
    Join Date
    May 2013
    Location
    Stamford, Lincs, UK
    Posts
    1,033
    Post Thanks / Like
    Blog Entries
    8
    Total Downloaded
    7.46 MB

    Re: Setting up an airfield as a target/objective

    Ezzie,

    I think this code is based on code I wrote and posted some time back. If you can wait a couple of days till I've got time at the weekend, I'll post the full tutorial and explanation again.

  3. #3
    Manual Creation Group ATAG_Ezzie's Avatar
    Join Date
    Feb 2014
    Posts
    2,301
    Post Thanks / Like
    Total Downloaded
    115.2 KB

    Re: Setting up an airfield as a target/objective

    Thanks Reddog - that would be very much appreciated and I'm more than happy to wait a few days if you are able to post the explanation and tutorial - thanks in advance.

    I'm currently re-scouring the forums and sample missions looking for more clues re the airfield destruction scripting but will put that on hold now and move onto figuring out how to destroy non-airfield ground tgts (I have bridges, ports and rail yards in my mission). I think i have an idea how to do that but wont know for sure until i sit down and try and make it work. I expect i will have more questions....

    Thanks again- appreciate your assistance.

    Ezzie

  4. #4
    Veteran Combat pilot
    Join Date
    Aug 2012
    Posts
    211
    Post Thanks / Like
    Total Downloaded
    33.38 MB

    Re: Setting up an airfield as a target/objective

    how to make this script? A percentage destroyed is displayed and once a certain number of bombs have been dropped this reaches 100% and the airfield is destroyed.



    92 Sqn. Reddog (QJ-R) or Salmo if you have more infos...Appreciate your assistance.
    Last edited by nacy; Oct-26-2014 at 05:14.

  5. #5
    Veteran Combat pilot
    Join Date
    Aug 2012
    Posts
    211
    Post Thanks / Like
    Total Downloaded
    33.38 MB

    Re: Setting up an airfield as a target/objective

    Personne pour nous donner une info sur le code "percentage destroyed is displayed and once a certain number of bombs have been dropped this reaches 100% and the airfield is destroyed".

    ATAG fait "Unlocks" sur les codes?
    Last edited by nacy; Oct-27-2014 at 13:34.

  6. #6
    ATAG Member ATAG_Freya's Avatar
    Join Date
    Jan 2013
    Location
    Lethbridge, Alberta
    Posts
    3,592
    Post Thanks / Like
    Total Downloaded
    16.16 MB

    Re: Setting up an airfield as a target/objective

    Hi Nacy, I think this is how to make it a % instead of 'kg of bombs'. Compare with the code in first post.

    Code:
                        AirfieldTargetsDamage[ap] = AirfieldTargetsDamage[ap] + mass;
                        string sPercentDamage = null;
                        double dPercentDamage = (AirfieldTargetsDamage[ap] / AirfieldTargets[ap] * 100);
                        sPercentDamage = dPercentDamage.ToString("0");
                        GamePlay.gpHUDLogCenter(AirfieldTargetsName[ap] + " is " + sPercentDamage + "% destroyed");
    		    ///GamePlay.gpHUDLogCenter(AirfieldTargetsName[ap] + " is hit with " + AirfieldTargetsDamage[ap] + "kg of bombs");

  7. #7
    Veteran Combat pilot
    Join Date
    Aug 2012
    Posts
    211
    Post Thanks / Like
    Total Downloaded
    33.38 MB

    Re: Setting up an airfield as a target/objective

    OK thank you.

  8. #8
    Veteran Combat pilot
    Join Date
    Aug 2012
    Posts
    211
    Post Thanks / Like
    Total Downloaded
    33.38 MB

    Re: Setting up an airfield as a target/objective

    je ne comprends pas comment faire avec le code.

    ATAG_Freya pouvez-vous nous donner plus de détails avec une mission test (mis) avec le code (cs) merci.
    Last edited by nacy; Oct-27-2014 at 19:19.

  9. #9
    ATAG Member ATAG_Freya's Avatar
    Join Date
    Jan 2013
    Location
    Lethbridge, Alberta
    Posts
    3,592
    Post Thanks / Like
    Total Downloaded
    16.16 MB

    Re: Setting up an airfield as a target/objective

    Quote Originally Posted by nacy View Post
    je ne comprends pas comment faire avec le code.

    ATAG_Freya pouvez-vous nous donner plus de détails avec une mission test (mis) avec le code (cs) merci.
    Je vais voir si quelque chose peut vous être envoyé ...

    (used google for that, hope it says what I intended)

  10. #10
    Veteran Combat pilot
    Join Date
    Aug 2012
    Posts
    211
    Post Thanks / Like
    Total Downloaded
    33.38 MB

    Re: Setting up an airfield as a target/objective

    Merci encore de votre aide.
    Thanks again your assistance.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •