![]() |
|
|||||||
| CoD Multiplayer Everything about multiplayer in IL-2 CoD |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Hi enlightened,
I pretty much use that script for despawning on my missions over at Syndicate including listen to mission events. I just adjusted the time for plane removal downwards (to 1 minute) It appears to work fine, we just have the problem with multicrew aircraft turning the engine temps to zero when switching seats. I have tried the server without the script (since the last patch included aircraft removal on landing) but the problem is that if a player leaves a plane before takeoff AI takes over, takes off and then loiters around the field for hours! Anyhow, hopefully the next patch will address the crew change issue. |
|
#2
|
|||
|
|||
|
I added code to the script to deal with aircraft with more than two engines. Courtesy of ZaltysZ.
Quote:
|
|
#3
|
|||
|
|||
|
Quote:
Code:
//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;
Do you know when RemotePlayer has to be used instead of Player? |
|
#4
|
|||
|
|||
|
Quote:
gpRemotePlayers() would be used to get all of the players connected to the server. From there, you could get the aircraft that they are in. aircraft.Player() would be used when you already have an aircraft and want to get the player (if any) that occupies that aircraft. It's a subtle but very important difference. |
|
#5
|
|||
|
|||
|
Quote:
|
|
#6
|
|||
|
|||
|
Quote:
|
|
#7
|
|||
|
|||
|
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.ControlsEl evatorDisabled); aircraft.hitNamed(part.NamedDamageTypes.ControlsAi leronsDisabled); aircraft.hitNamed(part.NamedDamageTypes.ControlsRu dderDisabled); aircraft.hitNamed(part.NamedDamageTypes.FuelPumpFa ilure); int iNumOfEngines = (aircraft.Group() as AiAirGroup).aircraftEnginesNum(); for (int i = 0; i < iNumOfEngines; i++) { aircraft.hitNamed((part.NamedDamageTypes)Enum.Pars e(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure")); } Timeout(300, () => { destroyPlane(aircraft); } ); } } all is good but ...... When a player abandons a plane, script will disable controls and engines and remove the plane after 300 seconds. this not working AI continue to fly with no restriction pls some help with this part only THNKS |
|
#8
|
|||
|
|||
|
Hi pirke, there are spaces in these lines that shouldn't be there.
Code:
aircraft.hitNamed(part.NamedDamageTypes.ControlsEl evatorDisabled); aircraft.hitNamed(part.NamedDamageTypes.ControlsAi leronsDisabled); aircraft.hitNamed(part.NamedDamageTypes.ControlsRu dderDisabled); aircraft.hitNamed(part.NamedDamageTypes.FuelPumpFa ilure); |
|
#9
|
|||
|
|||
|
here look how i do it and you have mission i made for 1vs1 duel.
when aircraft land or crash land script do right. but when in air when a player abandons a plane script didnt work right look and repair scrip to make it right PLS |
![]() |
| Thread Tools | |
| Display Modes | |
|
|