Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   Setting waypoint/take off time (http://forum.fulqrumpublishing.com/showthread.php?t=30274)

keinmann 03-08-2012 11:47 PM

Setting waypoint/take off time
 
Hey guys,

I can't seem to figure out how to get planes to take off at a certain time. I have a huge wave of Luftwaffe planes flying from inland France, and I don't want the RAF to respond until the Germans are just off the coast. But it seems that FMB won't let me designate a time for the planes to take off -- it just forces them to take off at the start of the mission! :(

Any idea how I can accomplish this?

bolox 03-09-2012 12:22 AM

http://forum.1cpublishing.eu/showthread.php?t=28487

this uses a pass thru trigger rather than 'setting a time'.

keinmann 03-09-2012 04:10 AM

Hmm, this is new to me (never been into FMB too much) and looks quite useful.

However, it's a shame you can't just set the time... :(

FG28_Kodiak 03-09-2012 04:42 AM

You can do this via script:

Set your Airgroups on Idle.

Code:

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


public class Mission : AMission
{

    public void SetAirgroupActivAfter(Dictionary<string, double> StartAirgroupAfterTime)
        {
            List<AiAirGroup> allAirgroups = new List<AiAirGroup>();

            if (gamePlay.gpAirGroups(1) != null)
                allAirgroups.AddRange(gamePlay.gpAirGroups(1));
            if (gamePlay.gpAirGroups(2) != null)
                allAirgroups.AddRange(gamePlay.gpAirGroups(2));

            allAirgroups.ForEach(item =>
                {
                   
                    foreach (KeyValuePair<string, double> kvp in StartAirgroupAfterTime)
                    {
                        if (item.Name().Contains(kvp.Key))
                        {
                            Timeout(kvp.Value, () =>
                            {
                                item.Idle = false;
                            });
                        }
                    }
                });
        }

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

        SetAirgroupActivAfter(new Dictionary<string, double>
                            {
                                {"BoB_RAF_F_64Sqn_Early", 120.0}, //2min
                                {"BoB_RAF_F_111Sqn_Early", 180.0}, //3min
                                {"BoB_LW_JG51_III", 900.0} //15min
                            });
    }
}

With SetAirgroupActivAfter you can activate the Airgroup.
You can also use (for example)
SetAirgroupActivAfter(new Dictionary<string, double>
{
{"BoB_RAF_F", 900.0} //15min
});

to set all RAF Fighter units active after (in this case) 15min.

keinmann 03-11-2012 02:37 AM

I have years of professional experience with C#, but I'm a n00b for FMB. I'm not quite sure how to even load/execute a C# module with the IL-2 engine/FMB! :confused:

Anyway... You got me wondering... If I set up some front markers for red and blue, is there a C# event/delegate I can subscribe to when aircraft cross the front? Something like:

void onFrontCrossed(params Plane[] planes) {
// ...blah blah blah ...
}

???

Where can I find documentation on this stuff? Is there any? :confused: If I had some comprehensive documentation I suspect I could get quite good with FMB fast, and be able to develop some interesting missions and content.

P.S. -- I also have VS Pro, and would much prefer using my own IDE. Is there any way to do it properly?

FG28_Kodiak 03-11-2012 03:56 AM

First there is no documentation. If there is a cs file with the same name than the mission the Engine calls the .net csc and execute the file.
To get access to the "CloDo programming interface" add references to the assemblies "antlr.runtime.dll", "core.dll", "gamePages.dll", "gamePlay.dll", "gameWorld.dll", "HostView.dll", "maddox.dll", "part.dll", "sound.dll" and "Strategy.dll" in ..\Steam\SteamApps\common\il-2 sturmovik cliffs of dover\parts\core
and
to the files "partBob.dll" and "Campaign.dll" in ..\Steam\SteamApps\common\il-2 sturmovik cliffs of dover\parts\bob

Then you can examine the classes with the object explorer.
The importent classes for missions are AMission and IGamePlay (GamePlay Object).
There is many try and error expirience, some of the members not working proberly (or not fully implementet at time) or they work in single player and player hosted missions but not on Dedi Server. :rolleyes:

There is no event for crossing Front but you can use
GamePlay.gpFrontExist() // true if there is a front line
GamePlay.gpFrontDistance(int army, double x, double y) // double distance to front line < 0 if army == player.Army() > 0 if oposite
And with the OnTickGame() - Event (one Tick is 1/30sek) you can check by your own if a plane cross the line

keinmann 03-11-2012 06:50 AM

THANK YOU!!!!!!! :shock: A post like that should be stickied!

I had no idea what references where needed, so thanks a LOT!

P.S. - Bist du Deutscher?

FG28_Kodiak 03-11-2012 07:01 AM

Jawohl ;)

keinmann 03-11-2012 07:32 PM

Ahhh, kühl... sehr gut! Ich dachte dass! Ich bin Amerikaner, aber ich kann Deutsch; nicht der best, obwohl gut genug, ich glaube! :)

Dein Englisch ist einwandfrei, aber die sehr kleine linguistische Feinheiten gibt mir das Andeutung. Zum Beispiel, du sagte "one Tick is 1/30sek", statt "1/30sec". :grin:

Smokeynz 03-11-2012 08:10 PM

I spotted TOD (time of day) in the classes whilst searching for other stuff.

I suspect it would be possible to use that to spawn in aircraft or idle to a TOD setpoint.

Keinmann, personally I think it is just easier to spawn in aircraft via a separate mission from timer in a script, where you can choose to use a single time period or repeating spawn in cycles. (or any other trigger event you can load a mission containing items required)

Think of the base core mission as a clean "just the choosen map and battle area" , then the idea is you have a separate missions with just the items required.

Have a look through the sticky links of collections of scripts gathered already.
I'm only learning C# as far as application to CLOD so come unstuck with syntax at times, but if like Kodiak you have experience with C# it helps alot with exploring better methods and getting basic syntax correct.


All times are GMT. The time now is 01:02 AM.

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