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 > CoD Multiplayer

CoD Multiplayer Everything about multiplayer in IL-2 CoD

Reply
 
Thread Tools Display Modes
  #1  
Old 05-11-2011, 10:34 AM
MadTommy MadTommy is offline
Approved Member
 
Join Date: Jan 2011
Posts: 493
Default

Thanks a lot mate!! The included script really helps.. i believe i understand the key components now.. time to get mission building.

Your help has been invaluable.
Reply With Quote
  #2  
Old 05-12-2011, 08:30 PM
Tigertooo Tigertooo is offline
Approved Member
 
Join Date: Feb 2009
Posts: 140
Default

from a rookie in scripting and Visual C or whatever:to all FMB ers and to mcler002 in particular (his BoB mission worked for me):is there a way to post a simple (if possible) tutorial on how to make a proper COOP (only one mission) with humans and AI's. Think the community would appreciate (well i would)
Thanks in advance
Reply With Quote
  #3  
Old 05-14-2011, 02:40 PM
Groundhog Groundhog is offline
Approved Member
 
Join Date: Apr 2011
Posts: 24
Default

With lots of help from the scripters on this forum I have made my first scripted mission.

It uses a trigger at startup to load one of 9 submissions.
It also uses a timer to load sub missions later in the mission.

Works fine for me.

Thanks again for all the scripting examples.

GH
Attached Files
File Type: zip GHSCRIPTED.zip (9.7 KB, 25 views)
Reply With Quote
  #4  
Old 05-15-2011, 02:58 PM
Groundhog Groundhog is offline
Approved Member
 
Join Date: Apr 2011
Posts: 24
Default

Updated the mission to 2 player CooP/Dogfight.

Place folder in Multi/Dogfight

Select main file to start.

Fly as Blue [2 Emils at Caffiers]

Now loads a random sub mission at startup and a random sub mission roughly evey 5 mins. 9 sub missions in pool.


GH
Attached Files
File Type: zip GHSCRIPTED.zip (9.8 KB, 34 views)
Reply With Quote
  #5  
Old 05-15-2011, 06:27 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by Groundhog View Post
Now loads a random sub mission at startup and a random sub mission roughly evey 5 mins. 9 sub missions in pool.

GH
I love this idea of random submission selection! Will try to steal it from you for my next mission )

Thanks for sharing!
Reply With Quote
  #6  
Old 05-15-2011, 06:51 PM
Groundhog Groundhog is offline
Approved Member
 
Join Date: Apr 2011
Posts: 24
Default

Glad to help!

GH
Reply With Quote
  #7  
Old 05-16-2011, 06:42 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Current version of script from Repka server. Works like magic )
Feel free to use.

Code:
// v.1_17_04. script by oreva, zaltys, small_bee

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() % 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");
    }

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

    if (Time.tickCounter() % 162000 == 9000) // 162000=90 min repeat. 9000=5 min delay. 
  {
      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!");
      });

   }

     if (Time.tickCounter() % 162000 == 63000) //  ; 162000=90 min repeat, 63000 - 35 min delay. 
    {
      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! Friendly ships are under attack at C4!");
         });
    }

     if (Time.tickCounter() % 162000 == 117000) // 162000 == 117000 = 90 min repeat, 65 min delay 
       {
           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 E3!");
           });
           Timeout(initTime += 300, () =>
           {
               GamePlay.gpHUDLogCenter("Attention! All airgroups please proceed to D2!");
           });
       }
}
////////////////////////////////////////////////////////////////////////////////////////////////////

// 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.Parse(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
  #8  
Old 05-17-2011, 01:40 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by Groundhog View Post
Glad to help!

GH
I can not get the randomization part to work as I wrote here
http://forum.1cpublishing.eu/showpos...&postcount=109
and here
http://forum.1cpublishing.eu/showpos...&postcount=111

Could you have a look please.

UPD. fixed.

Why do you need the first part in your script with a trigger?
Did you check if it works without the first part? May it be the case that the 1st part is working but the 2nd does not as I included only the 2nd part in my script?

Last edited by Ataros; 05-20-2011 at 01:29 PM.
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 08:54 AM.


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