![]() |
|
|||||||
| CoD Multiplayer Everything about multiplayer in IL-2 CoD |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Quote:
|
|
#2
|
|||
|
|||
|
Quote:
|
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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); |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
OK. I see the problem. I fixed your code and re-uploaded it. Tomorrow, I will edit the first post to be more clear.
|
|
#7
|
|||
|
|||
|
thnks
|
![]() |
|
|