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
  #91  
Old 05-05-2011, 01:35 PM
Macka Macka is offline
Approved Member
 
Join Date: Mar 2011
Location: Australia
Posts: 36
Default

And it reintroduces the stutters online which I kinda missed .....NOT!....lol. Rolled client back to 14305 will try on Matoni's OGN later.
Reply With Quote
  #92  
Old 05-05-2011, 09:38 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by SC/JG Matoni View Post
~S

I would appear Beta 4 breaks all of these kill actor scripts... well it does 4 me
Try this one. I think it worked today on patched Repka. (5 min timeout)
Code:
// v.1.6.17 trig NEW

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

public class Mission : AMission
{
  
    // 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);
		aircraft.hitNamed (part.NamedDamageTypes.Eng0TotalFailure);
		aircraft.hitNamed (part.NamedDamageTypes.Eng1TotalFailure);

        /***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); }
            );
    }


}
Reply With Quote
  #93  
Old 05-06-2011, 07:46 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Sample shows moving frontline and changing spawnpoints from red to blue and vice versa based on trigger (flyby above an airfield).

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.

Code:
using System;
using System.Collections;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{
    internal class MissionMarker
    {
        internal double x;
        internal double y;
        internal int army;
        internal MissionMarker(double x, double y, int army) { this.x = x; this.y = y; this.army = army; }
    }



    private MissionMarker[] MissionMarkers = new MissionMarker[]
    {   new MissionMarker(17100.80,14515.20,2),
        new MissionMarker(20428.80, 8934.40, 2),
        new MissionMarker(12492.80, 17203.20, 1),
        new MissionMarker(11801.60, 21555.20, 1)
    };
        

    internal ISectionFile CreateNewFrontLineMission(int markerNum, int newArmy)
    {
        MissionMarkers[markerNum].army = newArmy;
        foreach (AiBirthPlace bp in GamePlay.gpBirthPlaces())
        {
            if (bp != null)
                bp.destroy();
         
        }
        ISectionFile f = GamePlay.gpCreateSectionFile();
        string sect;
        string key;
        string value;
        sect = "FrontMarker";
        for (int i = 0; i < MissionMarkers.Length; i++)
        {            
            key = "FrontMarker" + i.ToString();
            value = MissionMarkers[i].x.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + MissionMarkers[i].y.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + MissionMarkers[i].army.ToString();
            f.add(sect, key, value);  
        }
        sect = "BirthPlace";
        for (int i = 0; i < MissionMarkers.Length; i++)
        {            
            key = "BirthPlace_" + i.ToString();
            value = " " + MissionMarkers[i].army.ToString() + " " + MissionMarkers[i].x.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + MissionMarkers[i].y.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " 0 10 1 0 . . .";
            f.add(sect, key, value);
        }
        
        return f;
    }

    public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);
        for (int i = 0; i < MissionMarkers.Length; i++)
            for (int j = 1; j < 3; j++)
            {
                string str = "changeArmy" + i.ToString() + "_" + (j).ToString();
                if (str.Equals(shortName))
                {
                    string armyOwner;
                    if (j == 1) { armyOwner = " Red army"; }
                    else { armyOwner = " Blue army"; }
                    GamePlay.gpHUDLogCenter("Airdrome: " + i.ToString() + " turn to " + armyOwner);
                    GamePlay.gpPostMissionLoad(CreateNewFrontLineMission(i, j));
                }
            }
        AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));
        if (action != null)
            action.Do();

    }
}

Last edited by Ataros; 05-06-2011 at 07:51 AM.
Reply With Quote
  #94  
Old 05-06-2011, 09:02 AM
MadTommy MadTommy is offline
Approved Member
 
Join Date: Jan 2011
Posts: 493
Default

... my head hurts trying to understand this..

Does anyone fancy writing a fuckwits guide to all this, err sorry i mean a dummies guide? It would be very much appreciated, i'd buy the 1st round or virtual beers!

I'm keen to create MP missions but trying to gain the level of understanding needed from these forums and google translations is rather daunting. And i suspect waiting for an official manual would be foolish, considering the flight manual produced.

But thanks for all the help provided here, it is appreciated.. just a bit confusing for a new mission builder.
Reply With Quote
  #95  
Old 05-06-2011, 03:27 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by MadTommy View Post
... my head hurts trying to understand this..

Does anyone fancy writing a fuckwits guide to all this, err sorry i mean a dummies guide?
The guide is called C# for Dummies but you can start with the following. I do not know C# but have a lot of fun with this simple script. It is a huge step forward from original IL-2 online.

This is a sample script to create a small 'campaign' containing a main mission and 3 sub-missions.

Copy this script to Notepad and save it as sample.cs into the same folder your mission will be located, e.g.
C:\Users\%user%\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\My_mis1\
Scripts have to be saved with .cs extension and have the same name as the main mission.

Create and edit your main mission in FMB. In this example the main mission name should be sample.mis because the script name is sample.cs.
Make sure you have both sample.mis and sample.cs in the following directory (on the drive you have your Documents folder):
C:\Users\%user%\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\My_mis1\

Create and edit 3 missions you want to be loaded into the main mission with FMB.
Put these 3 missions in the same directory, name them as mission1.mis, mission2.mis and mission3.mis.
That's it.

In case you saved your mission files into other directory than Multi/Dogfight/Dogfight/My_mis1/ , then edit 3 filepaths in this file.
e.g. the line GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/My_mis1/mission1.mis" contains the path to the 1st sub-mission. *

Change message text after GamePlay.gpHUDLogCenter commands to whatever you like (usually mission objectives and their location on the map).
The text in this example is visible to both sides for simplicity.

You may wish to download and use Microsoft Visual Studio 2010 Express to open and edit .cs files. It is free and makes .cs files easy to read and understand.
Download link http://www.microsoft.com/express/Dow...2010-Visual-CS

All text after // marks are comments describing what the script does.
You may play your mission in MP or as a SP mission if you create a passworded server.

I hope to put up some missions using this script to Repka server soon.

Code:
/**** 
 * Brief startup guide to scripting. 
 * This is a sample script to create a small 'campaign' containing a main mission and 3 sub-missions.
 * 
 * Copy this script to Notepad and save it as sample.cs into the same folder your mission will be located, e.g. 
 * C:\Users\%user%\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\My_mis1\
 * Scripts have to be saved with .cs extension and have the same name as the main mission.
 * Create and edit your main mission in FMB. In this example the main mission name should be sample.mis because the script name is sample.cs.
 * Make sure you have both sample.mis and sample.cs in the following directory (on the drive you have your Documents folder):
 * C:\Users\%user%\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\My_mis1\ 
 * Create and edit 3 missions you want to be loaded into the main mission with FMB.
 * Put these 3 missions in the same directory, name them as mission1.mis, mission2.mis and mission3.mis.
 * That's it.
 * 
 * In case you saved your mission files into other directory than Multi/Dogfight/Dogfight/My_mis1/ , than edit 3 filepaths in the script file. 
 * e.g. the line GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/My_mis1/mission1.mis" contains the path to the 1st sub-mission.  * 
 * 
 * Change message text after GamePlay.gpHUDLogCenter commands to whatever you like (usually mission objectives and their location on the map).
 * The text in this example is visible to both sides for simplicity.
 * 
 * You may wish to download and use Microsoft Visual Studio 2010 Express to open and edit .cs files. It is free and makes .cs files easy to read and understand.
 * Download link http://www.microsoft.com/express/Downloads/#2010-Visual-CS
 * 
 * All text after // marks are comments describing what the script does.
 * You may play your mission in MP or as a SP mission if you create a passworded server.
 * Have fun! and S! from 3GIAP
 * 
 * Feel free to delete all the comments above and including this line from this file. ****/

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

public class Mission : AMission
{
 
public override void OnTickGame()
{

// loads the 1st sub-mission in 10 min and repeates it every 60 min.
    if (Time.tickCounter() % 108000 == 18000) // 108000 = 60 min repeat. 18000 = 10 min delay. 
        // pls. note!!! the 1st figure above must be always larger than 2nd!
  {
      GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/My_mis1/mission1.mis");

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

      // prints message on screen in 10 minutes / 600 seconds
      double initTime = 0.0;
      Timeout(initTime += 600, () =>
      {
          GamePlay.gpHUDLogCenter("10 minutes into the 1st mission! Wow! It works!!!");
      });

      // prints message on screen in 5 minutes  / 300 seconds
      Timeout(initTime += 300, () =>
      {
          GamePlay.gpHUDLogCenter("Wholy s.. it works!!!");
      });

   }

// loads the 2nd sub-mission, etc. the same way
       if (Time.tickCounter() % 108000 == 54000) //  108000 = 60 min repeat, 54000 = 30 min delay. 
    {
        GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/My_mis1/mission2.mis");
        GamePlay.gpHUDLogCenter("Mission2.mis loaded!"); 
      double initTime = 0.0;
      Timeout(initTime += 600, () =>
       {
           GamePlay.gpHUDLogCenter("Mission2 10 min message!");
       });
            
      Timeout(initTime += 300, () =>
         {
             GamePlay.gpHUDLogCenter("Mission2 15 min message!");
         });
    }

// loads the 3rd sub-mission
       if (Time.tickCounter() % 108000 == 90000) // 60 min repeat, 50 min delay 
       {
           GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/My_mis1/mission3.mis");
           GamePlay.gpHUDLogCenter("Mission3.mis loaded!");

           double initTime = 0.0;
           Timeout(initTime += 600, () =>
           {
               GamePlay.gpHUDLogCenter("Mission3 10 min message!");
           });
           Timeout(initTime += 300, () =>
           {
               GamePlay.gpHUDLogCenter("Now it really works! You are a genius! Have fun!");
           });
       }
}


}
upd. Corrected an error, replaced 1800 ticks with 18000 for 10 minutes.

Last edited by Ataros; 10-14-2011 at 08:03 AM.
Reply With Quote
  #96  
Old 05-06-2011, 04:55 PM
MadTommy MadTommy is offline
Approved Member
 
Join Date: Jan 2011
Posts: 493
Default

Ataros -

Thanks for all the info here.. i'll try and get my head around this over the weekend, your help is very much appreciated.
Reply With Quote
  #97  
Old 05-11-2011, 07:36 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

The above script runs on Repka DS #1 server ATM loading 5 smaller missions into main mission with various time-cycles. Check it out.
Reply With Quote
  #98  
Old 05-11-2011, 08:58 AM
ATAG_Bliss ATAG_Bliss is offline
Approved Member
 
Join Date: Mar 2010
Posts: 1,156
Default

Ataros,

Thanks for all the info. We'll see if the latest kill actor script works with beta 1. We found the latest beta to be far to unstable for the server and have reverted back.
__________________

ATAG Forums + Stats
Reply With Quote
  #99  
Old 05-11-2011, 09:13 AM
MadTommy MadTommy is offline
Approved Member
 
Join Date: Jan 2011
Posts: 493
Default

What is the best script to remove empty & crash landed planes.. there seem to be many versions knocking about.

I've heard there are issues with these scripts & the latest patch.. some enlightenment would be much appreciated.

Looking at bob & bof 1.6 neither seem to have these scripts added..
Reply With Quote
  #100  
Old 05-11-2011, 09:21 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by MadTommy View Post
What is the best script to remove empty & crash landed planes.. there seem to be many versions knocking about.

I've heard there are issues with these scripts & the latest patch.. some enlightenment would be much appreciated.

Looking at bob & bof 1.6 neither seem to have these scripts added..
Did you try this one? http://forum.1cpublishing.eu/showpos...0&postcount=92

Runs on Repka server. I think it works (not 100% sure though of cause ) .
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 12:27 PM.


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