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 09-09-2011, 09:02 PM
ATAG_Bliss ATAG_Bliss is offline
Approved Member
 
Join Date: Mar 2010
Posts: 1,156
Default Script assistance needed

I'm trying to find a way to limit human controlled plane types (spit, hurri, 109 etc.) to a certain amount. Say I only want to have 4 spitIIa's or 4 110C7's, would anyone know how to do this?

I know with FBDj of old, it was simple. Say a map that had a 262 in it, you could limit them to 2 (for example) and only 2 could ever be spawned in game at once (aka - only 2 possible at all times throughout the mission). Any more than 2 and the selection would simply be greyed out or not selectable.

Any chance someone has found a way to do this with IL2COD yet?

Would be much appreciated.

Thanks!
__________________

ATAG Forums + Stats
Reply With Quote
  #2  
Old 09-10-2011, 08:28 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

This mission has a script limiting number of aircraft by type. http://forum.1cpublishing.eu/showthr...eration+dynamo
If you make it working please share the final script to add to community knowledge base. I asked several times but never have seen scripts Syndicate or ATAG is running C'mon you are nice guys Let's make the CloD world better by sharing knowledge.
Reply With Quote
  #3  
Old 09-10-2011, 02:28 PM
ATAG_Bliss ATAG_Bliss is offline
Approved Member
 
Join Date: Mar 2010
Posts: 1,156
Default

Hi Ataros - Thanks

I'll take a look at that and see if I can't get something to work. As far as the scripts are concerned, there's nothing special lol. The knowledge all came from you guys. I just know how to copy/paste to fine tune!

But I use a combination of .cmd files (using f to load and timeout command to recycle the mission) and C# to be able to make the scripts work 24/7.

Here's the scripts for the main and submission:

Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
 
public class Mission : AMission
{
    public override void OnBattleStarted()
    {
        base.OnBattleStarted();
 
        //listen to events from all missions.
        MissionNumberListener = -1;
    }
 
    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); }
            );
    }
 
    private bool isAiControlledPlane(AiAircraft aircraft)
    {
        if (aircraft == null)
            return false;
 
        //check if a player is in any of the "places"
        for (int i = 0; i < aircraft.Places(); i++)
            if (aircraft.Player(i) != null)
                return false;
 
        return true;
    }
 
    private void destroyPlane(AiAircraft aircraft)
    {
        if (aircraft != null)
            aircraft.Destroy();
    }
 
    private void damageAiControlledPlane(AiActor actorMain)
    {
        foreach (AiActor actor in actorMain.Group().GetItems())
        {
            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(300, () =>
            { destroyPlane(aircraft); }
                );
        }

    }
	
}
submissions

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

public class Mission : maddox.game.AMission
{
    
    public override void OnTrigger(int missionNumber, string shortName, bool active) 
    {
       base.OnTrigger(missionNumber, shortName, active); 

          if ("SpawnAirgroup1".Equals(shortName) && active) 
          { 
                AiAction action = GamePlay.gpGetAction("Airgroup1");
                if (action != null)
                {
                     action.Do();
                }
                GamePlay.gpHUDLogCenter("BR.20M's enroute to Hawkinge");      
                GamePlay.gpGetTrigger(shortName).Enable = false;            
          }
		   if ("SpawnAirgroup5".Equals(shortName) && active) 
          { 
                AiAction action = GamePlay.gpGetAction("Airgroup5");
                if (action != null)
                {
                     action.Do();
                }
                GamePlay.gpHUDLogCenter("Blenheims enroute to Coquelles");      
                GamePlay.gpGetTrigger(shortName).Enable = false;            
          }
    
	

          if ("SpawnAirgroup2".Equals(shortName) && active) 
          { 
                AiAction action = GamePlay.gpGetAction("Airgroup2");
                if (action != null)
                {
                     action.Do();
                }
                GamePlay.gpHUDLogCenter("Stukas enroute to Hawkinge");      
                GamePlay.gpGetTrigger(shortName).Enable = false;            
          }
			   if ("SpawnAirgroup6".Equals(shortName) && active) 
          { 
                AiAction action = GamePlay.gpGetAction("Airgroup6");
                if (action != null)
                {
                     action.Do();
                }
                GamePlay.gpHUDLogCenter("Wellingtons enroute to Caffiers");      
                GamePlay.gpGetTrigger(shortName).Enable = false;            
          }
       
		 if ("SpawnAirgroup3".Equals(shortName) && active) 
          { 
                AiAction action = GamePlay.gpGetAction("Airgroup3");
                if (action != null)
                {
                     action.Do();
                }
                GamePlay.gpHUDLogCenter("He 111s enroute to Lympne");      
                GamePlay.gpGetTrigger(shortName).Enable = false;            
          }
		   if ("SpawnAirgroup7".Equals(shortName) && active) 
          { 
                AiAction action = GamePlay.gpGetAction("Airgroup7");
                if (action != null)
                {
                     action.Do();
                }
                GamePlay.gpHUDLogCenter("Wellingtons enroute to Pihen Airfield");      
                GamePlay.gpGetTrigger(shortName).Enable = false;            
          }
		   if ("SpawnAirgroup4".Equals(shortName) && active) 
          { 
                AiAction action = GamePlay.gpGetAction("Airgroup4");
                if (action != null)
                {
                     action.Do();
                }
                GamePlay.gpHUDLogCenter("Ju 88's enroute to Hawkinge");      
                GamePlay.gpGetTrigger(shortName).Enable = false;            
          }
		   if ("SpawnAirgroup8".Equals(shortName) && active) 
          { 
                AiAction action = GamePlay.gpGetAction("Airgroup8");
                if (action != null)
                {
                     action.Do();
                }
                GamePlay.gpHUDLogCenter("Wellingtons enroute to St. Inglevert");      
                GamePlay.gpGetTrigger(shortName).Enable = false;            
          }
    }
}
As you can see there's nothing special
__________________

ATAG Forums + Stats
Reply With Quote
  #4  
Old 09-10-2011, 06:49 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Thank you very much for sharing! I hope many new servers which want to be as popular as ATAG can benefit from this to the benefit of CloD community in general.

S!
Reply With Quote
  #5  
Old 09-10-2011, 08:43 PM
ATAG_Bliss ATAG_Bliss is offline
Approved Member
 
Join Date: Mar 2010
Posts: 1,156
Default

No problem Ataros!

Question (maybe for another topic) but how do you have 3 servers all running off of the same machine? We are using about 10% of the power of our machine with only running one server, and we'd like to have 3 different servers up as well.

Thanks,
Bliss
__________________

ATAG Forums + Stats
Reply With Quote
  #6  
Old 09-11-2011, 08:19 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by ATAG_Bliss View Post
No problem Ataros!

Question (maybe for another topic) but how do you have 3 servers all running off of the same machine? We are using about 10% of the power of our machine with only running one server, and we'd like to have 3 different servers up as well.

Thanks,
Bliss
BigRepa, server owner, runs 3 virtual PCs on one hardware using VMWare i believe. There was a screenshot of VMWare settings in Repka thread. Now he switched to desktop OS like Win7 or Vista for compatibility with some missions and the limitation is each OS can use only 2 cores of his 6-core AMD. With server OS there is no such a limitation probably.
Virtual machines are needed because you can not run 3 Steam accounts in one OS at the same time.

I think you can easily run 4 or 6 servers on your hardware. Also have a look at server automation link in my sig to make running several servers easier.
Reply With Quote
  #7  
Old 09-11-2011, 11:11 AM
Ze-Jamz Ze-Jamz is offline
Approved Member
 
Join Date: Jan 2011
Location: On your six!!
Posts: 2,302
Default

~S~ Bliss

Have you seen the script being wrote for the bailout/Ai/create situation, everyone shooting down AI which is getting irritating?
Reply With Quote
  #8  
Old 09-13-2011, 09:36 PM
ATAG_Bliss ATAG_Bliss is offline
Approved Member
 
Join Date: Mar 2010
Posts: 1,156
Default

Quote:
Originally Posted by Ataros View Post
BigRepa, server owner, runs 3 virtual PCs on one hardware using VMWare i believe. There was a screenshot of VMWare settings in Repka thread. Now he switched to desktop OS like Win7 or Vista for compatibility with some missions and the limitation is each OS can use only 2 cores of his 6-core AMD. With server OS there is no such a limitation probably.
Virtual machines are needed because you can not run 3 Steam accounts in one OS at the same time.

I think you can easily run 4 or 6 servers on your hardware. Also have a look at server automation link in my sig to make running several servers easier.
Thanks

I'll try to see what I can come up with.

Quote:
Originally Posted by Ze-Jamz View Post
~S~ Bliss

Have you seen the script being wrote for the bailout/Ai/create situation, everyone shooting down AI which is getting irritating?
Yeah.. It's a good idea. Hopefully, when I get some time, I'll try to incorporate in.
__________________

ATAG Forums + Stats
Reply With Quote
  #9  
Old 09-21-2011, 08:05 AM
klem's Avatar
klem klem is offline
Approved Member
 
Join Date: Nov 2007
Posts: 1,653
Default

Quote:
Originally Posted by Ataros View Post
This mission has a script limiting number of aircraft by type. http://forum.1cpublishing.eu/showthr...eration+dynamo
If you make it working please share the final script to add to community knowledge base. I asked several times but never have seen scripts Syndicate or ATAG is running C'mon you are nice guys Let's make the CloD world better by sharing knowledge.
Thats what I said. We could do with our own Library. Might help those of us struggling to build missions:-

http://forum.1cpublishing.eu/showthread.php?t=26292
__________________
klem
56 Squadron RAF "Firebirds"
http://firebirds.2ndtaf.org.uk/



ASUS Sabertooth X58 /i7 950 @ 4GHz / 6Gb DDR3 1600 CAS8 / EVGA GTX570 GPU 1.28Gb superclocked / Crucial 128Gb SSD SATA III 6Gb/s, 355Mb-215Mb Read-Write / 850W PSU
Windows 7 64 bit Home Premium / Samsung 22" 226BW @ 1680 x 1050 / TrackIR4 with TrackIR5 software / Saitek X52 Pro & Rudders
Reply With Quote
  #10  
Old 09-21-2011, 10:41 PM
Gamekeeper Gamekeeper is offline
Approved Member
 
Join Date: Oct 2007
Posts: 190
Default

Quote:
Originally Posted by klem View Post
Thats what I said. We could do with our own Library. Might help those of us struggling to build missions:-

http://forum.1cpublishing.eu/showthread.php?t=26292
My offer to assist and host as mentioned in the above thread is still open. Unfortunately there seems to be little interest so far.
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 02:26 AM.


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