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

IL-2 Sturmovik: Cliffs of Dover Latest instalment in the acclaimed IL-2 Sturmovik series from award-winning developer Maddox Games.

View Poll Results: Battle of France as add on?
Yes, will buy this. 55 58.51%
OK, if for free. 21 22.34%
No, looking forward to Eastern front. 18 19.15%
Voters: 94. You may not vote on this poll

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 08-24-2012, 11:00 PM
Codex Codex is offline
Approved Member
 
Join Date: Nov 2007
Location: Hoppers Crossing, Vic, Australia
Posts: 624
Default

Quote:
Originally Posted by 5./JG27.Farber View Post

Code:
 Despawn Script
  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);}
            );
    }
Where did you get that code snipet from Farber?
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 08:50 PM.


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