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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #23  
Old 05-16-2011, 06:49 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Could some C# experts check this part of script for errors. Trying to randomize submission loading here. Thanks to Groundhog for idea.

Intended to run in cycle forever. Does not work for me (
Need help please.

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

public class Mission : AMission
{
   
 
// loading sub-missions
public override void OnTickGame()
{
    
    if (Time.tickCounter() % 54000 == 12600) // 54000=30 min repeat. 12600=7 min delay. 
  {
        // randomly selects 1 of several submissions
        Random RandomIncident = new Random();

        switch (RandomIncident.Next(1, 3))
        {
            case 1:
                GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/BoF1/BoF1_air01.mis");
                // GamePlay.gpHUDLogCenter("mis1 loaded!");

                double initTime = 0.0;
                Timeout(initTime += 600, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Enemy activity is expected at E3!");
                });
                Timeout(initTime += 600, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Help is needed at E3/D4!");
                });
            break;
            case 2:
                GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/BoF1/BoF1_sea01.mis");
                // GamePlay.gpHUDLogCenter("mis2 loaded"); 

                double initTime = 0.0;
                Timeout(initTime += 500, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Cover your shipping at C4!");
                });
            
                Timeout(initTime += 300, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Ships are under attack at C4!");
                });
            break;
            case 3:
                GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/BoF1/BoF1_air02.mis");
                // GamePlay.gpHUDLogCenter("mis3 loaded!");

                double initTime = 0.0;
                Timeout(initTime += 600, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! Enemy activity is expected at E2!");
                });
                Timeout(initTime += 300, () =>
                {
                    GamePlay.gpHUDLogCenter("Attention! All airgroups please proceed to E2/D3!");
                });
            break;
        }
    }

    ///////////////////////

    //loads small submissions w/o messages
    
     if (Time.tickCounter() % 216000 == 108000) // 216000=120 min repeat. 108000=60 min delay. 
     {
         GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/BoF1/BoF1_small01.mis");
     }

     if (Time.tickCounter() % 216000 == 215999) // 216000=120 min repeat. 215999=120 min delay. 
     {
         GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/BoF1/BoF1_small02.mis");
     }
}       
}

Last edited by Ataros; 05-16-2011 at 07:56 PM.
Reply With Quote
 


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 10:47 PM.


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