Thread: Mission script?
View Single Post
  #2  
Old 02-27-2012, 12:17 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

This make no sense
Code:
            double initTime = 0.0;
            Timeout(initTime += 100, () =>
            {
                GamePlay.gpHUDLogCenter("German bomber attack on radar stations!");
                GamePlay.gpHUDLogCenter("Supply train headed to Boulogne and Calais!");
            });
you will only see the last message after 100sec

if you will see both you should change it into
Code:
            double initTime = 0.0;
            Timeout(initTime += 100, () =>
            {
                GamePlay.gpHUDLogCenter("German bomber attack on radar stations!");
            });
            Timeout(initTime += 10, () =>
            {
                GamePlay.gpHUDLogCenter("Supply train headed to Boulogne and Calais!");
            });
Now you get the first Message after 100sec and the other 10sec after the first.
(You should change the times of second messagepart also, to avoid that the latest message overrides an earlier.)

The rest is ok if you use
public override void OnTickGame()
{
on the beginning.

So your script should look like:
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;

public class Mission : AMission
{

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


        if (Time.tickCounter() % 432000 == 21600) // 240 min repeat, 12 min delay.
        {
            GamePlay.gpPostMissionLoad("missions/channelv6/BM1/Practice1.mis");
            GamePlay.gpPostMissionLoad("missions/channelv6/Supply/bluetrain_C2h.mis");
            GamePlay.gpPostMissionLoad("missions/channelv6/Supply/bluetrain_B2h.mis");

            double initTime = 0.0;
            Timeout(initTime += 100, () =>
            {
                GamePlay.gpHUDLogCenter("German bomber attack on radar stations!");
            });
            Timeout(initTime += 10, () =>
            {
                GamePlay.gpHUDLogCenter("Supply train headed to Boulogne and Calais!");
            });
        }

        if (Time.tickCounter() % 432000 == 216000) // 240 min repeat, 120 min delay.
        {
            GamePlay.gpPostMissionLoad("missions/channelv6/BM1/Practice2.mis");
            GamePlay.gpPostMissionLoad("missions/channelv6/Supply/bluetrain_B2h.mis");
            GamePlay.gpPostMissionLoad("missions/channelv6/Supply/bluetrain_C2h.mis");

            double initTime = 0.0;
            Timeout(initTime += 100, () =>
            {
                GamePlay.gpHUDLogCenter("German bomber attack on airbases!");
            });
            Timeout(initTime += 10, () =>
            {
                GamePlay.gpHUDLogCenter("Supply train headed to Boulogne and Calais!");
            });
        }
    }
}
Hint: 30ticks are around 1second.
so 21600 ticks is around 12 min and not 5
and 216000 ticks are 120min

Last edited by FG28_Kodiak; 02-27-2012 at 12:45 PM.
Reply With Quote