Results 1 to 4 of 4

Thread: Starting a Random Sub-mission with a random time

  1. #1
    Student Pilot
    Join Date
    Feb 2022
    Posts
    10
    Post Thanks / Like
    Total Downloaded
    40.54 MB

    Starting a Random Sub-mission with a random time

    I've got the script working from here:

    https://theairtacticalassaultgroup.c...ad.php?t=13953

    Using this to insert one mission at the start:

    Code:
    using System;
    using System.Collections;
    using maddox.game;
    using maddox.game.world;
    using part;
    using System.Collections.Generic;
    using System.IO;
    
    public class Mission : AMission
    {
        // global variables
        private static string userdocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);   // DO NOT CHANGE
        private static string CLOD_PATH = userdocpath + @"/1C SoftClub/il-2 sturmovik cliffs of dover/";  // DO NOT CHANGE
        private static string FILE_PATH = @"missions/Single/BoF1/";   // mission install directory (CHANGE AS NEEDED)
        Random RandomIncident = new Random();
    
        public override void OnBattleStarted()
        {
            base.OnBattleStarted();
    
            List<string> RandomMissions = GetFilenamesFromDirectory(CLOD_PATH + FILE_PATH + "/mis", "BoF"); // bomber missions from the red directory
            if (RandomMissions.Count > 0)
            {
                 string RandomMission = RandomMissions[RandomIncident.Next(RandomMissions.Count)];
                 GamePlay.gpPostMissionLoad(RandomMission);
            }
        }
    
        public List<string> GetFilenamesFromDirectory(string dirPath, string mask = null)
        {
            List<string> list = new List<string>();
            string[] filenames = Directory.GetFiles(dirPath, "*" + mask + "*.mis");
            list = new List<string>(filenames);
            return list;
        }
    
    }
    But I'd like it to insert missions at a Random time interval between 1-10 minutes or so after mission start. And for the life of my I can't figure out how to make that happen.

    If anyone's curious, I'm trying to replicate the "Phony War" a bit by having a Hurricane squadron patrol France with the chance of only running into 1 or 2 German aircraft. Each MIS file in my folder has maybe 1 or 2 Recon planes on different paths, with a few missions that have a larger force to shake things up a bit. Really just a way for my to practice my gunnery.

    Any clues?

    Also was trying to add a "random weather" script from another post, but I think that's WAY beyond my capabilities.

  2. Likes FTC_Rostic liked this post
  3. #2
    Combat pilot FTC_Rostic's Avatar
    Join Date
    Nov 2023
    Posts
    206
    Post Thanks / Like
    Total Downloaded
    37.38 MB

    Re: Starting a Random Sub-mission with a random time

    Quote Originally Posted by Napping-Man View Post
    ...

    But I'd like it to insert missions at a Random time interval between 1-10 minutes or so after mission start. And for the life of my I can't figure out how to make that happen.

    ...
    There is example ho to start anything by timeout...
    https://theairtacticalassaultgroup.c...l=1#post394775

    I hope you know how to get a random number and pass it to that function.
    PC spec: Intel Core i7 8700K 3.7Ghz, DDR4 32Gb 2666Mhz, Asus Prime Z370-A, ADATA XPG SX8200 240Gb (PCIe Gen3x4), RTX 2060 6Gb
    Monitor: DELL P2717H (1920x1080:60Hz)
    Joystick: Android smartphone MonectPC app (virtual joystick driver)
    Hadtracker: Track IR 4 / No VR

    Enjoy multiplayer historical campaigns with Flying Tin Cans.
    Join us: https://flyingtincans.com —(•)— Discord —(•)— YouTube


  4. Likes Napping-Man liked this post
  5. #3
    Team Fusion
    Join Date
    Oct 2018
    Location
    Toronto, Ontario
    Posts
    827
    Post Thanks / Like
    Total Downloaded
    3.95 GB

    Re: Starting a Random Sub-mission with a random time

    Why not replicate the phony war with actual historical missions? Happy to help with research.
    Lenny
    Desktop - Alienware R10, AMD Ryzen 9 5950X, 64Gb DDR4-3400Mhz OC 3734Mhz, Dell RTX 3090 24Gb (512.15), Dell 3221QS (4K @ 60Hz), Win 11 (22000.567), C Drive Steam default, Reverb G2, WMR SteamVR beta - 100% (3160x3088), TM Warthog Throttle/Stick, TM T-Rudder, TM MFDx2, Razer Tartarus Pro
    Laptop - Dell G7 7590, Intel i7-8750H, 64Gb DDR-2666Mhz, GPU0 Intel UHD 630 1Gb GPU1 Dell RTX 2060 6Gb (512.15), BenQ EX3203R (3K @ 60Hz), Win 11 (22000.567), C drive Steam default, Samsung Odyssey+, WMR SteamVR beta - 100% (1440x1796), TM T16000M, TM TWCS

  6. #4
    Student Pilot
    Join Date
    Feb 2022
    Posts
    10
    Post Thanks / Like
    Total Downloaded
    40.54 MB

    Re: Starting a Random Sub-mission with a random time

    Thought about it. I've got the Osprey Hurricane Aces 1939-40 which has a pretty good section of this time. But in the end, I just wanted a basic "random" encounter that allowed me to practice some navigation and gunnery. The "Phoney War" seemed like a good back-drop.

  7. Likes ATAG_Lenny liked this post

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
  •