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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 04-27-2011, 02:11 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Disable fuel pump doesn't help, the engines wouldn't stop. Fuel pump is only nessesary at altitudes above 2500m.

You are right IsAirborne() can be very usefull in this script.

Corrected Version

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

public class  Mission : AMission
{
	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);
    }
}

Last edited by FG28_Kodiak; 04-27-2011 at 02:37 PM.
Reply With Quote
 


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 10:48 PM.


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