Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 10-13-2011, 07:28 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Thank you!
Maybe you can get Length of LimbNames.Tail from the game same as with engines here and run a loop? Tail would do the job in the air too I think.

Code:
                    int iNumOfEngines = (aircraft.Group() as AiAirGroup).aircraftEnginesNum();
                    for (int i = 0; i < iNumOfEngines; i++)
                    {
                        aircraft.hitNamed((part.NamedDamageTypes)Enum.Parse(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure"));
                    }
Reply With Quote
  #2  
Old 10-19-2011, 05:01 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

1.11 version up on Repka #3 for testing
Attached Files
File Type: zip r_steppe1.11.zip (24.4 KB, 15 views)
Reply With Quote
  #3  
Old 10-20-2011, 10:49 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

I have a more general question which I hope someone can answer:

My mission loads submission with some parameters (attacker army, mission type, attack sector, etc), then gets trigger status, calculates mission results and shows results messages using the same parameters. It goes fine when submissions are loaded one by one.

I want to add different types of submissions and make them overlap in time. Naturally I have to store parameters of every submissions as different variables to prevent them mixing up.

How can I do this? Should I create a list for each parameter and send it to array when each new submission loads or there is a more elegant way to do this. I will not have more then 10 submissions going on simultaneously and do not have to create arrays with the length of total past submissions quantity.
Reply With Quote
  #4  
Old 10-20-2011, 02:56 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Make a class with all infos you need and then store the objects in a list.

For example :
Code:
using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;

public class Mission : AMission
{
    public static string SubMissionsPath = @"missions\Multi\Dogfight\test\subs\";
    
    
    public class Mis
    {
        public string Missionfilename {get; set;}
        public string PathToMission { get; set; }
        public DateTime MissionBegin{get; set;}
        public DateTime MissionEnd{get; set;}
        public double MissionLengh{get; set;}
        public bool IsMissionRunning { get; set; }
    
        public Mis(string Filename, string Path, double Lengh)
        {
            this.Missionfilename = Filename;
            this.PathToMission = Path;
            this.MissionLengh = Lengh;
        }
    
    }

    public List<Mis> MissionPool = new List<Mis>()
    {
        new Mis ("Mission1.mis",SubMissionsPath ,1000.0),
        new Mis ("Mission2.mis",SubMissionsPath ,1000.0),
    };


    public override void OnBattleStarted()
    {
        base.OnBattleStarted();


        MissionNumberListener = -1;

        try
        {
            foreach (Mis mi in MissionPool)
                GamePlay.gpPostMissionLoad(mi.PathToMission + mi.Missionfilename);

        }
        catch
        {

            GamePlay.gpLogServer(null, "File not found", null);
        }
    }


    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);

    }
}

Last edited by FG28_Kodiak; 10-20-2011 at 03:13 PM.
Reply With Quote
  #5  
Old 10-20-2011, 05:40 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Thank yoг for a good example. I will try creating a class for my needs and will come back with more questions if any.

S!
Reply With Quote
  #6  
Old 10-21-2011, 03:41 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

I did the exercise, sure with many mistakes but will do some reading on classes creation to correct them.

However I am stuck in OnTrigger method completely.

I have several submissions running at the same time with the same filenames and the same trigger names. This happens because they are randomly loaded and the same submission can be loaded 2-4 times within an hour.

How can I identify which trigger of which submission is triggered OnTrigger? I number my missions as "mi.MisMissionNumber" but their numbers are different from OnTrigger "missionNumber".

The file is renamed to a .txt.

If you have time to answer other questions I will appreciate it.
Attached Files
File Type: txt class example2.cs.txt (7.7 KB, 4 views)

Last edited by Ataros; 10-21-2011 at 03:44 PM.
Reply With Quote
  #7  
Old 10-21-2011, 05:43 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Will take a look at it.

Short answers:
Code:
 public static string SubMissionsPath = @"missions\Multi\Dogfight\r_steppe\subs\";
    // is @ necessary here? did not use it in other missions.
With @ at the beginning you must not write \\ every time. The \ is a special character in C# (C, C++) and normaly for escape sequences \n newline for example. If you want to use \ in your string you must write \\ and to avoid the double use you can set a @ at the beginning of your string so \ is a normal character.

Code:
// what does this block do?
        public Mis(string Filename, string misType, int Lengh) // should I include all the above variables here?      
        {
            this.Missionfilename = Filename;  // You use mi.Missionfilename instead of mi.Filename in your example when load missions. Why?
            this.MissionLengh = Lengh;
            this.MissionType = misType;
            this.TrgWasTriggered = wasTriggered;
        }
this is a constructor of the class (you can also use more of them overloaded). It's usefull if you like to initialize more variables or making calculations etc.

So i can use
Code:
    public List<Mis> MissionPool = new List<Mis>()
    {
        new Mis ("Mission1.mis",SubMissionsPath ,1000.0),
        new Mis ("Mission2.mis",SubMissionsPath ,1000.0),
    };
to create several entries at one time.

// You use mi.Missionfilename instead of mi.Filename in your example when load missions. Why?
I use the public method Missionfilename to get access to the variable in the object. Filename is only used in the constructor to give the value to the variable Missionfilename.

More to come, must take a deeper look at it, but no time at the moment.
But it seems you think a bit too complicated
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:42 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.