Results 1 to 24 of 24

Thread: Campaign progress script

  1. #1
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,139
    Post Thanks / Like
    Total Downloaded
    985.12 MB

    Campaign progress script

    One of (many) complains of SP players is the lack of visible progress through campaigns.

    For "oficial" and third part campaigns at end of mission is show the default "Statistics" with player air kills (only) and squadron loses, and after a pre-made debriefing screen for success or failure, with the button for fly next mission or restart...

    Statistics.jpg

    Desastersoft campaigns improve this a bit, though use of custom DLL, showing more details of the mission, over a custom created interface:

    http://yoyosims.pl/sites/default/fil...tersoft_15.jpg

    REDUX campaign's use an script in a way I don't like, time from time a "score board" is show on screen... like in a football match.

    The "Geniok" template from 09/2011 used in "Cliffs of Dover" campaign and other 3rd part has a "parser" for supposed track player kills and show this in next mission briefing, but I an not able to make this work, probable some changes in patches affect that old code.

    Digging in "oldSukhoi leftovers of war" I find an old (06/2011) Russian made campaign that include a script that partially "band-aid" this lack.

    The script track:

    Enemy losses
    Side looses
    Squadron looses
    Player victories


    Through:

    Code:
       int r  =  0;
    	bool cmpl = false;
    	int cEnemy = 0;
        int cFriendly = 0;
        int cPlayer = 0;
        int MySquad = 0;
       	string b, tx1;
    	string[] br = new string[100]; 
    	int cEnemyS, 	cFriendlyS, cPlayerS, MySquadS;
    - Question; is possible add track for ground kills, for use in bombers campaigns?

    So at end of mission, after "Statistics" page you have:

    Mission results.jpg

    But... an "It's CloD!" (script author point this issue*), notice at top/left of the screen: "Battle Failure", no mater if you/your side won the battle this is showed.

    *
    The result of the last mission will be displayed in the post-flight briefing; do not pay attention to the inscription on the top left "Battle Failure".
    Above text is my interpretation of Google translation from Russian (editable part).

    I notice this script has no reference for "Campaign.dll" at top, but have for "//-$debug"
    so I add, with the path in the format of 5.00x (third part campaigns in Documents\1C... \custom folder):
    //$reference parts/core/Campaign.dll (thanks Varrattu for show the new path).

    But this don't change the "Battle Failure" screen...

    The script - UPDATE - Fixed the Battle Failure/Success screen

    Spoiler: 

    Code:
    //$reference parts/core/Campaign.dll
    //-$debug
    using System;
    using System.IO;
    using maddox.game;
    using maddox.game.world;
    using System.Collections.Generic;
    
    public class Mission : maddox.game.campaign.Mission
    {
    
        int r  =  0;
    	bool cmpl = false;
    	int cEnemy = 0;
        int cFriendly = 0;
        int cPlayer = 0;
        int MySquad = 0;
       	string b, tx1;
    	string[] br = new string[100]; 
    	int cEnemyS, 	cFriendlyS, cPlayerS, MySquadS;	    
    
     public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> initiatorList) 
        {              
            if (actor is AiAircraft) 
            {
                if (!(actor is AiAircraft))
    			return; 
    		
    		if (shortName.IndexOf("92Sqn",0) > 0)  MySquad++;
    		
                if (actor.Army() == 2) cEnemy++;
                if (actor.Army() == 1) cFriendly++;
                if (actor.Army() == 2) {
                    if (GamePlay.gpPlayer().Place() != null) {
                        bool playerWin = false;
                        foreach (DamagerScore i in initiatorList) {
                            if (i.initiator != null && i.initiator.Actor == GamePlay.gpPlayer().Place()) {
                                playerWin = true;
                            }
                        }
                        if (playerWin) cPlayer++;
                    }
                }
               SaveRezult (cmpl); 
            }
        }
    
    private void SaveRezult (bool CComplite) 
    {
    int n1 = 1;
    	int j = 0;
    StreamReader f2 = new StreamReader(@"C:\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Spitfires_over_Dunkik\m1.txt");
    b =  f2.ReadLine();
    cEnemyS = Int32.Parse(b) + cEnemy;
    b =  f2.ReadLine();
    cFriendlyS = Int32.Parse(b) + cFriendly;
    b =  f2.ReadLine();
    MySquadS = Int32.Parse(b) + MySquad;
    b =  f2.ReadLine();
    cPlayerS = Int32.Parse(b) + cPlayer;
    f2.Close();
    
    StreamWriter f3 = new StreamWriter(@"C:\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Spitfires_over_Dunkik\m2.txt");
    f3.WriteLine(String.Format("{0}", cEnemyS));
    f3.WriteLine(String.Format("{0}", cFriendlyS));
    f3.WriteLine(String.Format("{0}", MySquadS));
    f3.WriteLine(String.Format("{0}", cPlayerS));
    f3.Close();
    	
    StreamReader f1 = new StreamReader(@"C:\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Spitfires_over_Dunkik\m2.briefing");
    do 
    {
    b =  f1.ReadLine();
    br[n1++] = b;
    }				
     while (b  != "[2]") ;
    
    					f1.Close();		
    
    					StreamWriter f = new StreamWriter(@"C:\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Spitfires_over_Dunkik\m2.briefing");
    					while (++j<n1)	 f.WriteLine(br[j]);
    					if (CComplite)
    					f.WriteLine("<Name>");
    					f.WriteLine("Success");
    					f.WriteLine("<Description>");
    					if (CComplite) f.WriteLine("Mission accomplished!");
    					else f.WriteLine("Mission tasks incomplete!");
    					if (MySquad >0) f.WriteLine("MISSION RESULTS");
    					else f.WriteLine("Overall, the squad performed well on the last mission.");
    
    					f.WriteLine(String.Format("RAF claims  -  {0} ", cEnemy));
    					f.WriteLine(String.Format("RAF losses  -  {0} ", cFriendly));
    					f.WriteLine(String.Format("Squadron claims  -  {0} ", MySquad));
    					f.WriteLine(String.Format("Personal claims  -  {0} ", cPlayer));
    
    					j = (cEnemy - cFriendly);
    				
    					if (j<0) f.WriteLine("The overall outcome of the mission was unsatisfactory. The RAF suffer heavy losses.");
    					if (j==0)
    						{
    						 if (cEnemy > 0) f.WriteLine("RAF's losses in the last battle were moderate. However, the overall performance needs to improve, the Luftwaffe has more aircraft.");
    						else 	 f.WriteLine("The squadron's performance needs to improve.");
    						}
    					if (j > 0)   f.WriteLine("The RAF it has performed well, the enemy's losses have been heavy.");
    
    					f.WriteLine(tx1);
    						
    					f.WriteLine("  ");
    					f.WriteLine("CAMPAIGN PROGRESS");
    					f.WriteLine(String.Format("RAF claims  -  {0} ", cEnemyS));
    					f.WriteLine(String.Format("RAF losses  -  {0} ", cFriendlyS));
    					f.WriteLine(String.Format("Squadron losses  -  {0} ", MySquadS));
    					f.WriteLine(String.Format("Personal claims  -  {0} ", cPlayerS));
    
    
    					f.WriteLine("[3]");
    					f.WriteLine("<Name>");
    					f.WriteLine("Failure");
    					f.WriteLine("<Description>");
    					if (CComplite) f.WriteLine("Mission accomplished!");
    					else f.WriteLine("Mission tasks incomplete!");
    							if (MySquad >0) f.WriteLine("Results of the last mission:");
    							else f.WriteLine("The squadron's performance needs to improve.");
    
    					f.WriteLine(String.Format("RAF claims  -  {0}, ", cEnemy));
    					f.WriteLine(String.Format("RAF losses  -  {0}, ", cFriendly));
    					f.WriteLine(String.Format("Squadron losses  -  {0}, ", MySquad));
    					f.WriteLine(String.Format("Personal claims  -  {0}, ", cPlayer));
    					
    					j = (cEnemy - cFriendly);
    				
    					if (j<0) f.WriteLine("The RAF's performance in the battle has been unsatisfactory, attrition favors the Luftwaffe.");
    					if (j==0)
    						{
    						 if (cEnemy > 0) f.WriteLine("RAF's losses in the last battle were moderate. However, the overall performance needs to improve, the Luftwaffe has more aircraft.");
    						else 	 f.WriteLine("The squadron's performance was unsatisfactory.");
    						}
    					if (j > 0)   f.WriteLine("The RAF has performed well, causing significant losses to the enemy.");
    
    					f.WriteLine(tx1);
    					if (MySquad>0)
    					f.WriteLine("The squadron's performance was remarkable.");  
    					else 
    					f.WriteLine("The squadron's performance increased. Very well, gentlemen.");  
    
    					f.WriteLine(" ");	
    					f.WriteLine("CAMPAIGN PROGRESS");
    					f.WriteLine(String.Format("RAF claims  -  {0} ", cEnemyS));
    					f.WriteLine(String.Format("RAF losses  -  {0} ", cFriendlyS));
    					f.WriteLine(String.Format("Squadron losses  -  {0} ", MySquadS));
    					f.WriteLine(String.Format("Personal claims  -  {0} ", cPlayerS));
    					f.WriteLine("<Slide>");
    					if (CComplite) 
    					f.WriteLine("CampaignSuccess2.jpg");
    					else f.WriteLine("CampaignFailure2.jpg");
    					f.WriteLine("<Caption>");
    					f.Close();
    
    }
    
    // --------------------------
    
    public override void OnBattleStarted() 
    {			
    
    					base.OnBattleStarted() ;
    					MissionNumberListener = -1;
    					tx1 = "The mission's tasks were not all completed. Replay is recommended.";
    					SaveRezult (false) ;
        }
    
        public override void OnTrigger(int missionNumber, string shortName, bool active) {
    		
            if ("trigger_3".Equals(shortName) && active) 
    		{
               	if (++r  == 4) 
    			{
    			GamePlay.gpHUDLogCenter("Waypoint reached.");
    			tx1 = "Task have been completed.";
    			
    cmpl = true;
    			SaveRezult (true) ;
    			}
    			else GamePlay.gpHUDLogCenter(String.Format("#  {0}", r));
    
                GamePlay.gpGetTrigger(shortName).Enable = false;
            }
    
    
    if ("trigger_1".Equals(shortName) && active) 
    		{
               
    				
                GamePlay.gpGetTrigger(shortName).Enable = false;
    			if (++r  == 4) 
    {
    			GamePlay.gpHUDLogCenter("Waypoint reached.");
    			tx1 = "Task have been completed.";
    cmpl = true;
    			SaveRezult (true) ;
    			}
    			else GamePlay.gpHUDLogCenter(String.Format("#  {0}", r));
    
    			AiAction action1 = GamePlay.gpGetAction("action_1");
                if (action1 != null)
    			{
                        action1.Do();					
    			}
    		  }
    
    if ("trigger_2".Equals(shortName) && active) 
    		{
               
    			GamePlay.gpGetTrigger(shortName).Enable = false;
    			if (++r == 4) 
    {
    			GamePlay.gpHUDLogCenter("Waypoint reached.");
    			tx1 = "Task have been completed.";
    cmpl = true;
    			SaveRezult (true) ;
    			}			
    			else GamePlay.gpHUDLogCenter(String.Format("#  {0}", r));
    		}
    
    if ("trigger_6".Equals(shortName) && active) 
    		{          
    			GamePlay.gpGetTrigger(shortName).Enable = false;
    			if (++r == 4) 
    {
    			GamePlay.gpHUDLogCenter("Waypoint reached.");
    			tx1 = "Task have been completed.";
    			cmpl = true;
    			SaveRezult (true) ;
    			}			
    			else GamePlay.gpHUDLogCenter(String.Format("#  {0}", r));
    		}
    
    		if ("trigger_7".Equals(shortName) && active) 
    		{
               
    			GamePlay.gpGetTrigger(shortName).Enable = false;
    			if (r < 4)
    			{ 
    			GamePlay.gpHUDLogCenter("Waypoint reached.");
    			tx1 = "Task have been completed.";
    			cmpl = true;
    			SaveRezult (true) ;
    			}
    		}
        }
    	
    	int countEnemyDead = 0;
        int countFriendDead = 0;	           
        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);
        }
    }


    Besides the script is used 3 text files.

    ccc.txt EDIT - Can use m0.txt if want
    m#.txt (# number of mission in campaign, so each mission have his own)
    m#.briefing (# number of mission in campaign, so each mission have his own)

    ccc and m#.txt have this for mission 1
    Code:
    0
    0
    0
    0
    This files are updated by script and used to update the "m#.briefing"

    Briefing contains (text is my interpretation of Google translation from Russian):

    [1] Is show at start of mission

    [2] Is show at end of mission, in the "Mission Failure" (why?) screen

    Spoiler: 

    Code:
    [1]
    <Name>
    Intro
    <Description>
    May, 23rd. Early morning.
    Yesterday our squadron was transferred from the main airfield Hornchurch to Ramsgate, closer to the main events in which we will soon become participants. And events are clearly not unfolding in our favor. In Europe, the British expeditionary forces were recently cut off from the main forces of the Allies in France, and the continued rapid offensive of the Germans could lead to their complete surrender. Of course, unless a miracle happens.
    
    Beautiful sunrise. The morning spring sun distracts from gloomy thoughts about the war, thoughts go into pleasant memories of girls, pubs and other joys of a young gentleman.
    
    But the pre-flight briefing instantly reminds us of the reality. Our squadron starts fighting. 
    
    Objective: fly to the area south of Dunkirk, patrol over the coastal strip from Dunkirk harbor to the front line south of Dunkirk itself. 
    If you spot an enemy aircraft, shoot him down. 
    Considering that you will be patrolling over the front line, there is a high probability of encountering German bombers, whose activity in this area has been very high in recent days.
    
    <Slide>
    m1.jpg
    
    <Caption>
    
    PLAYER: Mission start in the air on the way to the first patrol checkpoint. The patrol tasks will be considered completed when all checkpoints have been passed and several German aircraft have been shot down, or after 15 minutes of patrolling.
    
    [2]
    <Name>
    Success
    <Description>
    Mission accomplished!
    Results of the last mission:
    RAF claims  -  13 
    RAF losses  -  10 
    Squadron losses  -  8 
    Personal claims  -  2 
    The RAF it has performed well, the enemy's losses have been heavy.
    All tasks of the mission have been completed.
      
    Campaign progress:
    RAF claims  -  13 
    RAF losses  -  10 
    Squadron losses  -  8 
    Personal claims  -  2 
    [3]
    <Name>
    Failure
    <Description>
    Mission accomplished!
    Results of the last mission:
    RAF claims  -  13 
    RAF losses  -  10 
    Squadron losses -  8 
    Personal claims  -  2 
    The RAF has performed well, causing losses to the enemy in greater numbers than its own.
    All tasks of the mission have been completed.
     
    Campaign progress:
    RAF claims  -  13 
    RAF losses  -  10 
    Squadron losses -  8 
    Personal claims -  2 
    <Slide>
    CampaignSuccess1.jpg
    <Caption>


    Update after play the second mission of campaign, all work as expected, but are a line in Cyrilics that I don't figure where is, and this pre made comments need be very neutral, because in the last mission Squad lost 2 planes, but the text say that have no losses.

    Statistics-3.jpg

    The script has a second part - that I remove; what check, through "passThru" triggers if player reach each mission checkpoint (waypoint) and show that... "football score board".

    But this part of script can be used for more useful things, for example, tell player the HDG for next waypoint. Latter I post this part (forum message has 20.000 characters limit).
    Last edited by 1lokos; Oct-04-2020 at 21:18.

  2. Likes Marcost, von Graf liked this post
  3. #2
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,139
    Post Thanks / Like
    Total Downloaded
    985.12 MB

    Re: Campaign progress script

    I think the use of "Battle Failure" screen is because the script, made in CloD "stone-age" (06/2011), don't use:

    Code:
      if (GamePlay.gpPlayer().Place() == aircraft)
            {
                Campaign.battleSuccess = true;
    
                isComplete = true;
    How add this - without broken the rest?

    ...this pre made comments need be very neutral, because in the last mission Squad lost 2 planes, but the text say that have no losses.
    I think this misleading comments happens because the script use an "football match score" logic for trigger this comment:

    Code:
    j = (cEnemy - cFriendly);
    if (j==0)
     {
     if (cEnemy > 0) 			
     else
    In the last mission squadron 'j' ends equals to '0' (2-2), a draw, which in football can be a good result.

    BTW - This script is way more interesting and smaller than "Geniok" script, what just given 100 points for each successful mission, and show in next mission briefing "Your score: 100" (part that don't work).
    Last edited by 1lokos; Oct-06-2020 at 02:14.

  4. #3
    Manual Creation Group fenbeiduo's Avatar
    Join Date
    May 2013
    Posts
    47
    Post Thanks / Like
    Total Downloaded
    279.36 MB

    Re: Campaign progress script

    Quote Originally Posted by 1lokos View Post
    Code:
    //$reference parts/core/Campaign.dll
    //-$debug
    using System;
    using System.IO;
    using maddox.game;
    using maddox.game.world;
    using System.Collections.Generic;
    
    public class Mission : maddox.game.campaign.Mission
    {
    
        int r  =  0;
    	bool cmpl = false;
    	int cEnemy = 0;
        int cFriendly = 0;
        int cPlayer = 0;
        int MySquad = 0;
       	string b, tx1;
    	string[] br = new string[100]; 
    	int cEnemyS, 	cFriendlyS, cPlayerS, MySquadS;	    
    ...
    Maybe add this line? :
    using maddox.game.campaign;

  5. #4
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,139
    Post Thanks / Like
    Total Downloaded
    985.12 MB

    Re: Campaign progress script

    BATTLE SUCCESS

    Statitstics_4.jpg

    I add Fenbeduo suggestion and this check for campaign success, copied from other campaign, no clue about conditions, seems player return and landing.

    Code:
        int countEnemyDead = 0;
        int countFriendDead = 0;	           
        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);
        }
    }
    Script updated in the first post.

    Bellow the part of the script that change for second mission and subsequent, is just the text files (m#.txt and m#.briefing) path:

    Code:
     public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> initiatorList) 
        {              
            if (actor is AiAircraft) 
            {
                if (!(actor is AiAircraft))
    			return; 
    		
    		if (shortName.IndexOf("92Sqn",0) > 0)  MySquad++;
    		
                if (actor.Army() == 2) cEnemy++;
                if (actor.Army() == 1) cFriendly++;
                if (actor.Army() == 2) {
                    if (GamePlay.gpPlayer().Place() != null) {
                        bool playerWin = false;
                        foreach (DamagerScore i in initiatorList) {
                            if (i.initiator != null && i.initiator.Actor == GamePlay.gpPlayer().Place()) {
                                playerWin = true;
                            }
                        }
                        if (playerWin) cPlayer++;
                    }
                }
               SaveRezult (cmpl); 
            }
        }
    
    private void SaveRezult (bool CComplite) 
    {
    int n1 = 1;
    	int j = 0;
    StreamReader f2 = new StreamReader(@"C:\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Spitfires_over_Dunkik\m1.txt");
    b =  f2.ReadLine();
    cEnemyS = Int32.Parse(b) + cEnemy;
    b =  f2.ReadLine();
    cFriendlyS = Int32.Parse(b) + cFriendly;
    b =  f2.ReadLine();
    MySquadS = Int32.Parse(b) + MySquad;
    b =  f2.ReadLine();
    cPlayerS = Int32.Parse(b) + cPlayer;
    f2.Close();
    
    StreamWriter f3 = new StreamWriter(@"C:\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Spitfires_over_Dunkik\m2.txt");
    f3.WriteLine(String.Format("{0}", cEnemyS));
    f3.WriteLine(String.Format("{0}", cFriendlyS));
    f3.WriteLine(String.Format("{0}", MySquadS));
    f3.WriteLine(String.Format("{0}", cPlayerS));
    f3.Close();
    	
    StreamReader f1 = new StreamReader(@"C\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Spitfires_over_Dunkik\m2.briefing");
    do 
    {
    b =  f1.ReadLine();
    br[n1++] = b;
    }				
     while (b  != "[2]") ;
    
    					f1.Close();		
    
    					StreamWriter f = new StreamWriter(@"C:\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Spitfires_over_Dunkik\m2.briefing");
    For the next, always add mission number (m#) in the 3 last paths.
    e.g.

    "C:\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Spitfires_o ver_Dunkik\m2.briefing"

    The first path always refer to previous mission:

    "C:\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\mission\campaign\custom\campaign_Spitfires_o ver_Dunkik\m1.txt"

    Note sure if this "C:\Documents" is needed. Will cause issues if player have Documents folder outside of C:\ (mine is in D:\)
    Last edited by 1lokos; Oct-04-2020 at 21:20.

  6. #5
    Manual Creation Group fenbeiduo's Avatar
    Join Date
    May 2013
    Posts
    47
    Post Thanks / Like
    Total Downloaded
    279.36 MB

    Re: Campaign progress script

    congrats!

    Code:
    using maddox.game.campaign;
    Saw this once in a post

  7. #6
    Supporting Member
    Join Date
    Sep 2019
    Location
    Yorkshire
    Posts
    75
    Post Thanks / Like
    Total Downloaded
    665.29 MB

    Re: Campaign progress script

    Hi 1lokos,

    Thanks for for posting (and correcting!) this script.

    There is one part I don't understand - there are four triggers in the script. Are these part of the script for campaign progress tracking, or do they belong to the specific mission that this script is used with?

    Reason: I am interested in updating some other campaigns to use this script, but if these triggers are required for the campaign progress script then will I also need to edit each mission in FMB as well as adding the script as a missionname.cs file (and of course adding the three txt files m#)?

    Thank you

    M

  8. #7
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,139
    Post Thanks / Like
    Total Downloaded
    985.12 MB

    Re: Campaign progress script

    MarcosT

    The trigger in the script give me a big headache.

    Since I have no clue about C# need do "trial and error" (many).

    Seems the triggers are not need for count the kills, but for check if player did the "mission tasks" - fly through missions waypoint's, when this happens you a #2, #3... in screen.

    Some waypoint's trigger a action (e.g. spawn an enemy group), and these instead show #2.. show a message, e.g. "Waypoint reached".
    E.g. waypoint number 3 trigger have "if (++r == 4)" so the condition for show the message is matched. Others have, e.g. "(r < 4) ".

    Seems that if player do some number of "tasks" (pass through a number of waypoint's) the results is saved, and a message "Mission tasks accomplished" is added in "score" page.

    Thing is that I don't figure the logic of this "r"...

    I see that waypoint 1 trigger #2...

    A attempts in modify use this trigger for other use, eg. show different messages result in errors "out of matrix" and broken the whole script.

    So as "band-aid" solution I remove the messages from triggers and leave the triggers doing their thing, just set a waypoint for the trigger that have the
    "if (++r == 4)" for results to be saved.

    And add others trigger with number after the last for other uses.

    Another question, seems that for remove the triggers is need change the count kills script, I think this "private void SaveRezult (bool CComplite) is related with the triggers, as some triggers have this part:

    SaveRezult (true) ;
    cmpl = true;

    Hope that you understand my confusion.

    BTW - IMHO, this "campaign progress" resume at end of missions add much for the campaign, giving a sense of purpose.

  9. #8
    Supporting Member
    Join Date
    Sep 2019
    Location
    Yorkshire
    Posts
    75
    Post Thanks / Like
    Total Downloaded
    665.29 MB

    Re: Campaign progress script

    Yes I agree it is confusing!

    The cmpl is a boolean, i.e. true or false. It is translated to 'CComplite' in the private void SaveRezult method. It is then used here:

    Code:
    				if (CComplite)
    					f.WriteLine("<Name>");
    					f.WriteLine("Success");
    					f.WriteLine("<Description>");
    					if (CComplite) f.WriteLine("Mission accomplished!");
    					else f.WriteLine("Mission tasks incomplete!");

    So cmpl is effectively short for "Is the mission complete? Yes/No"

    I don't know much about triggers but I agree that the 'r' looks like it will say "mission complete" after passing four waypoints.

    I wonder if there were another way to test for proximity to waypoints, then we wouldn't need the triggers. I can work out in code how to find the player's location, so would just need the waypoint location to test distance against. I will have a look.

    I need campaign progress for immersion too!

    Regards

  10. #9
    Supporting Member
    Join Date
    Sep 2019
    Location
    Yorkshire
    Posts
    75
    Post Thanks / Like
    Total Downloaded
    665.29 MB

    Re: Campaign progress script

    Something like this maybe.

    way.GetLength returns the total number of waypoints for the flight (just like good old IL2 1946 )


    Code:
    int r = 0
    
    if (player.GetCurrentWayPoint() == (way.GetLength(0) - (way.GetLength(0)-2))    //second waypoint 
    
           r++;
    
    if (player.GetCurrentWayPoint() == way.GetLength(0)/2) // middle waypoint
    
           r++;
    
    if (player.GetCurrentWayPoint() == way.GetLength(0)) // last waypoint
    
           r++;
    
    if r>3
    cmpl = true;
    SaveRezult (true) ;
    
    etc

  11. #10
    Manual Creation Group
    Join Date
    May 2020
    Location
    Czech Republic
    Posts
    108
    Post Thanks / Like
    Total Downloaded
    134.12 MB

    Re: Campaign progress script

    Quote Originally Posted by Marcost View Post

    Code:
    
    if (player.GetCurrentWayPoint() == (way.GetLength(0) - (way.GetLength(0)-2))    //second waypoint
    Hi Marcost,

    I apologize for jumping into your discussion.

    The condition above is overly complicated. You can simplify it this way:

    Code:
    
    if (player.GetCurrentWayPoint() == 2)    //second waypoint
    Also, a right bracket is missing in your condition at the end. Or you need to remove the left bracket after "==".

    Josef

  12. #11
    Supporting Member
    Join Date
    Sep 2019
    Location
    Yorkshire
    Posts
    75
    Post Thanks / Like
    Total Downloaded
    665.29 MB

    Re: Campaign progress script

    Hi Josef,

    No problem!

    You are correct. The reason I wrote it that way was so that you cannot create an error e.g.:

    if (player.GetCurrentWayPoint() == 10) ... but there is no waypoint 10 because waypoints are 1 to 7 only.

    All we need to do for our purpose is to identify that the player has passed 'some' of the waypoints.

    The syntax is not complete, it was just an illustration.

    Thank you!

    Martin

  13. #12
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,139
    Post Thanks / Like
    Total Downloaded
    985.12 MB

    Re: Campaign progress script

    Marcost

    May you can integrate this bit for count ground kills in the script, I think in first part.

    Code:
               
                    else if (actor is AiGroundActor)
                    {
                        // code for destroyed groundactors
                    }
    
    //-------------------
    
       else if (actor is AiGroundActor) 
            {
                if ((actor as AiGroundActor).ExistCabin(0))
                    for (int i = 0; i < (actor as AiGroundActor).Places(); i++)
                    {
                        if ((actor as AiGroundActor).Player(i) != null)
                        {
                            actorDestroyable = false;
                            break;
                        }
                    }
            }
    Last edited by 1lokos; Nov-20-2020 at 19:28.

  14. #13
    Supporting Member
    Join Date
    Sep 2019
    Location
    Yorkshire
    Posts
    75
    Post Thanks / Like
    Total Downloaded
    665.29 MB

    Re: Campaign progress script

    Yes that's a good idea!

    I have got the waypoint code working so it will be possible to remove the trigger code where mission success = player passed waypoint x, y, z if desired. Not having triggers in this script will make it easier to merge with existing campaign mission scripts that do have triggers in them.

    I'm also able to get the name of the cs file and therefore the mis file, without specifying the path or file name. That means the M# files could be found without specifying the path, as long as they are something like mission_name_m1.txt, mission_name_m2.txt etc. Hopefully means it should be quite easy to add the script to existing campaigns:

    e.g. campaign with 20 missions:

    1) create 20 copies of .cs
    2) create 20 copies of blank.txt
    3) Use free program like AF5rename to rename the files to the mission.mis name and add _m1 etc
    4) Repeat (2) for other M# files

    I have about 30 campaigns from various authors. Half of those use a campaign tracking script by 'Geniok' so I think first thing will be to create a merged version of this.


    Regards

    M
    Last edited by Marcost; Nov-21-2020 at 11:26.

  15. Likes 1lokos liked this post
  16. #14
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,139
    Post Thanks / Like
    Total Downloaded
    985.12 MB

    Re: Campaign progress script

    Geniok script just track mission success, and give "100 points" for each mission successful, what is write in Briefing, but don't totalize in the next, there is no reason to keep this script.

    Since this (Genik) script was used in one of early made campaign, next mission makers just copy, but as far I see most don't bother for that 100 "points" parts show up - I manage to make work, but find pointless.

    This scrip in OP - I call "Vetochka", have another version, in what the live of your wingman live is tracked, and seems that give medals for certain number of kills.

  17. Likes Marcost liked this post
  18. #15
    Supporting Member
    Join Date
    Sep 2019
    Location
    Yorkshire
    Posts
    75
    Post Thanks / Like
    Total Downloaded
    665.29 MB

    Re: Campaign progress script

    That sounds interesting, do you have that script?

    Regards

    M

  19. #16
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,139
    Post Thanks / Like
    Total Downloaded
    985.12 MB

    Re: Campaign progress script

    Is the "campaign_bd" (play as German) - briefings are (Google) translated by Gabuzomeu, I (Google) translate the comments in script of mission 1.

    Script has 1189 lines.

    Give a look in the readme.txt explaining how work.

    https://transferxl.com/profile/step1...2QqsxapNw2c%2C

  20. #17
    Manual Creation Group fenbeiduo's Avatar
    Join Date
    May 2013
    Posts
    47
    Post Thanks / Like
    Total Downloaded
    279.36 MB

    Re: Campaign progress script

    Quote Originally Posted by 1lokos View Post
    This scrip in OP - I call "Vetochka", have another version, in what the live of your wingman live is tracked, and seems that give medals for certain number of kills.
    It is something worth to add to the campain.
    How does it show the 'medal' to the player?

  21. #18
    Supporting Member
    Join Date
    Sep 2019
    Location
    Yorkshire
    Posts
    75
    Post Thanks / Like
    Total Downloaded
    665.29 MB

    Re: Campaign progress script

    Quote Originally Posted by 1lokos View Post
    Is the "campaign_bd" (play as German) - briefings are (Google) translated by Gabuzomeu, I (Google) translate the comments in script of mission 1.

    Script has 1189 lines.

    Give a look in the readme.txt explaining how work.

    https://transferxl.com/profile/step1...2QqsxapNw2c%2C
    Hi, link doesn't work for me

    Regards

  22. #19
    Supporting Member
    Join Date
    Sep 2019
    Location
    Yorkshire
    Posts
    75
    Post Thanks / Like
    Total Downloaded
    665.29 MB

    Re: Campaign progress script

    I tried the campaign script but get an error in the SaveRezult method:

    System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at Mission.SaveRezult(Boolean CComplite)

    I can see that M2.txt has been populated after the mission, so something is working.

    Can you explain the ccc.txt file, it is not referred to in the script?

    Thanks

  23. #20
    Supporting Member
    Join Date
    Sep 2019
    Location
    Yorkshire
    Posts
    75
    Post Thanks / Like
    Total Downloaded
    665.29 MB

    Re: Campaign progress script

    Update: I have found the script with medals that you are referring to. It is in campaign 'Messerchmitt over Dunkirk". The script is working fine in that campaign so I will use that as my starting point.

  24. #21
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,139
    Post Thanks / Like
    Total Downloaded
    985.12 MB

    Re: Campaign progress script

    Yes, "campaign_db" is "Messerschmidt over Dunkirk".

    If you have the install files, look in the "Readme.txt". Anyway:

    Spoiler: 

    Code:
    RC_Bublik and RC_Bu-Bu (Vetochka) published yet another great campaign, which I (mostly Google) translated again.
    New features (see below) deliver a very lively and capturing experience...
    You even can win Medals 
    
    File is attached, use campaign tool to install.
    
    Thanks to Vetochka for all the work and invention!
    Gabu
    
    Messerschmidts over Dunkirk
    
    The second season of the series "fighters over Dunkirk." campaign consists of 16 missions.
    
    The player commands a squadron I/JG27 from May 20 to June 1, 1940 Aircraft player Bf-109E3, sometimes Bf-109E1. Features campaign.
    
    1. The system of rewards and promotions in rank.
    
    Awards (iron cross) are available for a downed aircraft, and thanks for raising the rank of player points. The system rewards authors admitted some voluntarism and slightly altered the historical system of rewards. 
    In the period clears the Knight's Cross was issued for 20 kills in this campaign is issued for 40 kills. 
    This was done solely for the sake of playability, since testing campaign, I was crammed with more than 20 aircraft in the first half of the campaign and incentive for obtaining the highest award of just disappeared. Oak leaves and other gadgets to the Knight's Cross were introduced later. 
    Iron Cross 2nd and 1st degree granted for 2 and 5 kills respectively.
    
    The second line of winning depend on the player points. 
    The first two rewards - are some of gratitude, the third - higher rank.
     When typing in a strong minus a player may be demoted and removed from the squadron commander on what the campaign is over.
    
    The player starts with the rank of Oberleutnant and can be upgraded to Hauptmann.
    Points system is not transparent, each mission has its own system. 
    Generally for carrying out a fundamental problem, which is not everywhere, is given 100 or 150 points. 
    
    For example, in the first mission during its implementation need to protect staff from the plane suddenly appeared in the rear of the British.
    If you protect the aircraft, the 150, will not protect, and continue to "triggerhappy" shoot Blenheims or can not defend, you get -100.
    There are missions where there are no major problems, such as patrolling with the priority of attack fighters. 
    
    It is commonly used progressive points system for the purpose, ie For the first 5 kills is calculated for each 5, with the following - 10, etc. 
    Accordingly, if you are protecting bombers, then for each shot down is also less than the more kills, the more minuses for each downed. Standard plus player is rewarded for kills, kills per squadron, commanded by the player, minus the loss of an aircraft squadron, the death or capture pilot squadron, for the loss of the slave, the big minus is given for the death or capture wingmans.
    
    2. If a player during the mission was killed, captured or had been demoted, the campaign goes on, but all the advances are cleared, ie, is like winning back already for another character.
    To keep all the achievements will have to fly the mission, ie choose a new attempt.
    Hit in captivity will always be a player sits down at an emergency in enemy territory, if a player jumps over enemy territory, it is likely to avoid capture. 
    Probability depends on the distance from the front lines.
    
    3. Aircraft squadrons are not infinite, although periodically replenished. 
    Ie If, after the mission you have left six of the 12 fighters, the next mission you fly second, of course, unless otherwise provided in this mission completion. 
    
    The number of pilots is infinite, is only statistics on the death of the pilots, and, accordingly, for the death of the pilot squadron the player gets a minus on points.
    
    4. The job may change during the mission, for example, you start out on patrol in one place, but in the course of changing the situation and send you to another place. Message about changing jobs appears in the messages from the server, ie, you have a message box should be included messages from the server.
    
    By default they are enabled. This is where they write that such and such a fact has brought down some. In the important messages that the player drew attention to them, in the center of the screen illuminates the inscription «Achtung». 
    
    After the appearance of this line should always watch window server messages, because You may need to fly is in the opposite direction.
    
    5. Counting kills. Not everyone can be confirmed shot down. Guaranteed counted downed, fallen on your territory, and shot down in front of witnesses. Downed in enemy territory without witnesses can not be counted. Sometimes you give your slave a victory.
    
    6. The campaign has several so-called long mission, ie player may return from the battle area to the airfield to change aircraft and fly again. 
    On this you will be informed in advance of the briefing. Accordingly, if a player was hit or injured, then again he can not fly.
    
    7. Because of the technical features of the game, the start is almost always in the air. With appropriate modifications to the game in the future it can be fixed. You can make a landing at the airport or out of the game ESC. 
    There are no restrictions on the way there is no ESC, ie, this can be done over enemy territory in any state and always will be a return, of course, if a player is alive. 
    
    Restrictions, we do not have especially for those who do not like to replay the mission twice. So this moment is only on for a player to the passage of the campaign. In the primary mission of the map there is no German airfields, so instead of landing the player returns to a certain square, which will be clear from the briefing.
    
    8. In some missions the element of chance is present, ie type appears opponent is chosen randomly, sometimes randomly selected number of planes in the emerging group of enemy. At the end of the mission will always be left on top the inscription "The failure of the battle." Do not pay attention to it.
     
    The text will always be written post-brifing anskolko successfully you have completed the task, and whether to continue the campaign without a loss of points and awards.
    
    SETTING CAMPAIGN Download two files from attachments. Extract the files in the archive folder campaign_bd.zip campaign "campaign_bd" (not rename!), The second archive program il2campaigntool.exe. Run the example program in which points the way to incentives, such as automatically detects and path to the downloaded this and unzipped folder already campaign_bd. 
    
    We press the button "installs". Start "BoB" and appears in the list of campaigns the campaign "Messerschmitt over Dunkirk." Pleasant passage.
    
    Authors: RC_Bublik and RC_Bu-Bu (Vetochka).
    Practical advice. When escorting bomber, Fear Beaufighter


    Is important don't rename the campaign folder: "... campaign "campaign_bd" (not rename!),"

    And (probable due CloD issue at time), the end mission briefing don't show the appropriated screen, so add the bit "campaign success = false" and condition to be true.

    "At the end of the mission will always be left on top the inscription "The failure of the battle." Do not pay attention to it."

    System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at Mission.SaveRezult(Boolean CComplite)
    As I understand from practice, this error is caused by errors in the triggers "math", the "r" e.g. (++r == 4)" ... (++r =< 4)" ... don't
    Last edited by 1lokos; Nov-22-2020 at 11:35.

  25. #22
    Supporting Member
    Join Date
    Sep 2019
    Location
    Yorkshire
    Posts
    75
    Post Thanks / Like
    Total Downloaded
    665.29 MB

    Re: Campaign progress script

    I didn't have the readme, thank you it is useful.

    The readme mentions this messerschmitt campaign is the second one, do you have the first? Or any others with this script?

    Regards

  26. #23
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,139
    Post Thanks / Like
    Total Downloaded
    985.12 MB

    Re: Campaign progress script

    The first "Vetochka" campaign is the "Spitfire over Dunkirk" (campaign-dk), the scrip in OP.

  27. Likes Marcost liked this post
  28. #24
    Supporting Member
    Join Date
    Sep 2019
    Location
    Yorkshire
    Posts
    75
    Post Thanks / Like
    Total Downloaded
    665.29 MB

    Re: Campaign progress script

    Ah yes, I do have it then. That script is completely different to "Messerschmitts over Dunkirk", I didn't recognise it as the same authors.

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
  •