Results 1 to 4 of 4

Thread: Scrip for count ground objects destroyed.

  1. #1
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Scrip for count ground objects destroyed.

    For use in Single Player Campaigns.

    This count - using "OnActorDead" air kills (player kills, squadron losses, side kills, enemy losses).

    Code:
    public class Mission : maddox.game.campaign.Mission
    {    
     AiActor a1;
     AiAircraft airc1;
     int r  =  1;
    	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("219Sqn",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); 
            }
        }
    
    public static string USER_DOC_PATH = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);	
    public static string FILE_PATH = USER_DOC_PATH + "../1C SoftClub/il-2 sturmovik cliffs of dover/mission/campaign/custom/campaign_Bristol_Beaufighter/";
    
    private void SaveRezult (bool CComplite) 
     {
        int n1 = 1;
    	int j = 0; 
        	
        StreamReader f2 = new StreamReader(@USER_DOC_PATH + "../1C SoftClub/il-2 sturmovik cliffs of dover/mission/campaign/custom/campaign_Bristol_Beaufighter/m4.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(@USER_DOC_PATH + "../1C SoftClub/il-2 sturmovik cliffs of dover/mission/campaign/custom/campaign_Bristol_Beaufighter/m5.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(@USER_DOC_PATH + "../1C SoftClub/il-2 sturmovik cliffs of dover/mission/campaign/custom/campaign_Bristol_Beaufighter/Bristol_Beaufighter_05.briefing");
        do 
        {
          b =  f1.ReadLine();
          br[n1++] = b;
        }				
          while (b  != "[2]") ;
    
    					f1.Close();					
    					
    					StreamWriter f = new StreamWriter(@USER_DOC_PATH + "../1C SoftClub/il-2 sturmovik cliffs of dover/mission/campaign/custom/campaign_Bristol_Beaufighter/Bristol_Beaufighter_05.briefing");
    					while (++j<n1)	 f.WriteLine(br[j]);
    					if (CComplite)
    					f.WriteLine("<Name>");
    					f.WriteLine("Success");
    					f.WriteLine("<Description>");
    					if (CComplite) f.WriteLine("mission tasks have been accomplished!");
    					else f.WriteLine("Mission tasks have not been completed!");
    					if (MySquad >0) f.WriteLine("RESULTS OF THE LAST MISSION:");
    					else f.WriteLine("Overal the RAF had good performance in the last mission.");
    
    					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, losing more aircraft than the enemy.");
    					if (j==0)
    						{
    						 if (cEnemy > 0) f.WriteLine("The losses of the RAF in the last battle were lower than those of the enemy, but the performance of our squadrons needs to improve, the friction battle favors the Luftwaffe, which has more aircraft.");				
    						else 	 f.WriteLine("The squad performed well." );
    						}
    					if (j > 0)   f.WriteLine("The squadron's performance was not remarkable, review your tactics, gentlemen.");
    
    					f.WriteLine(tx1);
    						
    					f.WriteLine("  ");
    					f.WriteLine("CAMPAIGN PROGRESS:");
    					f.WriteLine(String.Format("Luftwaffe losses  -  {0} ", cEnemyS));
    					f.WriteLine(String.Format("RAF losses  -  {0} ", cFriendlyS));
    					f.WriteLine(String.Format("Squadron losses  -  {0} ", MySquadS));
    					f.WriteLine(String.Format("Personal score  -  {0} ", cPlayerS));
    
    					f.WriteLine("[3]");
    					f.WriteLine("<Name>");
    					f.WriteLine("Failure");
    					f.WriteLine("<Description>");
    					if (CComplite) f.WriteLine("Mission tasks have been accomplished!");
    					else f.WriteLine("Mission tasks have not been completed!");
    					if (MySquad >0) f.WriteLine("RESULTS OF THE LAST MISSION:");
    					else f.WriteLine("Squadron perform well in the last mission. Keep going, gentlemen.");
    
    					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, losing more aircraft than the enemy.");
    					if (j==0)
    						{
    						 if (cEnemy > 0) f.WriteLine("The losses of the RAF in the last battle were lower than those of the enemy, but the performance of our squadrons needs to improve, the friction battle favors the Luftwaffe, which has more aircraft.");					
    						 else 	 f.WriteLine("The squadron's performance was not remarkable, review your tactics, gentlemen.");
    						}
    					if (j > 0)   f.WriteLine("The RAF has performed well, causing losses to the enemy in greater numbers than its own.");
    
    					f.WriteLine(tx1);
    					f.WriteLine(" ");	
    					f.WriteLine("CAMPAIGN PROGRESS:");
    					f.WriteLine(String.Format("Luftwaffe losses  -  {0} ", cEnemyS));
    					f.WriteLine(String.Format("RAF losses  -  {0} ", cFriendlyS));
    					f.WriteLine(String.Format("Squadron losses -  {0} ", MySquadS));
    					f.WriteLine(String.Format("Personal score -  {0} ", cPlayerS));
    					f.WriteLine("<Slide>");
    					if (CComplite) 
    					f.WriteLine("CampaignSuccess.jpg");
    					else f.WriteLine("CampaignFailure.jpg");
    					f.WriteLine("<Caption>");
    
    					f.Close();
     }

    What (int) reference use for count, in the same script, this ground kills?

    Destroyed ground.jpg

  2. #2
    Manual Creation Group fenbeiduo's Avatar
    Join Date
    May 2013
    Posts
    70
    Post Thanks / Like
    Total Downloaded
    282.61 MB

    Re: Scrip for count ground objects destroyed.

    Quote Originally Posted by 1lokos View Post
    What (int) reference use for count, in the same script, this ground kills?

    Destroyed ground.jpg
    Very interesting, this is somthing similar to the 1946 system which is good in my view.

    Sokol1 can you paste the full scale of this screen shot?

    I believe this UI is like this one:Statistics.jpg which you've post before.

    If this is the case, it means, it may not relate to those script lines above. Yet, the script above probably impact the 'debfriefing' UI(the one with a picture to the right of text)

    Can you post or upload full content of the .cs file?

    Fen
    Last edited by fenbeiduo; Nov-23-2020 at 11:21.

  3. #3
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Re: Scrip for count ground objects destroyed.

    Yes, the ground objects destroyed are show after "Friendly losses" in "Statistics" UI screen, that is show after end a mission, is not dependent of scripts.

    I think that this ground kills statistic was added recently, because don't remember see this before.

    What I want is this integrate this in the script (in OP) for totalize in campaign's progress, specially for bombers, but this is beyond my "knowledge" of scripts.
    Last edited by 1lokos; Nov-23-2020 at 11:24.

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

    Re: Scrip for count ground objects destroyed.

    I see, it is worth a 'digging' (I am new to the C#)

    Probably someone would show his magic
    Last edited by fenbeiduo; Nov-23-2020 at 11:37.

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
  •