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
  #18  
Old 09-16-2011, 09:25 AM
SNAFU SNAFU is offline
Approved Member
 
Join Date: Feb 2011
Posts: 324
Default

Quote:
Originally Posted by Das Attorney View Post
Thanks

I managed to modify the script to only work on player planes by adding a condition to ignore AI planes - using !isAiControlledPlane(aircraft)

It's working for player planes only now quite nicely.
Would you be so kind and check the code below, in which I tried to modify the script according to your hint (at the end of the original script) and tell me if this is the right direction?


Code:
...
..
.
    public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);

	if (!isAiControlledPlane(aircraft))	// SNAFU
 	{   	//SNAFU

        Timeout(5, () =>
        {
            aircraft.Destroy();
        });
    	}

	return; 	// SNAFU
    }	// SNAFU

  public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftLanded(missionNumber, shortName, aircraft);
 
	if (!isAiControlledPlane(aircraft))	// SNAFU
 	{   	//SNAFU
    
        AiAirport NearestAirport = FindNearestAirport(aircraft);          
        if (NearestAirport != null)
        {
            PlanesQueue CurPlane = new PlanesQueue(aircraft, NearestAirport, 0);
            int ArmyPos = 0;
            CurPlane.health = (float)aircraft.getParameter(part.ParameterTypes.M_Health, -1);  
            if (GamePlay.gpFrontExist())
            {
                ArmyPos = GamePlay.gpFrontArmy(NearestAirport.Pos().x, NearestAirport.Pos().y);
            }
            else { ArmyPos = aircraft.Army(); };
            if (CurPlane.health < 1f)  
            {
                CurPlane.State |= ServiceType.EMERGENCY;
                CurPlane.State |= ServiceType.FIRE;
            }
            else if (aircraft.Army() == ArmyPos)
            {
                CurPlane.State |= ServiceType.FUEL;
                CurPlane.State |= ServiceType.AMMO;
                if (aircraft.Type() == AircraftType.Bomber) CurPlane.State |= ServiceType.BOMBS;
            };
            if (!(aircraft.Army() == ArmyPos)) CurPlane.State |= ServiceType.PRISONERCAPTURE;
            if (!CurPlanesQueue.Contains(CurPlane))
            {
                CurPlanesQueue.Add(CurPlane);
                CheckEmrgCarOnAirport(CurPlanesQueue.Count - 1);                
            }
            else
            {
                for (int i = 0; i < CurPlanesQueue.Count; i++)
                    if (CurPlanesQueue[i] == CurPlane)
                    { 
                        CheckEmrgCarOnAirport(i);                        
                        break;
                    }
            }
            CurPlane = null;
        };
    }
	return; 	// SNAFU
    	}	// SNAFU
}
__________________
http://cornedebrouwer.nl/cf48e
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 05:22 PM.


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