Page 2 of 2 FirstFirst 12
Results 31 to 33 of 33

Thread: Campaign progress script

  1. #31
    Team Fusion ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    839
    Post Thanks / Like
    Total Downloaded
    850.25 MB

    Re: Campaign progress script

    Quote Originally Posted by GANIX View Post
    Sorry, it should be 'CS' file



    Attachment 53078
    It looks like a debug directive that the developer used when making the mission. But what you posted would not compile. You need to post a sample file or link so I can see exactly what you are talking about.
    Last edited by ATAG_Oskar; Mar-25-2022 at 14:57.

  2. #32
    Novice Pilot
    Join Date
    Oct 2021
    Posts
    41
    Post Thanks / Like
    Total Downloaded
    9.18 MB

    Re: Campaign progress script

    All files that are in my screenshot are 'official' Cliffs files.

    Enclosed you find the <109 Furball.cs>

    Code:
    //$reference Campaign.dll
    //-$debug
    using System;
    using maddox.game;
    using maddox.game.world;
    using System.Collections.Generic;
    
    public class Mission : maddox.game.campaign.Mission {
    
        AiActor a1, a2, a4;
        AiAircraft airc1, airc2, airc4;
    
        public override void OnBattleStarted() {
            base.OnBattleStarted();
            a1 = GamePlay.gpActorByName("0:BoB_RAF_F_FatCat_Early.001");
            a2 = GamePlay.gpActorByName("0:BoB_RAF_F_FatCat_Early.002");
            a4 = GamePlay.gpActorByName("0:BoB_RAF_F_FatCat_Early.010");
    
    
            if (a1 == null || a2 == null || a4 == null) {
                System.Console.WriteLine("SCRIPR ERROR: Aircraft not found");
            }
    
            airc1 = (AiAircraft)a1;
            airc2 = (AiAircraft)a2;
            airc4 = (AiAircraft)a4;
        }
    
        bool beforeAttack = false;
        bool afterAttack = false;
    
        public override void OnTickGame() {
            if (!beforeAttack && GamePlay.gpTime().current() > 300.0) {
                AiAirGroupTask t = airc1.AirGroup().getTask();
                if (t == AiAirGroupTask.ATTACK_AIR) {
                    beforeAttack = true;
                    if (airc1.Person(0) != null &&
                        airc1.Person(0).Health > 0.6) {
                        airc1.SayToGroup(airc1.AirGroup(), "There_they_are_men_Gunsights_on_safeties_off");
                        if (airc4.Person(0) != null && airc1.Person(0) != null &&
                            airc4.Person(0).Health > 0.6 && airc1.Person(0).Health > 0.6) {
                            Timeout(5.0, () => {
                                airc4.SayToGroup(airc2.AirGroup(), "Good_luck_gentlemen");
                            });
                        }
                    }
                }
            }
            if (beforeAttack && !afterAttack) {
                AiAirGroupTask t = airc1.AirGroup().getTask();
                if (t == AiAirGroupTask.FLY_WAYPOINT) {
                    afterAttack = true;
                    if (airc4.Person(0) != null &&
                        airc4.Person(0).Health > 0.6) {
                        airc4.SayToGroup(airc1.AirGroup(), "Ha_We_re_coming_out_on_top");
                    }
                    if (airc2.Person(0) != null &&
                        airc2.Person(0).Health > 0.6) {
                        Timeout(5.0, () => {
                            airc2.SayToGroup(airc2.AirGroup(), "I_think_the_German_s_ready_to_head_back_to_base");
                        });
                    }
                    if (airc1.Person(0) != null &&
                        airc1.Person(0).Health > 0.6) {
                        Timeout(15.0, () => {
                            airc1.SayToGroup(airc1.AirGroup(), "Good_show_everyone");
                        });
                    }
                }
            }
        }
    
    
        public override void OnTrigger(int missionNumber, string shortName, bool active) {
            if ("trigger01".Equals(shortName) && active) { // пролетаем побережье
                double initTime = 0.0;
                if (airc1.Person(0) != null &&
                    airc1.Person(0).Health > 0.6) {
                    Timeout(initTime += 5.0, () => {
                        airc1.SayToGroup(airc1.AirGroup(), "Remember_the_Hurricane_is_slower_than_the_109");
                    });
                    Timeout(initTime += 5.0, () => {
                        airc1.SayToGroup(airc1.AirGroup(), "Don_t_climb_with_them_and_don_t_dive_away_from_them");
                    });
                    Timeout(initTime += 5.0, () => {
                        airc1.SayToGroup(airc1.AirGroup(), "Try_to_get_them_into_a_turning_fight_And_work_in_groups");
                    });
                    Timeout(initTime += 5.0, () => {
                        airc1.SayToGroup(airc1.AirGroup(), "If_you_get_a_Messerschmitt_following_you_in_a_turn");
                    });
                    Timeout(initTime += 10.0, () => {
                        airc1.SayToGroup(airc1.AirGroup(), "Ask_for_help_Someone_will_get_him_off_you_while_he_s_an_easy_target");
                    });
                }
                if (airc2.Person(0) != null &&
                    airc2.Person(0).Health > 0.6) {
                    Timeout(initTime += 8.0, () => {
                        airc2.SayToGroup(airc2.AirGroup(), "And_if_see_someone_in_trouble_drop_what_you_re_doing_and_go_help_them");
                    });
                }
                if (airc1.Person(0) != null &&
                    airc1.Person(0).Health > 0.6) {
                    Timeout(initTime += 5.0, () => {
                        airc1.SayToGroup(airc1.AirGroup(), "Most_importantly_stay_in_formation");
                    });
                    Timeout(initTime += 5.0, () => {
                        airc1.SayToGroup(airc1.AirGroup(), "If_our_formations_fall_apart_we_ll_all_get_shot_down_one_after_another");
                    });
                    Timeout(initTime += 5.0, () => {
                        airc1.SayToGroup(airc1.AirGroup(), "Wingmen_protect_your_leaders_");
                    });
                }
                GamePlay.gpGetTrigger(shortName).Enable = false;
            }
        }
    
        int countEnemyDead = 0;
        int countFriendDead = 0;
    
        public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> initiatorList) {
            if (actor is AiAircraft) {
                if (actor.Army() == 2) { // сбили врага
                    countEnemyDead++;
                } else { // наши потери
                    countFriendDead++;
                }
            }
        }
    
        private void checkLanded(AiAircraft aircraft) {
            if (GamePlay.gpPlayer().Place() != aircraft)
                return;
    
            bool complete = ((countEnemyDead - countFriendDead) >= 0);
    
            if (Campaign != null) {
                if (Campaign.battleSuccess != null)
                    return;
                Campaign.battleSuccess = complete;
            }
            if (complete) {
                GamePlay.gpHUDLogCenter("MISSION COMPLETE");
            }
            Timeout(20.0, () => {
                GamePlay.gpHUDLogCenter("Press Esc to end mission.");
            });
        }
    
        public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft) {
            checkLanded(aircraft);
        }
        public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft) {
            checkLanded(aircraft);
        }
    }
    Attached Images Attached Images

  3. #33
    Novice Pilot
    Join Date
    Oct 2021
    Posts
    41
    Post Thanks / Like
    Total Downloaded
    9.18 MB

    Re: Campaign progress script

    Okay, I'm very sorry that my question has nothing to do with white pixels or VR glasses ...

  4. Likes Little Bill liked this post
Page 2 of 2 FirstFirst 12

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
  •