Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   Mission Menu and Ambulance (http://forum.fulqrumpublishing.com/showthread.php?t=26112)

SNAFU 09-16-2011 08:25 AM

Quote:

Originally Posted by Das Attorney (Post 336729)
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
}


Das Attorney 09-16-2011 06:46 PM

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.

Ataros 09-17-2011 10:06 AM

Quote:

Originally Posted by hc_wolf (Post 337090)
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?

Gerbil Maximus 09-22-2011 11:21 AM

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

Ataros 09-23-2011 07:50 PM

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.

Gerbil Maximus 09-24-2011 12:38 PM

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

Mington 09-25-2011 11:26 AM

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

Gerbil Maximus 09-27-2011 09:09 AM

Rgr Thank you

AKA_Scorp 01-17-2012 06:22 PM

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

Ataros 01-18-2012 07:40 AM

Quote:

Originally Posted by AKA_Scorp (Post 381108)
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.


All times are GMT. The time now is 04:17 PM.

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