![]() |
|
#1
|
|||
|
|||
|
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! |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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); }
);
}
}
}
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;
}
}
}
|
|
#4
|
|||
|
|||
|
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! |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
Quote:
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. |
|
#7
|
|||
|
|||
|
~S~ Bliss
Have you seen the script being wrote for the bailout/Ai/create situation, everyone shooting down AI which is getting irritating? |
|
#8
|
|||
|
|||
|
Quote:
I'll try to see what I can come up with. Yeah.. It's a good idea. Hopefully, when I get some time, I'll try to incorporate in. |
|
#9
|
||||
|
||||
|
Quote:
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 |
|
#10
|
|||
|
|||
|
Quote:
|
![]() |
|
|