PDA

View Full Version : Whats wrong here please?


Storm of When
11-10-2011, 12:55 PM
Hi,
I added a couple of escort flights to a map I got from Ataros, they are missions 5 & 6 in the text, the bombers loaded and ran, but the fighters didn`t i`m guessing it`s a code error but I don`t really understant it tbh. Can someone see if anything obvious is in this?

using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
using part;
using System.Threading;
using System.IO;

public class Mission : AMission
{


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

if (aircraft != null)
switch (aircraft.Army())
{
case 1:
if (aircraft.Type() == AircraftType.Bomber)
{ GamePlay.gpHUDLogCenter(new Player[] {player},"You should bomb tankers in Folkestone-Wissant. Цель-танкеры в Фолкстон-Виссан."); }
else { GamePlay.gpHUDLogCenter(new Player[] { player }, "You should cover bombers in Folkestone-Wissant. Прикрыть бомберы в Фолкстон-Виссан."); }
break;
case 2:
if (aircraft.Type() == AircraftType.Bomber)
{ GamePlay.gpHUDLogCenter(new Player[] { player }, "You should bomb tankers in Folkestone-Wissant. Цель-танкеры в Фолкстон-Виссан."); }
else { GamePlay.gpHUDLogCenter(new Player[] { player }, "You should cover bombers in Folkestone-Wissant. Прикрыть бомберы в Фолкстон-Виссан."); }
break;

}
}




public override void OnTickGame()
{

// loads the 1st sub-mission in 6 min and repeates it every 40 min.
if (Time.tickCounter() % 72000 == 10800) // 72000 = 40 min repeat. 10800 = 6 min delay.
// pls. note!!! the 1st figure above must be always larger than 2nd!
{
GamePlay.gpPostMissionLoad("missions/Trial/redships.mis");
// prints message on screen after mission load
GamePlay.gpHUDLogCenter("New allies ships in E6! Новые корабли союзников в Е6!");

}

// loads the 2nd sub-mission, etc. the same way
if (Time.tickCounter() % 72000 == 36000) // 72000 = 40 min repeat, 36000 = 20 min delay.
{
GamePlay.gpPostMissionLoad("missions/Trial/blueships.mis");
GamePlay.gpHUDLogCenter("New axis ships in I5! Новые корабли оси в I5!");

}

// loads the 3rd sub-mission
if (Time.tickCounter() % 27000 == 26999) // 27000 = 15 min repeat, 26999 = 15 min delay
{
GamePlay.gpPostMissionLoad("missions/Trial/redplanes.mis");
//GamePlay.gpHUDLogCenter("New allies planes in E6! Новые самолеты союзников в Е6!");

// сообщение через 1 минуту
double initTime = 0.0;
Timeout(initTime += 60, () =>
{
GamePlay.gpHUDLogCenter("New allies planes in E6! Новые самолеты союзников в Е6!");
});

}

// loads the 4th sub-mission
if (Time.tickCounter() % 27000 == 1800) // 15 min repeat, 1800 = 1 min delay
{
GamePlay.gpPostMissionLoad("missions/Trial/blueplanes.mis");
//GamePlay.gpHUDLogCenter("New axis planes in I5! Новые самолеты оси в I5!");

// сообщение через 1 минуту
double initTime = 0.0;
Timeout(initTime += 60, () =>
{
GamePlay.gpHUDLogCenter("New axis planes in I5! Новые самолеты оси в I5!");
});

}

// loads the 5th sub-mission
if (Time.tickCounter() % 27000 == 26999) // 27000 = 15 min repeat, 26999 = 15 min delay
{
GamePlay.gpPostMissionLoad("missions/Trial/redplanesesc.mis");
//GamePlay.gpHUDLogCenter("New allies planes in E6! Новые самолеты союзников в Е6!");

// сообщение через 1 минуту
double initTime = 0.0;
Timeout(initTime += 60, () =>
{
GamePlay.gpHUDLogCenter("New allies planes in E6! Новые самолеты союзников в Е6!");
});

}

// loads the 6th sub-mission
if (Time.tickCounter() % 27000 == 1800) // 15 min repeat, 1800 = 1 min delay
{
GamePlay.gpPostMissionLoad("missions/Trial/blueplanesesc.mis");
//GamePlay.gpHUDLogCenter("New axis planes in I5! Новые самолеты оси в I5!");

// сообщение через 1 минуту
double initTime = 0.0;
Timeout(initTime += 60, () =>
{
GamePlay.gpHUDLogCenter("New axis planes in I5! Новые самолеты оси в I5!");
});

}
}






}


Thx as always,
Smurfy.

Ataros
11-10-2011, 02:17 PM
Maybe #4 and #6 have the same delay?