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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-27-2012, 11:53 AM
king1hw king1hw is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default Mission script?

Is this script ok?


if (Time.tickCounter() % 432000 == 21600) // 240 min repeat, 5 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!");
GamePlay.gpHUDLogCenter("Supply train headed to Boulogne and Calais!");
});

}

if (Time.tickCounter() % 432000 == 216000) // 240 min repeat, 240 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!");
GamePlay.gpHUDLogCenter("Supply train headed to Boulogne and Calais!");
});

}
}
Reply With Quote
  #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
  #3  
Old 02-29-2012, 12:51 AM
king1hw king1hw is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default Full script!

Kodiak I know this is basic if you can make it better that would be fantastic. I am new at the scripting thing and I am piecing things together.



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

public class Mission : AMission
{

public override void OnTickGame()
{


if (Time.tickCounter() % 432000 == 13500) // 240 min repeat, 5 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");
GamePlay.gpPostMissionLoad("missions/channelv6/Supply/seasupply_red_1h_1.mis");
GamePlay.gpPostMissionLoad("missions/channelv6/Supply/seasupply_red_1h_2.mis");
GamePlay.gpPostMissionLoad("missions/channelv6/Supply/seasupply_red_1h_3.mis");
GamePlay.gpPostMissionLoad("missions/channelv6/Supply/seasupply_red_1h_4.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!");
});
Timeout(initTime += 10, () =>
{
GamePlay.gpHUDLogCenter("Supply Ships headed to Dover!");
});

}

if (Time.tickCounter() % 432000 == 432000) // 240 min repeat, 240 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");
GamePlay.gpPostMissionLoad("missions/channelv6/Supply/seasupply_red_2h_1.mis");
GamePlay.gpPostMissionLoad("missions/channelv6/Supply/seasupply_red_2h_2.mis");
GamePlay.gpPostMissionLoad("missions/channelv6/Supply/seasupply_red_2h_3.mis");
GamePlay.gpPostMissionLoad("missions/channelv6/Supply/seasupply_red_2h_4.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!");
});
Timeout(initTime += 10, () =>
{
GamePlay.gpHUDLogCenter("Supply Ships headed to Dover!");
});
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////

// destroys aircraft abandoned by a player.
private bool isAiControlledPlane (AiAircraft aircraft)
{
if (aircraft == null)
{
return false;
}

Player [] players = GamePlay.gpRemotePlayers ();
foreach (Player p in players)
{
if (p != null && (p.Place () is AiAircraft) && (p.Place () as AiAircraft) == aircraft)
{
return false;
}
}

return true;
}

private void destroyPlane (AiAircraft aircraft) {
if (aircraft != null) {
aircraft.Destroy ();
}
}

private void explodeFuelTank (AiAircraft aircraft)
{
if (aircraft != null)
{
aircraft.hitNamed (part.NamedDamageTypes.FuelTank0Exploded);
}
}

private void destroyAiControlledPlane (AiAircraft aircraft) {
if (isAiControlledPlane (aircraft)) {
destroyPlane (aircraft);
}
}

private void damageAiControlledPlane (AiActor actor) {
if (actor == null || !(actor is AiAircraft)) {
return;
}

AiAircraft aircraft = (actor as AiAircraft);

if (!isAiControlledPlane (aircraft)) {
return;
}

if (aircraft == null) {
return;
}

aircraft.hitNamed (part.NamedDamageTypes.ControlsElevatorDisabled);
aircraft.hitNamed (part.NamedDamageTypes.ControlsAileronsDisabled);
aircraft.hitNamed (part.NamedDamageTypes.ControlsRudderDisabled);
aircraft.hitNamed (part.NamedDamageTypes.FuelPumpFailure);

int iNumOfEngines = (aircraft.Group() as AiAirGroup).aircraftEnginesNum();
for (int i = 0; i < iNumOfEngines; i++)
{
aircraft.hitNamed((part.NamedDamageTypes)Enum.Pars e(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure"));
}

/***Timeout (240, () =>
{explodeFuelTank (aircraft);}
);
* ***/

Timeout (300, () =>
{destroyPlane (aircraft);}
);
}

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

public override void OnPlaceLeave (Player player, AiActor actor, int placeIndex)
{
base.OnPlaceLeave (player, actor, placeIndex);
Timeout (1, () =>
{damageAiControlledPlane (actor);}
);
}

public override void OnAircraftCrashLanded (int missionNumber, string shortName, AiAircraft aircraft)
{
base.OnAircraftCrashLanded (missionNumber, shortName, aircraft);
Timeout (300, () =>
{ destroyPlane(aircraft); }
);
}
public override void OnAircraftLanded (int missionNumber, string shortName, AiAircraft aircraft)
{
base.OnAircraftLanded(missionNumber, shortName, aircraft);
Timeout(300, () =>
{ destroyPlane(aircraft); }
);
}


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

//Listen to events of every mission
public override void Init(maddox.game.ABattle battle, int missionNumber)
{
base.Init(battle, missionNumber);
MissionNumberListener = -1; //Listen to events of every mission
}

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

//Ground objects (except AA Guns) will die after 55 min when counted from their birth

public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
{
base.OnActorCreated(missionNumber, shortName, actor);
//Ground objects (except AA Guns) will die after 55 min when counted from their birth
if (actor is AiGroundActor)
if ((actor as AiGroundActor).Type() != maddox.game.world.AiGroundActorType.AAGun)
Timeout(3300, () =>
{
if (actor != null)
{ (actor as AiGroundActor).Destroy(); }
}
);
}

/****
//Ground objects will die after 55 min when counted from their birth

public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
{
base.OnActorCreated(missionNumber, shortName, actor);

//Ground objects will die after 55 min when counted from their birth
if (actor is AiGroundActor)
Timeout(3300, () =>
{
if (actor != null)
{ (actor as AiGroundActor).Destroy(); }
}
);
}
****/
}
Reply With Quote
Reply


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 03:02 PM.


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