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

Reply
 
Thread Tools Display Modes
  #31  
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
  #32  
Old 09-16-2011, 07:46 PM
Das Attorney Das Attorney is offline
Approved Member
 
Join Date: May 2011
Posts: 142
Default

Yes that's looking good

I haven't tested your one but it should work. I left in the condition to check for an airfield and added the condition to check for player planes:

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

        AiAirport NearestAirport = FindNearestAirport(aircraft);
        //if (NearestAirport != null)

        if ((NearestAirport != null) && (!isAiControlledPlane(aircraft)))
        {
            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;
        };

    }
There's probably a set of unnecessary brackets in there, but it works ok. I haven't tested on a dedicated server, just a hosted one.

If you've got any hints for setting up a repair script, please share I can't find the scripting commands in the beta code, so any pointers would be welcome!

I'm hoping that we can get a reference page for scripting commands on a wiki, much like this one:

http://community.bistudio.com/wiki/C...Commands_ArmA2

That would be really useful.
Reply With Quote
  #33  
Old 09-17-2011, 11:06 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by hc_wolf View Post
Oh and Ataros this is latest update with install instructions back in the mix.
I know you don't like the vehicles spawning straight away. But as the game goes one side does begin to win over the other and the randomness is good.

feel free to offer a tick time code to put in for armour spawn after destroyed or on new load mission for armour.
Thank you very much!
Regarding spawn delay I have a concern: what happens when a marker is captured and then a delayed spawn of a defending tank group occurs? Probably the marker color changes again and it is recaptured by the defending side?
Reply With Quote
  #34  
Old 09-22-2011, 12:21 PM
Gerbil Maximus Gerbil Maximus is offline
Approved Member
 
Join Date: Sep 2011
Posts: 100
Default

Hey all I'm new to Cliffs FMB but long time lurker here and decided to register as this script has me stumped.

So I have made my MP Dogfight Mission, its ready and working. So can someone give me a quite instruction on how to put this ambulance script into my game (which ever script is best). Sorry if its real simple by the way but i cant understand how to.

Thank you

Gerbil M
Reply With Quote
  #35  
Old 09-23-2011, 08:50 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

1. Copy and paste the script to notepad and save as a .cs file (not .cs.txt !!!) The file must have the same name as the mission .mis file.

2. Put the .cs file in the same directory as .mis file.

3. Run the mission.
Reply With Quote
  #36  
Old 09-24-2011, 01:38 PM
Gerbil Maximus Gerbil Maximus is offline
Approved Member
 
Join Date: Sep 2011
Posts: 100
Default

Ah rgr i see thank you Ataros will test soon so this should work for every airfield in my MP map?

Last edited by Gerbil Maximus; 09-24-2011 at 01:42 PM.
Reply With Quote
  #37  
Old 09-25-2011, 12:26 PM
Mington Mington is offline
Approved Member
 
Join Date: Apr 2008
Posts: 29
Default

Gerbil you can also add the script to your mission by- after the copy operation Ataros speaks of above, if your FMB is running and you are looking at your mission, you can go to the Script tab and paste the text in there to create the script. This can be easier than finding the mission on your computer

(I tell you this to point out that CoD is Windows-friendly, standard Windows operations like Ctrl + v work)

Ming
Reply With Quote
  #38  
Old 09-27-2011, 10:09 AM
Gerbil Maximus Gerbil Maximus is offline
Approved Member
 
Join Date: Sep 2011
Posts: 100
Default

Rgr Thank you
Reply With Quote
  #39  
Old 01-17-2012, 07:22 PM
AKA_Scorp AKA_Scorp is offline
Approved Member
 
Join Date: Jan 2011
Posts: 31
Default

Quote:
One work-around for this I had a play with was to fake it by taking the existing player/position and then destroying/recreating the same type of aircraft, i.e. you get refueled and re-armed, plus could even put a delay on that too. I know it's not realistic, but a 5 minute re-arm/refuel custom script does appeal.
Probably seems like a dumb question but what is the command to spawn an aircraft as described above.

Thanks
Reply With Quote
  #40  
Old 01-18-2012, 08:40 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by AKA_Scorp View Post
Probably seems like a dumb question but what is the command to spawn an aircraft as described above.

Thanks
Load a ready submission which contains an aircraft or dynamical create a submission file with a script and then load it. Check out how naryv creates tanks in his examples attached in a sticky thread above.
Reply With Quote
Reply


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 09:47 AM.


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