Results 1 to 20 of 20

Thread: Help with my Tab 4 mission menu script

  1. #1
    Student Pilot
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Total Downloaded
    0

    Help with my Tab 4 mission menu script

    I am trying to create a custom mission menu that can be accessed using Tab 4. I found some old scripts for this and chopped them into two parts that I put together. The plan is that when you go into the menu, you will be able to select, for this particular mission at least, He111's, Stukas, Ju88's, or Blennies that will trigger the game to load a mission that correlates to that selection. I'm a complete rookie to c# but am learning. I plan to put conditions on things like how often you can make particular menu selections but right now I'm just trying to get my menu to work. This is what I have and it's not working for me:


    using System;
    using System.Collections;
    using maddox.game;
    using maddox.game.world;

    public class Mission : AMission
    {

    private void setMainMenu(Player player)
    {
    GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[] { "Missions" },
    new bool[] { true });
    }

    private void setSubMenu(Player player)
    {
    GamePlay.gpSetOrderMissionMenu(player, true, 1, new string[] { "He111's", "Stukas",
    "Ju-88s", "Blennies", "Blennies2"}, new bool[] { false, false, false, false, false });
    }

    public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex)
    {
    if (ID == 0)
    { // main menu
    if (menuItemIndex == 1)
    {
    setSubMenu(player);
    }
    }
    else if (ID == 1)
    { // sub menu
    if (menuItemIndex == 1)
    {
    GamePlay.gpHUDLogCenter("He111's warming up");
    GamePlay.gpPostMissionLoad("missions\he111s.mis");

    setMainMenu(player);
    }
    else if (menuItemIndex == 2)
    {
    GamePlay.gpHUDLogCenter("Stukas warming up");
    GamePlay.gpPostMissionLoad("missions\stukas.mis");

    setMainMenu(player);
    }
    else if (menuItemIndex == 3)
    {
    GamePlay.gpHUDLogCenter("Ju-88s warming up");
    GamePlay.gpPostMissionLoad("missions\ju88s.mis");

    setMainMenu(player);
    }
    else if (menuItemIndex == 4)
    {
    GamePlay.gpHUDLogCenter("Blennies warming up");
    GamePlay.gpPostMissionLoad("missions\blennies.mis" );

    setMainMenu(player);
    }
    else if (menuItemIndex == 5)
    {
    GamePlay.gpHUDLogCenter("Blennies warming up");
    GamePlay.gpPostMissionLoad("missions\blennies2.mis ");

    setMainMenu(player);
    }
    }

    }

    public override void OnPlayerConnected(Player player)
    {
    if (MissionNumber == 0)
    {
    setMainMenu(player);
    }
    }

    public override void Inited()
    {
    if (MissionNumber == 0)
    {
    setMainMenu(GamePlay.gpPlayer());
    }
    }
    }


    The original scripts are from:
    http://forum.1cpublishing.eu/showthread.php?t=25941
    http://simhq.com/forum/ubbthreads.ph...s/3385237.html

    I would really appreciate anyone's help here. I have all the files that go with this mission in missions directory and my .cs file has the same name as the .mis file. Thanks

  2. #2
    Team Fusion Salmo's Avatar
    Join Date
    Nov 2011
    Posts
    2,332
    Post Thanks / Like
    Total Downloaded
    191.25 MB

    Re: Help with my Tab 4 mission menu script

    Code:
    using System;
    using System.Collections;
    using maddox.game;
    using maddox.game.world;
    
    public class Mission : AMission
    {
        #region CLOD CUSTOM MENU SYSTEM
        // Custom CLOD player menu system
        public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex)
        {
            base.OnOrderMissionMenuSelected(player, ID, menuItemIndex);
    
            if (player != null)
            {
                switch (ID)
                #region TAB-4 MENU OPTIONS
                {
                    #region TAB-4-0 MAIN MENU OPTION 0
                    case 0: // MAIN MENU ITEM 0
                        switch (menuItemIndex)
                        {
                            case 0: // Item 0
                                setMenu0_0(player);
                                break;
                            case 1: // Item 1
                                setMenu0_1(player);
                                break;
                            case 2: // Item 2
                                setMenu0_2(player);
                                break;
                            case 3: // Item 3
                                setMenu0_3(player);
                                break;
                            case 4: // Item 4
                                setMenu0_4(player);
                                break;
                            case 5: // Item 5
                                setMenu0_5(player);
                                break;
                            case 6: // Item 6
                                setMenu0_6(player);
                                break;
                            case 7: // Item 7
                                setMenu0_7(player);
                                break;
                            case 8: // Item 8
                                setMenu0_8(player);
                                break;
                            case 9: // Item 9
                                setMainMenu(player);
                                break;
                        }
                        break;
                    #endregion
    
                    #region TAB-4-1 MAIN MENU OPTION 1
                    case 1: // MAIN MENU ITEM 1
                        switch (menuItemIndex)
                        {
                            case 0: // Item 0
                                setMenu0_0(player);
                                break;
                            case 1: // Item 1
                                setMenu0_1(player);
                                break;
                            case 2: // Item 2
                                setMenu0_2(player);
                                break;
                            case 3: // Item 3
                                setMenu0_3(player);
                                break;
                            case 4: // Item 1
                                setMenu0_4(player);
                                break;
                            case 5: // Item 2
                                setMenu0_5(player);
                                break;
                            case 6: // Item 3
                                setMenu0_6(player);
                                break;
                            case 7: // Item 1
                                setMenu0_7(player);
                                break;
                            case 8: // Item 2
                                setMenu0_8(player);
                                break;
                            case 9: // Item 3
                                setMenu0_9(player);
                                break;
                        }
                        break;
                    #endregion
    
                    #region TAB-4-2 MAIN MENU OPTION 2 
                    case 2: // // MAIN MENU ITEM 2
                        switch (menuItemIndex)
                        {
                            case 1: // Item 1
                                // TAB - 4 - 2 - 1_Code_Here
                                setMainMenu(player);
                                break;
    
                            case 2: // Item 2
                                // TAB - 4 - 2 - 2_Code_Here
                                setMainMenu(player);
                                break;
    
                            case 3: // Item 3
                                // TAB - 4 - 2 - 3_Code_Here
                                setMainMenu(player);
                                break;
    
                            case 4: // Item 4
                                // TAB - 4 - 2 - 4 Code Here
                                setMainMenu(player);
                                break;
    
                            case 5: // Item 5
                                // TAB - 4 - 2 - 5 Code Here
                                setMainMenu(player);
                                break;
    
                            case 9: // Item 9
                                // TAB - 4 - 2 - 9 Code Here
                                setMainMenu(player);
                                break;
    
                        }
                        break;
                        #endregion
                }
                #endregion
            }
        }
    
        #region TAB-4 SET MAIN MENU
        private void setMainMenu(Player player)
        {   // TAB-4 SET MAIN MENU
            GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[]
            {
            "MAINMENU_Item1_Text",
            "MAINMENU_Item2_Text",
            "MAINMENU_Item3_Text",
            "MAINMENU_Item4_Text",
            "MAINMENU_Item5_Text",
            "MAINMENU_Item6_Text",
            "MAINMENU_Item7_Text",
            "MAINMENU_Item8_Text",
            "Exit"
            }, new bool[] { true, true, true, true, true, true, true, true, true });
        }
        #endregion
    
        #region TAB-4 SETMENU 0_1
        private void setMenu0_1(Player player)
        {   // TAB-4-1 Mission menu options SUBMENU
            GamePlay.gpSetOrderMissionMenu(player, true, 1, new string[]
            {
            "SUBMENU_Item1_Text",
            "SUBMENU_Item2_Text",
            "SUBMENU_Item3_Text",
            "SUBMENU_Item4_Text",
            "SUBMENU_Item5_Text",
            "SUBMENU_Item6_Text",
            "SUBMENU_Item7_Text",
            "SUBMENU_Item8_Text",
            "Back"
            }, new bool[] { true, true, true, true, true, true, true, true, true });
        }
        #endregion
    
        #region TAB-4 SETMENU 0_2
        private void setMenu0_2(Player player)
        {
            GamePlay.gpSetOrderMissionMenu(player, true, 1, new string[]
            {
            "SUBMENU_Item1_Text",
            "SUBMENU_Item2_Text",
            "SUBMENU_Item3_Text",
            "SUBMENU_Item4_Text",
            "SUBMENU_Item5_Text",
            "SUBMENU_Item6_Text",
            "SUBMENU_Item7_Text",
            "SUBMENU_Item8_Text",
            "Back"
            }, new bool[] { true, true, true, true, true, true, true, true, true });
        }
        #endregion
    
        #region TAB-4 SETMENU 0_3
        private void setMenu0_3(Player player)
        {
            GamePlay.gpSetOrderMissionMenu(player, true, 1, new string[]
            {
            "SUBMENU_Item1_Text",
            "SUBMENU_Item2_Text",
            "SUBMENU_Item3_Text",
            "SUBMENU_Item4_Text",
            "SUBMENU_Item5_Text",
            "SUBMENU_Item6_Text",
            "SUBMENU_Item7_Text",
            "SUBMENU_Item8_Text",
            "Back"
            }, new bool[] { true, true, true, true, true, true, true, true, true });
        }
        #endregion
        // END CLOD CUSTOM MENU SYSTEM
        #endregion
    }

  3. Likes ATAG_Lolsav liked this post
  4. #3
    Student Pilot
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Total Downloaded
    0

    Re: Help with my Tab 4 mission menu script

    First of all, thanks a lot for your help here. However, I can't seem to get this to work. I altered to your code to suit my needs and it still doesn't set the menu. So I simply used your code with no alterations thinking that the menu would have no function but I'd still be able to scroll through it with the default text that you had put on the menus. Still didn't work. I created a better directory structure for my altered version but when I tested your code with no alterations, both the mission file and script were in the IL2.....MOD\missions directory and have the same name except one is .mis and the other .cs. For my altered version, the mission file and script are in the same directory but I created a directory structure for the submissions I am trying to launch. I just can't get the menu to set. Here is what I did with your code:

    Code:
    using System;
    using System.Collections;
    using maddox.game;
    using maddox.game.world;
    
    public class Mission : AMission
    {
        #region CLOD CUSTOM MENU SYSTEM
        // Custom CLOD player menu system
        public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex)
        {
            base.OnOrderMissionMenuSelected(player, ID, menuItemIndex);
    
            if (player != null)
            {
                switch (ID)
                #region TAB-4 MENU OPTIONS
                {
                    #region TAB-4-0 MAIN MENU OPTION 0
                    case 0: // MAIN MENU ITEM 0
                        switch (menuItemIndex)
                        {
                            case 0: // Item 0
                                setMenu0_0(player);
                                break;
                            case 1: // Item 1
                                setMenu0_1(player);//Bombers
                                break;
                            case 2: // Item 2
                                setMenu0_2(player);//Fighters
                                break;
    			case 3: //Item 3
    			    setMainMenu(player);//Exit
    			    break;
                        }
                        break;
                    #endregion
    
                    #region TAB-4-1 MAIN MENU OPTION 1
                    case 1: // MAIN MENU ITEM 1
                        switch (menuItemIndex)
                        {
                            case 0: // Item 0
                                setMenu0_0(player);
                                break;
                            case 1: // Item 1
    			    GamePlay.gpHUDLogCenter("He111's warming up");
    			    GamePlay.gpPostMissionLoad("missions\North\sub_missions\bombers\he111s.mis");
                                setMainMenu(player);//He111s
                                break;
                            case 2: // Item 2
    			    GamePlay.gpHUDLogCenter("Ju-88s warming up");
    			    GamePlay.gpPostMissionLoad("missions\North\sub_missions\bombers\ju88s.mis");
                                setMainMenu(player);//Ju88s
                                break;
                            case 3: // Item 3
    			    GamePlay.gpHUDLogCenter("Stukas warming up");
    			    GamePlay.gpPostMissionLoad("missions\North\sub_missions\bombers\stukas.mis");
                                setMainMenu(player);//Stukas
                                break;
                            case 4: // Item 1
    			    GamePlay.gpHUDLogCenter("Dos warming up");
    			    GamePlay.gpPostMissionLoad("missions\North\sub_missions\bombers\dos.mis");
                                setMainMenu(player);//Dos
                                break;
                            case 5: // Item 2
    			    GamePlay.gpHUDLogCenter("Blennies warming up");
    			    GamePlay.gpPostMissionLoad("missions\North\sub_missions\bombers\blennies.mis" );
                                setMainMenu(player);//Blenheims
                                break;
                            case 6: // Item 3
    			    GamePlay.gpHUDLogCenter("Wellingtons warming up");
    			    GamePlay.gpPostMissionLoad("missions\North\sub_missions\bombers\wellingtons.mis");
                                setMainMenu(player);//Wellingtons
                                break;
                            case 7: // Item 1
                                setMainMenu(player);//Back
                                break;                        
                        }
                        break;
                    #endregion
    
                    #region TAB-4-2 MAIN MENU OPTION 2 
                    case 2: // // MAIN MENU ITEM 2
                        switch (menuItemIndex)
                        {
                            case 1: // Item 1
                                // TAB - 4 - 2 - 1_Code_Here
    			    GamePlay.gpHUDLogCenter("G50s warming up");
    			    GamePlay.gpPostMissionLoad("missions\North\sub_missions\fighters\g50s.mis");
                                setMainMenu(player);//G50s
                                break;
    
                            case 2: // Item 2
                                // TAB - 4 - 2 - 2_Code_Here
    			    GamePlay.gpHUDLogCenter("109s warming up");
    			    GamePlay.gpPostMissionLoad("missions\North\sub_missions\fighters\109s.mis");
                                setMainMenu(player);//109s
                                break;
    
                            case 3: // Item 3
                                // TAB - 4 - 2 - 3_Code_Here
    			    GamePlay.gpHUDLogCenter("110s warming up");
    			    GamePlay.gpPostMissionLoad("missions\North\sub_missions\fighters\110s.mis");
                                setMainMenu(player);//110s
                                break;
    
                            case 4: // Item 4
                                // TAB - 4 - 2 - 4 Code Here
    			    GamePlay.gpHUDLogCenter("Hurricanes warming up");
    			    GamePlay.gpPostMissionLoad("missions\North\sub_missions\fighters\hurricanes.mis");
                                setMainMenu(player);//Hurricanes
                                break;
    
                            case 5: // Item 5
                                // TAB - 4 - 2 - 5 Code Here
    			    GamePlay.gpHUDLogCenter("Spitfires warming up");
    			    GamePlay.gpPostMissionLoad("missions\North\sub_missions\fighters\spitfires.mis");
                                setMainMenu(player);//Spitfires
                                break;
    
                            case 6: // Item 9
                                // TAB - 4 - 2 - 9 Code Here
    			    GamePlay.gpHUDLogCenter("Beaufighters warming up");
    			    GamePlay.gpPostMissionLoad("missions\North\sub_missions\fighters\beaufighters.mis");
                                setMainMenu(player);//Beaufighters
                                break;
    						case 7: // Item 1
                                setMainMenu(player);//Back
                                break;
                        }
                        break;
                    #endregion
                }
                #endregion
            }
        }
    
        #region TAB-4 SET MAIN MENU
        private void setMainMenu(Player player)
        {   // TAB-4 SET MAIN MENU
            GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[]
            {
            "Bombers",
            "Fighters",
            "Exit"
            }, new bool[] { true, true, true, true, true, true, true, true, true });
        }
        #endregion
    
        #region TAB-4 SETMENU 0_1
        private void setMenu0_1(Player player)
        {   // TAB-4-1 Mission menu options SUBMENU
            GamePlay.gpSetOrderMissionMenu(player, true, 1, new string[]
            {
            "He111s",
            "Ju88s",
            "Stukas",
            "Dos",
            "Blenheims",
            "Wellingtons",
            "Back"
            }, new bool[] { true, true, true, true, true, true, true, true, true });
        }
        #endregion
    
        #region TAB-4 SETMENU 0_2
        private void setMenu0_2(Player player)
        {
            GamePlay.gpSetOrderMissionMenu(player, true, 1, new string[]
            {
            "G50s",
            "109s",
            "110s",
            "Hurricanes",
            "Spitfires",
            "Beaufighters",
            "Back"
            }, new bool[] { true, true, true, true, true, true, true, true, true });
        }
        #endregion
    
        // END CLOD CUSTOM MENU SYSTEM
        #endregion
    }
    Did I do something wrong or am I just completely missing something here? Thanks again.
    Last edited by mlambert7s; May-18-2017 at 19:41.

  5. #4
    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: Help with my Tab 4 mission menu script

    I'm no scripter guy, but does it require a more specific path to the submission files? Stuff used in some missions I've seen have something like:

    Code:
    public class Mission : AMission
    {
    
       private static string userdocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
       private static string CLODO_FILE_PATH = userdocpath + @"\1C SoftClub\il-2 sturmovik cliffs of dover - mod\";
       private static string FILE_PATH = @"missions\multi\dogfight\missionfoldername\missionname.mis"; // adjust to your needs
       private static string MISSION_FILE = CLODO_FILE_PATH + FILE_PATH;
       private static string BOMBERMISSIONS_FILE_PATH = "missions\\multi\\dogfight\\missionfoldername\\submissionfoldername\\"; //////////// adjust to your needs/////////////
    
        private string BomberMission = string.Empty;
    then at the part to load the missions:

    Code:
                                        	BomberMission = BOMBERMISSIONS_FILE_PATH + "example_he111s.mis";
                                        	GamePlay.gpPostMissionLoad(BomberMission);
    I can send you a mission with a more full example (ie- must have to have a way to clear the bombermission string so you can call other ones?), but it's no where near as tidy as Salmos way of doing it! Just say the word..

    Also do a search for "Battle of Britain: finest hour" mission released by No.401 Wolverine and d/l that, its around somewhere. Tons of stuff in there, with AI raids I believe. (if I find it I'll get a link for you, kids screaming gotta run..)

  6. #5
    Team Fusion Salmo's Avatar
    Join Date
    Nov 2011
    Posts
    2,332
    Post Thanks / Like
    Total Downloaded
    191.25 MB

    Re: Help with my Tab 4 mission menu script

    Looks like you may have several mission path string problems.

    1. You have 'escape' characters in your mission path The '\' character is an escape character so the string is not read & interpreted properly:

    Instead of

    GamePlay.gpPostMissionLoad("missions\North\sub_mis sions\bombers\he111s.mis");

    try

    GamePlay.gpPostMissionLoad(@"missions\North\sub_missions\bombers\he111s.mi s");

    2. Your path needs to be a 'full' path, so you'll need something like this at the beginning of the mission class:

    Code:
    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 - MOD/";  // DO NOT CHANGE
    private static string FILE_PATH = @"missions\North\sub_missions\";          // sub-mission install directory (CHANGE AS NEEDED)
    then in you menu system where you call the mission, you need to set the full path to the mission file, so:

    Code:
    GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\he111s.mis");
    Last edited by Salmo; May-18-2017 at 22:40.

  7. Likes ATAG_Lewis liked this post
  8. #6
    Student Pilot
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Total Downloaded
    0

    Re: Help with my Tab 4 mission menu script

    My problem is really that I can't seem to get my menu to set in the first place. I don't have a server I just create lobbies from the multiplayer menu. When I start the battle and create my plane, once I've spawned, I press Tab and this is what is looks like:

    20170518232249_1.jpg

    I tested a script I got from the 1c forums and it was designed to load a mission 10 minutes in and then again 60 minutes later. It was written with the type of file paths that I used and it worked. I just assumed that was the right was to do it. I updated to contain what your more complex file paths. This is what I have now:

    Code:
    using System;
    using System.Collections;
    using maddox.game;
    using maddox.game.world;
    
    public class Mission : AMission
    {
            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 - MOD/";  // DO NOT CHANGE
    	private static string FILE_PATH = @"missions\North\sub_missions";   // mission install directory (CHANGE AS NEEDED)
    	#region CLOD CUSTOM MENU SYSTEM
        // Custom CLOD player menu system
        public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex)
        {
            base.OnOrderMissionMenuSelected(player, ID, menuItemIndex);
    
            if (player != null)
            {
                switch (ID)
                #region TAB-4 MENU OPTIONS
                {
                    #region TAB-4-0 MAIN MENU OPTION 0
                    case 0: // MAIN MENU ITEM 0
                        switch (menuItemIndex)
                        {
                            case 0: // Item 0
                                setMenu0_0(player);
                                break;
                            case 1: // Item 1
                                setMenu0_1(player);//Bombers
                                break;
                            case 2: // Item 2
                                setMenu0_2(player);//Fighters
                                break;
    						case 3: //Item 3
    							setMainMenu(player);//Exit
    							break;
                        }
                        break;
                    #endregion
    
                    #region TAB-4-1 MAIN MENU OPTION 1
                    case 1: // MAIN MENU ITEM 1
                        switch (menuItemIndex)
                        {
                            case 0: // Item 0
                                setMenu0_0(player);
                                break;
                            case 1: // Item 1
    				GamePlay.gpHUDLogCenter("He111's warming up");
    				GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\he111s.mis");
    				setMainMenu(player);//He111s
                                    break;
                            case 2: // Item 2
    				GamePlay.gpHUDLogCenter("Ju-88s warming up");
    				GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\ju88s.mis");
    				setMainMenu(player);//Ju88s
                                break;
                            case 3: // Item 3
    				GamePlay.gpHUDLogCenter("Stukas warming up");
    				GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\stukas.mis");
    				setMainMenu(player);//Stukas
                                break;
                            case 4: // Item 1
    				GamePlay.gpHUDLogCenter("Dos warming up");
    				GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\dos.mis");
    				setMainMenu(player);//Dos
                                break;
                            case 5: // Item 2
    				GamePlay.gpHUDLogCenter("Blennies warming up");
    				GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\blennies.mis");
    				setMainMenu(player);//Blenheims
                                break;
                            case 6: // Item 3
    				GamePlay.gpHUDLogCenter("Wellingtons warming up");
    				GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\wellingtons.mis");
    				setMainMenu(player);//Wellingtons
                                break;
                            case 7: // Item 1
                                setMainMenu(player);//Back
                                break;                        
                        }
                        break;
                    #endregion
    
                    #region TAB-4-2 MAIN MENU OPTION 2 
                    case 2: // // MAIN MENU ITEM 2
                        switch (menuItemIndex)
                        {
                            case 1: // Item 1
                                // TAB - 4 - 2 - 1_Code_Here
    				GamePlay.gpHUDLogCenter("G50s warming up");
    				GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"fighters\g50s.mis");
    				setMainMenu(player);//G50s
                                break;
    
                            case 2: // Item 2
                                // TAB - 4 - 2 - 2_Code_Here
    				GamePlay.gpHUDLogCenter("109s warming up");
    				GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"fighters\109s.mis");
    				setMainMenu(player);//109s
                                break;
    
                            case 3: // Item 3
                                // TAB - 4 - 2 - 3_Code_Here
    				GamePlay.gpHUDLogCenter("110s warming up");
    				GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"fighters\110s.mis");
    				setMainMenu(player);//110s
                                break;
    
                            case 4: // Item 4
                                // TAB - 4 - 2 - 4 Code Here
    				GamePlay.gpHUDLogCenter("Hurricanes warming up");
    				GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"fighters\hurricanes.mis");
    				SetMainMenu(player);//Hurricanes
                                break;
    
                            case 5: // Item 5
                                // TAB - 4 - 2 - 5 Code Here
    				GamePlay.gpHUDLogCenter("Spitfires warming up");
    				GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"fighters\spitfires.mis");
    				setMainMenu(player);//Spitfires
                                break;
    
                            case 6: // Item 9
                                // TAB - 4 - 2 - 9 Code Here
    				GamePlay.gpHUDLogCenter("Beaufighters warming up");
    				GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"fighters\beaufighters.mis");
    				setMainMenu(player);//Beaufighters
                                break;
    			case 7: // Item 1
                                setMainMenu(player);//Back
                                break;
                        }
                        break;
                    #endregion
                }
                #endregion
            }
        }
    
        #region TAB-4 SET MAIN MENU
        private void setMainMenu(Player player)
        {   // TAB-4 SET MAIN MENU
            GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[]
            {
            "Bombers",
            "Fighters",
            "Exit"
            }, new bool[] { true, true, true, true, true, true, true, true, true });
        }
        #endregion
    
        #region TAB-4 SETMENU 0_1
        private void setMenu0_1(Player player)
        {   // TAB-4-1 Mission menu options SUBMENU
            GamePlay.gpSetOrderMissionMenu(player, true, 1, new string[]
            {
            "He111s",
            "Ju88s",
            "Stukas",
            "Dos",
            "Blenheims",
            "Wellingtons",
            "Back"
            }, new bool[] { true, true, true, true, true, true, true, true, true });
        }
        #endregion
    
        #region TAB-4 SETMENU 0_2
        private void setMenu0_2(Player player)
        {
            GamePlay.gpSetOrderMissionMenu(player, true, 1, new string[]
            {
            "G50s",
            "109s",
            "110s",
            "Hurricanes",
            "Spitfires",
            "Beaufighters",
            "Back"
            }, new bool[] { true, true, true, true, true, true, true, true, true });
        }
        #endregion
    
        // END CLOD CUSTOM MENU SYSTEM
        #endregion
    }
    Once again I really appreciate the help.
    Last edited by mlambert7s; May-19-2017 at 02:20.

  9. #7
    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: Help with my Tab 4 mission menu script

    try adding this:

    Code:
        public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
        {
            base.OnPlaceEnter(player, actor, placeIndex);
    
    
            if (!PilotsInGame.Exists(item => item.player == player))
            {
                PilotsInGame.Add(new Pilot(player));
            }
    
            SetMainMenu(player);
        }

  10. #8
    Student Pilot
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Total Downloaded
    0

    Re: Help with my Tab 4 mission menu script

    ok I see what you are saying about the escape characters. So should:

    Code:
    private static string FILE_PATH = @"missions\North\sub_missions";
    be:

    Code:
    private static string FILE_PATH = @"missions\\North\\sub_missions";
    I'm sorry about my noob status but I really appreciate the help. Didn't know anything about c# but I've got ideas for this game that I need to see happen so I decided to start learning this past weekend. I know a good bit about php and web programming but I rarely use it, however it made learning basics of c# fairly easy. I'm gonna keep learning but as I was learning I was going back and looking at the script reference master list and the game extensions and getting even more ideas and trying to understand more and more of it as I went and just had to start messing around. Found the original scripts from my first post up there and thought I could manipulate it and make it work for me. It made sense and the guy had a screen shot of his menu that seemed to work for him. When you gave me that menu template, it made complete sense to me, but took me a minute to figure out how to customize it for my own needs, which I am not entirely sure I did right but I at least think I did. All I know is that once I have figured all this out I'm gonna write some really cool scripts, getting the menu to set is the first step.
    Last edited by mlambert7s; May-19-2017 at 02:11.

  11. #9
    Student Pilot
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Total Downloaded
    0

    Re: Help with my Tab 4 mission menu script

    Thanks Freya, I'll give it a shot.

    update: it didn't work
    Last edited by mlambert7s; May-19-2017 at 02:04.

  12. #10
    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: Help with my Tab 4 mission menu script

    No prob, I think I know what you need, but on phone typing this so will send it tomorrow if still needed..

    Glad to see someone determined to learn this stuff!

  13. #11
    Student Pilot
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Total Downloaded
    0

    Re: Help with my Tab 4 mission menu script

    Thanks Freya

  14. #12
    Team Fusion Salmo's Avatar
    Join Date
    Nov 2011
    Posts
    2,332
    Post Thanks / Like
    Total Downloaded
    191.25 MB

    Re: Help with my Tab 4 mission menu script

    Quote Originally Posted by mlambert7s View Post
    ok I see what you are saying about the escape characters. So should:

    Code:
    private static string FILE_PATH = @"missions\North\sub_missions";
    be:
    Code:
    private static string FILE_PATH = @"missions\\North\\sub_missions";
    No. There are 2 ways to format escape characters in a string. EITHER -
    Code:
    private static string FILE_PATH = "missions\\North\\sub_missions";
    or
    Code:
    private static string FILE_PATH = @"missions\North\sub_missions";
    Not BOTH.

    Quote Originally Posted by mlambert7s View Post
    I'm sorry about my noob status but I really appreciate the help.
    There is no need to apologise. Learning how to script C# missions will add more gameplay to your misions, & the community is here to help.

  15. Likes Bonditaria, ♣_Spiritus_♣ liked this post
  16. #13
    Student Pilot
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Total Downloaded
    0

    Re: Help with my Tab 4 mission menu script

    Thanks Salmo, I realize now that's what you were telling me before it just didn't click. I appreciate your willingness to help because I have several questions, so brace yourself, they're on the way.

    I also realized that I had too many Boolean values for my menus but I fixed that and it still doesn't work.

    What I'd really like is for the menus to be different for each team and I guess I should have mentioned that from the start. Is that something that will compromise the way this menu code is structured or could it just be added in with well placed if statements or something similar?

    Also, when I am extending the menu, how far can I extend it? You have created the menus to be MainMenu, Menu0_1, Menu0_2...., so MainMenu is obviously the menu that appears after pressing Tab 4 right, and Menu0_1 is the menu that appears after selecting option 1 in the MainMenu and so on right? So when I get to the next level of menus, should they be done Menu1_1 for selection option one of Menu0_1? Or should it be Menu0_1_1? That's what I mean by how far can I extend it?
    Last edited by mlambert7s; May-19-2017 at 09:13.

  17. #14
    Student Pilot
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Total Downloaded
    0

    Re: Help with my Tab 4 mission menu script

    Also, the regions you've set up:

    Code:
    #region TAB-4-2 MAIN MENU OPTION 3
    say I wanted to move on from there to the next menu region, how would you write that? For example:

    Code:
    #region TAB-4-2 MAIN MENU OPTION 3 SUB MENU OPTION 2

  18. #15
    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: Help with my Tab 4 mission menu script

    Ok 1st - appologies. I thought you might need something like what's below, but am not sure now. I use a different style of menu, Salmos are way nicer. Maybe Salmo can help, I fear I might just confuse the situation..



    Code:
        internal class Pilot
        {
            public Player player { get; set; }
            public DateTime TimeStamp { get; set; }
            public Pilot(Player player)
            {
                this.player = player;
            }
        }
    
        internal List<Pilot> PilotsInGame = new List<Pilot>();
    
        internal class Menu
        {
            internal class MenuEntry
            {
                internal string MenuName { get; set; }
                internal bool active { get; set; }
            }
    
            internal List<MenuEntry> menuEntries = new List<MenuEntry>();
    
            public void AddMenuEntry(string description, bool active)
            {
                MenuEntry NewMenuEntry = new MenuEntry();
    
                NewMenuEntry.MenuName = description;
                NewMenuEntry.active = active;
    
                menuEntries.Add(NewMenuEntry);
            }
    
            public string[] GetMenuDescriptions()
            {
                List<string> Descriptions = new List<string>();
    
                menuEntries.ForEach(item =>
                {
                    Descriptions.Add(item.MenuName);
                });
    
                return Descriptions.ToArray();
            }
    
            public bool[] GetActives()
            {
                List<bool> Actives = new List<bool>();
    
                menuEntries.ForEach(item =>
                {
                    Actives.Add(item.active);
                });
    
                return Actives.ToArray();
            }
    
            public bool IsValid()
            {
                if (menuEntries == null || menuEntries.Count < 1)
                    return false;
                else
                    return true;
    
            }
    
        }

  19. #16
    Public Relations ATAG_Lewis's Avatar
    Join Date
    Jan 2012
    Location
    Sheffield UK
    Posts
    7,253
    Post Thanks / Like
    Total Downloaded
    506.15 MB

    Re: Help with my Tab 4 mission menu script

    and....

    Welcome to the Community and Forums mlambert7s ...~S~

    Checkout the 'Beginners Guide'...for info and tips...It will save you a heap of time in getting up to scratch.....and its a really fun learning curve too...

    Beginners Guide

    Windows Management Guide

    Also try youtube for startup procedures on all the aircraft...

    I recommend getting in the online server as soon as you can take off if that's ultimately where you'd like to fly...I flew single player for 30 minutes before I took the plunge...The ATAG online server is a great environment to learn and there's not really any damage you can do in there as a new player.....It is also mission based just with real players trying to foil your objectives...If you are concerned then pick an airstrip furthest from the front line (there always is one or two on every map) and get some alt before you go hunting...You'll get tagged a lot but there are tricks you learn out of pure desperation in those first few weeks that you'll be able to use later...I know cos I still use the same tricks I learned then too because they work...and never underestimate the stall to get you out of a tight fix...That sometimes works too...

    TeamSpeak is optional but you'll learn a whole lot faster with it even if you say very little once you are on the server...You are quite welcome to just listen if you feel more comfortable with that....so you don't actually need a mic either...Try it and see!


    Here are a few fun, helpful and interesting links amongst these forums you might want to bag for future reference...

    Most Watched CLOD Videos

    Easy Allied CEM for New Players

    Joystick and Hardware Thread

    ATAG Forum Age Poll Results

    Nvidea Control Panel Settings

    Downloads

    Contact spotting is massively important in any flight sim...Seeing that enemy before he sees you is a race you don't want to be second in...Check this link to see if you can tweak your rig any better...

    Contact Spotting Test

    Don't forget to keep up with the latest on the TeamFusion new aircraft and patch news...You could well be AMAZED!

    TeamFusion Facebook Updates

    A must read for all CLOD enthusiasts is the recent news that has the whole community buzzing very heavily...

    TeamFusion News

    And finally...Please take the time to have a read of some of the stories of military family adventures by a few of the members of this forum...and maybe share yours with us...~S~

    A Tribute to Those Who Served

    Any questions then you've come to the right place....

    Good to have you with us buddy...and remember its all about the Fun!!!

    ...Lew...

    ===================================

    Any UK members please let us know where abouts in the UK you are...Just for reference...Its always good to know just incase there happen to be folks who can help you or you can help locally...buy a joystick from or even just a chat in a pub with someone who is likeminded...

    UK Based Player Location thread

    Thanks...~S~
    "The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt.'' - Bertrand Russell
    1.618 - You know this number?
    My Turing machine :CPU: Intel Core i7 2700K 3.50GHz Sandybridge, Motherboard: Asus Maximus IV Extreme -Z Intel Z68 (Socket 1155) PCI-Express DDR3,
    RAM: 8GB (2x4GB) DDR3 Dual Channel Kit, Graphics Card: Nvidia GeForce GTX 970 4096MB GDDR5, OS:Windows 10
    Joystick: Microsoft Sidewinder II ForceFeedback Joystick, Throttle: CH Products Pro Throttle
    ATAG_Lewis Youtube Channel

  20. #17
    Student Pilot
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Total Downloaded
    0

    Re: Help with my Tab 4 mission menu script

    Thanks Lewis, that is impressive family history you've got there. I'll have to post a tribute to my grandfathers soon, my mom's dad was a marine and fought at Iwo Jima, my dad's dad was a JAG officers in Europe for a while during the war.

    Honestly though, I am really only new to the forums. I've been playing the ATAG server on and off for at least 3 years even though I never get on teamspeak. Haven't played this month but I've definitely been improving over the years. I did really good last month though, I had 90 something kills and my air ratio has been around 0.45 for the past three stat resets, so I am proud of that because I was hopeless when I first got on here and I spend most of my time in a fighter but I do several bombing runs and I almost never make it back. Flak likes to get my pilot just before I make it to the target, haha. I also play at really random times throughout the day, sometimes nobody is on and I'll run like 10 sorties and have zero kills. So I really just like to look at kill/death ratios because that is really where I will notice improvements. I've been just positive for the past few resets but the more I bomb, the more I die. I've pushed my k/d ratio almost to 2 to 1 before but haven't been able to get back there and any time Pattle shows up I usually die, haha. That's really what I like to build on, I had about 200 sorties in April so knowing that after all that I was still a positive influence on my team while fighting and bombing is encouraging.

    I really like how hard the game is, and I use the stats on the server to look for improvement . I play all kinds of games so sometimes I take large breaks. Dover is easily my favorite though. However, I started messing around with this mission builder and I haven't really been able to stop, haha. So many possibilities, and that's when I decided to start learning about c# and scripts and stuff.

    My buddy is learning to be a real pilot and I had set up a mission for him when he comes over to practice cross wind landings and take offs and it works remarkably well. Kinda have to set up 2 wind flows because there is a max wind speed for taxi. The second more powerful wind flow hits just after lifting off, but landings are great with the heavy winds because you actually have to crab in if you set it right. I was setting up mission briefings with terminal aerodrome forecasts TAF so that he would have to read them properly to understand the weather around in airfield. He gets to practice navigating throughout the map. I was on the server last month and did a run from manston to the column sw of colleques and I measured it out and calculated how long it would take me to get to the target and, no bs, my timer went off less than a second before I dropped my ordinance, and then flak killed me, that column is brutal! Adding more significant winds makes navigation a lot more difficult. The game works remarkable well.

    I just got my Remote Pilot Certificate with sUAS rating from the FAA, and I had to basically learn everything about being a pilot just so I could fly a drone commercially. But I learned a pretty good amount about flying and weather and loading and performance, bank angles and angle of attack..... Been transferring that knowledge to flying in the game and its amazing. Take load factors for example, the spitfire's stall is 63 with flaps, so I know that in order to bank at 30 degrees, I have to be going 73 mph, 90 mph to bank at 45, and 126 mph before I can bank at 60 degrees. With flaps up, stall speed is 73 mph, have to go 85 mph to bank 30, 104 mph to bank 45, and 146 mph to bank at 60. Learning so much more about the capabilities of my plane has helped me a lot. Easy to make a stupid decision in a low level slow speed dogfight, which happens all the time on the server. My buddy was impressed by the fact that I can fly off my gauges alone if wanted to, I understand all my instruments. Learning most of all of that instrument reading from playing this game.

    I guess I should shut this tangent down, sorry guys
    Last edited by mlambert7s; May-19-2017 at 23:26.

  21. #18
    Student Pilot
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Total Downloaded
    0

    Re: Help with my Tab 4 mission menu script

    did you know you could set up thermals in the FMB? Awesome! I've been staying away from the weather and stuff because it crashes my game but if the thermals work correctly, you could set it up so that as you flew off the coast of dover, when you reach the water you'd lose a bit of lift because the land at dover would heat up faster than the water, as would the air above them, and that air would rise and be replaced by air coming in from the water to replace it as air drops down over the water to replace the air moving onto the land. As you came back to dover you'd gain a bit of lift crossing over the coast because of the thermal. This mission builder is overwhelmingly intricate, its funny that its just not enough for me, gotta learn this code so I can make more things happen, haha.

  22. #19
    Student Pilot
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Total Downloaded
    0

    Re: Help with my Tab 4 mission menu script

    Thanks Freya, I'll look into that code, I like the pilot class you put in there. I'm still struggling with this though. I think I might just write a short script that says to the hud "If this works, I guess you're just a retard" just after creating an aircraft because I just can't figure this menu system out. Think I am going to create a different menu from the template Salmo gave me and try it with a completely different mission. Is there some kind of game setting that would go along with this? I'm just a beginner but I know I am missing something, that code Salmo gave me looks pretty good I cant seem to find any errors, that's why I think maybe its just missing a line or two of code. Thanks again for all the help y'all, gonna keep hacking at this

  23. #20
    Student Pilot
    Join Date
    Apr 2017
    Posts
    14
    Post Thanks / Like
    Total Downloaded
    0

    Re: Help with my Tab 4 mission menu script

    ok so I have found a two scripts out there that do very similar things, whose menu actually sets for me. However, when I try to change the menu to fit my needs it no longer sets the menu.

    Here is one of the menu scripts that I found on the 1c forums that sets the menu for me:

    Code:
    using System;
    using System.Text;
    using System.Collections.Generic;
    using maddox.game;
    using maddox.game.world;
    
    
    public class Mission : AMission
    {
    
        private Dictionary<Player, int> PlayerAirgroupIndex = new Dictionary<Player, int>();
    
        internal string ParseAirgroupName(string AirgroupName)
        {
            string[] tempString = null;
            string parsedName="";
            tempString = AirgroupName.Split(':','.');
            
            if (tempString[1].StartsWith("BoB_LW_"))
            {
                StringBuilder b = new StringBuilder(tempString[1]);
                parsedName = b.Replace("BoB_LW_", "").ToString();
    
                if(parsedName.EndsWith("_I"))
                    parsedName = "I./" + b.Replace("_I", "").ToString();
                else if (parsedName.EndsWith("_II"))
                    parsedName = "II./" + b.Replace("_II", "").ToString();
                else if (parsedName.EndsWith("_III"))
                    parsedName = "III./" + b.Replace("_III", "").ToString();
                else if (parsedName.EndsWith("_IV"))
                    parsedName = "IV./" + b.Replace("_IV", "").ToString();
                else if (parsedName.EndsWith("_V"))
                    parsedName = "V./" + b.Replace("_V", "").ToString();
                else if (parsedName.EndsWith("_Stab"))
                    parsedName = "Stab./" + b.Replace("_Stab", "").ToString();
                
                if (tempString[2].StartsWith("0"))
                {
                    if (!parsedName.StartsWith("Stab"))
                        parsedName += ": Stabstaffel";
                }
                else if (tempString[2].StartsWith("1"))
                    parsedName += ": 1.Staffel";
                else if (tempString[2].StartsWith("2"))
                    parsedName += ": 2.Staffel";
                else if (tempString[2].StartsWith("3"))
                    parsedName += ": 3.Staffel";
                else if (tempString[2].StartsWith("4"))
                    parsedName += ": 4.Staffel";
                else parsedName += ": Unknown";
            }
            else if (tempString[1].StartsWith("BoB_RAF_"))
            {
                StringBuilder b = new StringBuilder(tempString[1]);
    
                if (tempString[1].StartsWith("BoB_RAF_F_FatCat"))
                    parsedName = b.Replace("BoB_RAF_F_", "(F)  ").ToString();
                else if (tempString[1].StartsWith("BoB_RAF_F_"))
                    parsedName = b.Replace("BoB_RAF_F_", "(F)  No. ").ToString();
                else if (tempString[1].StartsWith("BoB_RAF_B_"))
                    parsedName = b.Replace("BoB_RAF_B_", "(B)  No. ").ToString();
                if (parsedName.EndsWith("_Early"))
                    parsedName = b.Replace("_Early", "").ToString();
                else if (parsedName.EndsWith("_Late"))
                    parsedName = b.Replace("_Late", "").ToString();
                if (parsedName.EndsWith("Sqn"))
                    parsedName = b.Replace("Sqn", ".Sqn").ToString();
                else if (parsedName.EndsWith("_PL"))
                    parsedName = b.Replace("_PL", ".Sqn (PL)").ToString();
                else if (parsedName.EndsWith("_CZ"))
                    parsedName = b.Replace("_CZ", ".Sqn (CZ)").ToString();
                else if (parsedName.EndsWith("_RCAF"))
                    parsedName = b.Replace("_RCAF", ".Sqn RCAF").ToString();
                
                if (tempString[2].StartsWith("0"))
                    parsedName += ": 1";
                else if (tempString[2].StartsWith("1"))
                    parsedName += ": 2";
                else if (tempString[2].StartsWith("2"))
                    parsedName += ": 3";
                else if (tempString[2].StartsWith("3"))
                    parsedName += ": 4";
                else parsedName += ": Unknown";
            }
    
            return parsedName;
        }
    
        
        public string[] GetAvailableAirgroups(Player player)
        {
            AiAirGroup[] ownAG = GamePlay.gpAirGroups(player.Army());
            List<string> tempAG = new List<string>();
    
            if (ownAG != null)
            {
                foreach (AiAirGroup ag in ownAG)
                {
                    tempAG.Add(ParseAirgroupName(ag.Name()));
                }
    
            }
            return tempAG.ToArray();
        }
        
        
        public string[] GetAvailablePlanes(Player player, AiAirGroup airgroup)
        {
            AiActor[] result = null;
            
            List<string> Planes = new List<string>();
    
            if (airgroup != null)
            {
                result = airgroup.GetItems();
                if (result != null)
                {
                    foreach (AiActor actor in result)
                    {
                        //Planes.Add(actor.Name());
                        StringBuilder b = new StringBuilder((actor as AiAircraft).InternalTypeName());
    
                        b.Replace("bob:Aircraft.", "");
                        Planes.Add(b + "  -->  " + (actor as AiAircraft).TypedName());
    
                    }
                }
            }
            return Planes.ToArray();
        }
    
        public void setAirGroupSubMenu(Player player)
        {
            List<bool> active = new List<bool>();
    
            foreach (string st in GetAvailableAirgroups(player))
            {
                active.Add(true);
            }
    
            GamePlay.gpSetOrderMissionMenu(player, true, 1, GetAvailableAirgroups(player), active.ToArray());
        }
    
    
        public void setPlaneSubMenu(Player player, AiAirGroup airgroup)
        {
            List<bool> active = new List<bool>();
    
            foreach (string st in GetAvailablePlanes(player, airgroup))
            {
                active.Add(true);
            }
            GamePlay.gpSetOrderMissionMenu(player, true, 2, GetAvailablePlanes(player, airgroup), active.ToArray());
        }
    
    
        public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
        {
            base.OnPlaceEnter(player, actor, placeIndex);
    
        }
        
        
        private void setMainMenu(Player player)
        {
            GamePlay.gpSetOrderMissionMenu(player, false, 0, new string[] { "Change Aircraft"}, new bool[] { true});
        }
    
        public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex)
        {
            base.OnOrderMissionMenuSelected(player, ID, menuItemIndex);
    
            if (ID == 0) // main menu
            {
                switch (menuItemIndex)
                {
                    case 1:
                        setAirGroupSubMenu(player);
                        break;
                    case 0:
                        setMainMenu(player);
                        break;
                }
            }
            else if (ID == 1)
            { // sub menu
    
                List<AiAirGroup> Groups = new List<AiAirGroup>();
    
                foreach (AiAirGroup ag in GamePlay.gpAirGroups(player.Army()))
                {
                    Groups.Add(ag);
                }
                if (menuItemIndex == 0) setMainMenu(player);
                else
                {
                    PlayerAirgroupIndex.Add(player, menuItemIndex - 1);
                    setPlaneSubMenu(player, Groups[menuItemIndex - 1]);
                }
            }
            else if (ID == 2)
            { // sub sub menu
    
                List<AiAirGroup> Groups = new List<AiAirGroup>();
                List<AiActor> AvailableActor = new List<AiActor>();
    
                int index;
    
                if (menuItemIndex == 0) setMainMenu(player);
                else
                {
                    foreach (AiAirGroup ag in GamePlay.gpAirGroups(player.Army()))
                    {
                        Groups.Add(ag);
                    }
    
                    if (PlayerAirgroupIndex.TryGetValue(player, out index))
                    {
                        foreach (AiActor ac in Groups[PlayerAirgroupIndex[player]].GetItems())
                        {
                            AvailableActor.Add(ac);
                        }
                    }
                    player.PlaceEnter(AvailableActor[menuItemIndex-1], 0);
                    PlayerAirgroupIndex.Remove(player);
                    setMainMenu(player);
                }
            } 
        }
    
        public override void OnPlayerConnected(Player player)
        {
            setMainMenu(player);
        }
    
    
        public override void Inited()
        {
            setMainMenu(GamePlay.gpPlayer());
        }
    }
    http://forum.1cpublishing.eu/showthread.php?t=26531

    The other script was written by 41Sqn_Banks and is available for download here:
    https://code.google.com/archive/p/il2coop/downloads

    This is what I am currently working with:

    Code:
    using System;
    using System.Collections;
    using maddox.game;
    using maddox.game.world;
    
    namespace maddox.game
    {
        public class Mission : AMission
        {
            internal enum MenuID
            {
                MainMenu,
                SubMenu0_1,
                SubMenu0_2,
            }
    
            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 - MOD/";  // DO NOT CHANGE
            private static string FILE_PATH = @"missions\North\sub_missions";   // mission install directory (CHANGE AS NEEDED)
    
            public override void OnBattleStarted()
            {
                base.OnBattleStarted();
    
                MissionNumberListener = -1;
            }        
    
            public override void OnMissionLoaded(int missionNumber)
            {
                base.OnMissionLoaded(missionNumber);
    
                setMainMenu(GamePlay.gpPlayer());            
            }
    
            public override void OnPlayerConnected(Player player)
            {
                base.OnPlayerConnected(player);
    
                setMainMenu(player);
            }
    
            public override void Inited()
            {
                setMainMenu(GamePlay.gpPlayer());            
            }
    
            public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
            {
                base.OnPlaceEnter(player, actor, placeIndex);
    
                setMainMenu(player);
            }
    
            public override void OnPlayerArmy(Player player, int army)
            {
                base.OnPlayerArmy(player, army);
    
                setMainMenu(player);
            }        
    
            public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex)
            {
                base.OnOrderMissionMenuSelected(player, ID, menuItemIndex);
    
                setMainMenu(player);
    
                if (ID == (int)MenuID.MainMenu)
                {
                    switch (menuItemIndex)
                    {
                        case 0:
                            setMainMenu(player);
                            break;
                        case 1:
                            setSubMenu0_1(player);//Bombers
                            break;
                        case 2:
                            setSubMenu0_2(player);//Fighters
                            break;
                        case 3:
                            setMainMenu(player);//Exit
                            break;
                    }                
                }
                else if (ID == (int)MenuID.SubMenu0_1)
                {
                    switch (menuItemIndex)
                    {
                        case 0:
                            setSubMenu0_1(player);
                            break;
    
                        case 1:
                            GamePlay.gpHUDLogCenter("He111's warming up");
                            GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\he111s.mis");
                            setMainMenu(player);//He111s
                            break;
    
                        case 2:
                            GamePlay.gpHUDLogCenter("Ju-88s warming up");
                            GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\ju88s.mis");
                            setMainMenu(player);//Ju88s
                            break;
    
                        case 3:
                            GamePlay.gpHUDLogCenter("Stukas warming up");
                            GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\stukas.mis");
                            setMainMenu(player);//Stukas
                            break;
    
                        case 4:
                            GamePlay.gpHUDLogCenter("Dos warming up");
                            GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\dos.mis");
                            setMainMenu(player);//Dos
                            break;
    
                        case 5:
                            GamePlay.gpHUDLogCenter("Blennies warming up");
                            GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\blennies.mis");
                            setMainMenu(player);//Blenheims
                            break;
    
                        case 6:
                            GamePlay.gpHUDLogCenter("Wellingtons warming up");
                            GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"bombers\wellingtons.mis");
                            setMainMenu(player);//Wellingtons
                            break;
    
                        case 7:
                            setMainMenu(player);//Back
                            break;
                    }
                }
                else if (ID == (int)MenuID.SubMenu0_2)
                {
                    switch (menuItemIndex)
                    {
                        case 1:
                            GamePlay.gpHUDLogCenter("G50s warming up");
                            GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"fighters\g50s.mis");
                            setMainMenu(player);//G50s
                            break;
    
                        case 2:
                            GamePlay.gpHUDLogCenter("109s warming up");
                            GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"fighters\109s.mis");
                            setMainMenu(player);//109s
                            break;
    
                        case 3:
                            GamePlay.gpHUDLogCenter("110s warming up");
                            GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"fighters\110s.mis");
                            setMainMenu(player);//110s
                            break;
    
                        case 4:
                            GamePlay.gpHUDLogCenter("Hurricanes warming up");
                            GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"fighters\hurricanes.mis");
                            setMainMenu(player);//Hurricanes
                            break;
    
                        case 5:
                            GamePlay.gpHUDLogCenter("Spitfires warming up");
                            GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"fighters\spitfires.mis");
                            setMainMenu(player);//Spitfires
                            break;
    
                        case 6:
                            GamePlay.gpHUDLogCenter("Beaufighters warming up");
                            GamePlay.gpPostMissionLoad(@CLOD_PATH + @FILE_PATH + @"fighters\beaufighters.mis");
                            setMainMenu(player);//Beaufighters
                            break;
    
                        case 7:
                            setMainMenu(player);//Back
                            break;
                    }                
                }
                else
                {
                    setMainMenu(player);
                }
            }
    
            private void setMainMenu(Player player)
            {
                GamePlay.gpSetOrderMissionMenu(player, false, (int)MenuID.MainMenu, new string[] { "Bombers", "Fighters" }, new bool[] { true, true});            
            }
    
            private void setSubMenu0_1(Player player)
            {
                GamePlay.gpSetOrderMissionMenu(player, true, (int)MenuID.SubMenu0_1, new string[] { "He111\'s", "Ju88\'s", "Stukas", "Do\'s", "Blenheim\'s", "Wellington\'s"}, new bool[] { false, false, false, false, false, false});
            }
    
            private void setSubMenu0_2(Player player)
            {
                GamePlay.gpSetOrderMissionMenu(player, true, (int)MenuID.SubMenu0_2, new string[] { "G50\'s", "109\'s", "110\'s", "Hurricanes", "Spitfires", "Beaufighters"}, new bool[] { false, false, false, false, false, false});
            }
            
        }
    }
    I used an enumeration for my menu ID like the one for the other scripts did and threw in a bunch of OnSomethingHappens methods to try and get the menu to set. I just don't understand why these other scripts work. Do I have this right?:

    Code:
    private void setMainMenu(Player player)
            {
                GamePlay.gpSetOrderMissionMenu(
    			player,
    			false, //means that the menu is not a sub menu?
    			(int)MenuID.MainMenu, //menu ID set up as enumeration MenuID(0)?
    			new string[] { "Bombers", "Fighters" }, //the two options after pressing Tab 4?
    			new bool[] { true, true}); //is true when the menu item is linked to a submenu?           
            }
    I just don't understand why these menus set and mine does not. I mentioned before that I had found another script that launched these missions on timed intervals and it launched my submission and gave me my message to the HUD. What are these to guys doing that I am missing?

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
  •