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
  #101  
Old 05-12-2011, 08:23 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Great thread on searchlights and adding AA to trains and trucks

http://forum.1cpublishing.eu/showthr...t=22740&page=2
Reply With Quote
  #102  
Old 05-13-2011, 11:58 AM
335th_GRAthos 335th_GRAthos is offline
Approved Member
 
Join Date: Oct 2007
Posts: 1,240
Default

Quote:
Originally Posted by Ataros View Post
Great thread on searchlights and adding AA to trains and trucks

http://forum.1cpublishing.eu/showthr...t=22740&page=2


WOW!

I start getting depressed that flying at 400kmh, jinking like mad, the last thing I will want to do is looking a the detail of the AAA shooting at me....

It looks as if the mission builders will have as much fun as the pilots with this sim...

Great job, we will go throgh hell finding out about the details but, great job!


Nice week end to all !
Reply With Quote
  #103  
Old 05-13-2011, 04:46 PM
Groundhog Groundhog is offline
Approved Member
 
Join Date: Apr 2011
Posts: 24
Default

Ataros

thanks for all the scripting info.
I am trying your tmp script with three sub missions.
It gets as far as loading the first sub mission and then my plane explodes.
The text message is shown in cockpit then boom!
Please help.

Disregard..pilot error
GH

Last edited by Groundhog; 05-13-2011 at 05:08 PM. Reason: problem solved
Reply With Quote
  #104  
Old 05-14-2011, 09:16 PM
TheEnlightenedFlorist TheEnlightenedFlorist is offline
Approved Member
 
Join Date: May 2011
Location: SLC, Utah, USA
Posts: 143
Default

Thanks for the thread Ataros. Very helpful.

Is there a reason you guys are using "ticks" to measure time. C# has a few different ways of keeping track of time. Here's an example using the Stopwatch class. Don't get me wrong, modulus is great but this stopwatch is probably more accurate and it's a heck of a lot more readable.

Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
using System.Diagnostics;   //contains Stopwatch class

public class Mission : AMission
{
    int timesRun = 0;   //count how many times sub-mission has been run

    Stopwatch timer = new Stopwatch();   //timer. Counts... time...

    public override void OnTickGame()
    {
        
        //if sub-mission has never been run, run it
        if (timesRun == 0) 
        {
            //start timer
            timer.Start();

            GamePlay.gpPostMissionLoad("missions/Multi/MyMissions/mission1.mis");
            timesRun++;

            // prints message on screen after mission load
            GamePlay.gpHUDLogCenter("Hello, world! Mission1.mis loaded!");
        }

        //if five or more minutes have elapsed since the timer was started, run sub-mission
        if (timer.Elapsed.Minutes >= 5)
        {
            GamePlay.gpPostMissionLoad("missions/Multi/MyMissions/mission1.mis");
            timesRun++;

            GamePlay.gpHUDLogCenter("Hello, world! Mission1.mis loaded!");

            //reset timer to zero and restart it
            timer.Restart();
        }
    }
}
Reply With Quote
  #105  
Old 05-14-2011, 09:58 PM
ZaltysZ's Avatar
ZaltysZ ZaltysZ is offline
Approved Member
 
Join Date: Sep 2008
Location: Lithuania
Posts: 426
Default

Quote:
Originally Posted by TheEnlightenedFlorist View Post
Don't get me wrong, modulus is great but this stopwatch is probably more accurate and it's a heck of a lot more readable.
The problem with external timing is that you will get time according to your system and not to game. Simulation can slow down because of lag, and external timer won't take that into account, i.e. briefing can say that bombers start at 9:00, however you may see that start greatly off its planned time (according to game clock), if you use external timer.

If you want to get rid of counting ticks, you can use this:
Code:
	//Runs once, when mission is loaded
	public override void Init(maddox.game.ABattle battle, int missionNumber)
	{
		base.Init(battle,missionNumber);
		//Planned missions
		MissionLoader(30,10,"missions/Multi/Dogfight/bombers1.mis");  // 10s from main mission start and repeatedly every 30s
		MissionLoader(100,60,"missions/Multi/Dogfight/bombers2.mis"); // 60s from main mission start and repeatedly every 100s
	}
	
	public void MissionLoader(int period, int offset, string mission)
	{
		if (offset > 0)
			Timeout(offset, () => {MissionLoader(period,0,mission);});
		else
			{
				GamePlay.gpPostMissionLoad(mission);	
				Timeout(period, () => {MissionLoader(period,0,mission);});		
			}
	}

Last edited by ZaltysZ; 05-15-2011 at 07:09 AM.
Reply With Quote
  #106  
Old 05-15-2011, 11:19 PM
TheEnlightenedFlorist TheEnlightenedFlorist is offline
Approved Member
 
Join Date: May 2011
Location: SLC, Utah, USA
Posts: 143
Default

Oh, I'm sorry. I thought that you guys wanted to base the intervals that missions run on on real time not on game time.
Reply With Quote
  #107  
Old 05-16-2011, 07:09 AM
TheEnlightenedFlorist TheEnlightenedFlorist is offline
Approved Member
 
Join Date: May 2011
Location: SLC, Utah, USA
Posts: 143
Default

Okay. I think I've got a handle on how to create and manipulate "MissionMarkers" aka Front Markers in a script. I've attached a simple, commented example. Shoot down the bomber in front of you and the southwest airfield's front marker changes to blue.

Quote:
Originally Posted by Ataros View Post
Can someone program a small 3 airfields battle based on it? Say a middle airfield becomes red or blue based on which tanks remain alive after taking the airfield. Then spawn new groups of tanks in say 20 minutes for a new round.
I'm confident that if you gave me a mission with an appropriate trigger, I could move and change front markers, but I don't have much experience with the FMB. I've only created single player missions thus far. I don't know how to create an airfield where multiple players can choose an aircraft and spawn at, and I certainly don't know how to change who can spawn at an airfield in a script. Does the code you posted do this? I see mention of "BirthPlaces" in the script, but I don't see any "BirthPlaces" in the FMB.

Do you have a link to a tutorial on how to create multiplayer missions?
Attached Files
File Type: zip triggerTest.zip (1.9 KB, 17 views)
Reply With Quote
  #108  
Old 05-16-2011, 11:42 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by TheEnlightenedFlorist View Post
Does the code you posted do this? I see mention of "BirthPlaces" in the script, but I don't see any "BirthPlaces" in the FMB.

Do you have a link to a tutorial on how to create multiplayer missions?
MP missions are different from SP only by this FMB object called "birthplace" (at least in Russian version) or spawnpoint in English I guess. You find it in Object Browser the same way as other objects like an airfield or a tank. In its property window you can select side it belongs to and list of aircraft available for players. In a mission consisting of many submissions you place birthplaces in the 1st 'main' mission. See my mission as example attached.

When new submission is loaded it can contain a new moved frontline and a new birthplace (e.g. red one) in the location where the blue one used to be. The problem is the old birthplace is not removed by loading a new submission and blue aircraft still can be created in the newly captured red airfield. That is why you need to destroy an old blue birthplace with a script I guess:
Code:
foreach (AiBirthPlace bp in GamePlay.gpBirthPlaces())
        {
            if (bp != null)
                bp.destroy();
         
        }
E.g. in my Repka mission we have both red and blue airfields in D3. The main mission loads 3 (will be 4 soon) relatively big submissions in itself and 2 small ones.

Ideally I would like to move the frontline and change side of these 2 birthplaces based on results of a recent submission. Say if reds loose more aircrafts or tanks (or more then say 70%) in recent mission reds loose an airfield in D3. If they win next mission they take it back, etc. and repeat it forever.

In the future I believe this script can be used to move frontline across the whole map to create an ongoing war.

Please find a recent version of my mission attached.
Attached Files
File Type: zip BoF1_1_7_04a.zip (18.6 KB, 11 views)

Last edited by Ataros; 05-16-2011 at 11:50 AM.
Reply With Quote
  #109  
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
  #110  
Old 05-16-2011, 11:06 PM
TheEnlightenedFlorist TheEnlightenedFlorist is offline
Approved Member
 
Join Date: May 2011
Location: SLC, Utah, USA
Posts: 143
Default

Thanks for the help Ataros, I'll start experimenting with that right away.

As for your code, what exactly isn't working? I can tell you right now that case 3 will never run because the Next(int, int) method returns an integer greater than or equal to the smaller number, but only less than the larger number. In other words, it will never return three, just one or two. It should look like this:

switch (RandomIncident.Next(1, 4))

See here: http://msdn.microsoft.com/en-us/library/2dx6wyd4.aspx
Reply With Quote
Reply

Thread Tools
Display Modes

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:27 AM.


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