![]() |
|
#1
|
|||
|
|||
![]() Quote:
![]() 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. ![]() I'd like to have a go at adding in some code to rearm/refuel/repair. Off the top of my head, it could probably work by automatically setting fuel etc to 1 when the relevant truck completes it's last waypoint. Or when it completes it's last waypoint, then it activates the Mission menu for the player to select the appropriate emergency service. I'm not sure if these solutions would be possible as I don't know many of the scripting commands. How can you see the API? Do you have to run kegetys -dump command or is there a different way to look at the API (in the COD folder somewhere maybe)? EDIT: I suspect it's in the maddox.dll.... Last edited by Das Attorney; 09-15-2011 at 11:31 PM. |
#2
|
|||
|
|||
![]()
The API is written using Microsoft .Net libraries, so you can examine them in things like Visual Studio (there is a free edition called Express). The 'object browser' shows the signatures and symbols of the files like game.world.dll that you reference in your project.
|
#3
|
|||
|
|||
![]() Quote:
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 |
#4
|
|||
|
|||
![]()
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; }; } If you've got any hints for setting up a repair script, please share ![]() 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. |
#5
|
|||
|
|||
![]() Quote:
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? |
#6
|
|||
|
|||
![]()
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 |
#7
|
|||
|
|||
![]()
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. |
#8
|
|||
|
|||
![]()
Ah rgr i see thank you Ataros
![]() Last edited by Gerbil Maximus; 09-24-2011 at 12:42 PM. |
![]() |
|
|