![]() |
|
|
|
#1
|
|||
|
|||
|
Quote:
This is what happens in 3-4 hours after starting a mission. https://lh4.googleusercontent.com/_S...5-21_00016.jpg |
|
#2
|
||||
|
||||
|
Somehow game does not see ships as AiGroundActor. Ask naryv about this.
|
|
#3
|
|||
|
|||
|
Looks like the script we are running on Repka and Syndicate is not 100% compatible with multicrew aircraft.
Quote:
Code:
////////////////////////////////////////////////////////////////////////////////////////////////////
// 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);
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 (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); }
);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
Last edited by Ataros; 05-25-2011 at 11:46 AM. |
|
#4
|
||||
|
||||
|
Ataros,
are there problems with Ju88 ar He111? I ask because it might be not a despawn problem, but separate bug. If I recall correctly there was (or still is) a problem with Br.20: engines cout out as player switches pilot positions (there are 2 piliots in Br.20). |
|
#5
|
|||
|
|||
|
I did not try it myself yet. Will be able to test only tomorrow.
People report all bombers as far as I understand. This guy flies red side only i.e. Blenheims http://www.sukhoi.ru/forum/showthrea...=1#post1625736 Last edited by Ataros; 05-25-2011 at 12:42 PM. |
|
#6
|
|||
|
|||
|
Quote:
|
|
#7
|
|||
|
|||
|
This code checks if plane is empty completely I guess. But this script worked only from a client PC used as server and did not work on a dedi server at least before the latest beta patch. That is why it was replaced with currently used script which works on dedi server.
We have to find out how to integrate this if ((i.Place() as AiAircraft) == (actor as AiAircraft)) { PlaneIsEmpty = false; into currently working script shown above in my previous message. Code:
// destroys aircraft abandoned by a player
public void _DespawnEmptyPlane(AiActor actor)
{
if (actor == null)
{ return; }
Player[] Players = GamePlay.gpRemotePlayers();
bool PlaneIsEmpty = true;
foreach (Player i in Players)
{
if ((i.Place() as AiAircraft) == (actor as AiAircraft))
{
PlaneIsEmpty = false;
break;
}
}
if ((PlaneIsEmpty) && (actor as AiAircraft).IsAirborne())
{
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsElevatorDisabled);
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsAileronsDisabled);
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsRudderDisabled);
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure);
//for 2mots
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng1TotalFailure);
//then wait 10min
Timeout(600.0, () =>
{
(actor as AiAircraft).Destroy();
});
}
else if (PlaneIsEmpty)
{
(actor as AiAircraft).Destroy();
}
}
public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceLeave(player, actor, placeIndex);
_DespawnEmptyPlane(actor);
}
// destroys crushlanded aircraft in 10 minutes
public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft)
{
base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);
Timeout(600, () =>
{
aircraft.Destroy();
});
}
}
|
![]() |
|
|