Squog and Co I've got at the list of (methods I think they're called. or classes) but anyway they're from the gameworld.dll
I've seen smaller lists of these functions elsewhere, this list is too big to post here though and please PM me dear FMB-into reader and I'll email it on to you. You may have done this already of course for your own inspection. The list of (variables, methods, classes, functions) is nearly 800. Someone will know what they all are but I'm imagining the Burning of the Library at Alexandria here, there cannot be many people still sane who know how to use all these variables
I've been er, enjoying collecting scripts-
GamePlay.gpActorByName GamePlay.gpGetTrigger
-and then finding how the developers are using them, for me particularly I'm attempting to winkle out triggers and wotnot in simple situations with 'Hello World'-type feedback messages
Ming
'You are either a hater or you are not' Roman Halter
Inline advert (2nd and 3rd post)
#3394698 - 09/21/1101:26 PMRe: Ambulance Station: notes from the Cavern
[Re: Ming_EAF19]
Joined: Jun 2001 Posts: 2,264No457_Squog
Squadron Leader
Ok guys I've got my code to work with a single-player game - servicing only players. Haven't tested multi yet. I'm having trouble landing with enough damage to spawn the 'mop up' crew so I haven't actually seen the crane-truck yet, but I'll implement FF's menu script so I can bust up my plane enough to get under 100%.
On another note - I think we need to look at seperating the waypoint routines for emergency crew versus R/R/R crew. If I land and come to a stop and then taxi away, the R/R/R crew won't adjust their last waypoint to follow. Maybe it would work a little bit better with triggers? ie: taxi to the R/R/R zone and the crew will find you.
Here's my code so far, but I've still got to grab the crane truck object from the FMB for the axis side (have been testing with Ajay's Hawkinge mission) and fill that out. If anyone spots anything dumb - please don't hesitate to shout it out
Click to reveal..
Code:
using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
using maddox.GP;
public class Mission : AMission {
public override void OnBattleStarted() {
base.OnBattleStarted();
MissionNumberListener = -1;
}
Random rnd = new Random();
[Flags]
internal enum ServiceType // Serving type machines
{
NONE = 0,
EMERGENCY = 1,
FIRE = 2,
FUEL = 4,
AMMO = 8,
BOMBS = 16,
PRISONERCAPTURE = 32,
ENGINEER = 64
}
internal class TechCars {
internal AiGroundGroup TechCar { get; set; }
internal AiAirport BaseAirport { get; set; }
internal IRecalcPathParams cur_rp { get; set; }
internal int RouteFlag = 0;
internal int cartype = 0;
internal int servPlaneNum = -1;
internal ServiceType CarType { get { return (ServiceType)cartype; } set { cartype = (int)value; } }
public TechCars(AiGroundGroup car, AiAirport airoport, IRecalcPathParams rp) {
this.TechCar = car;
this.BaseAirport = airoport;
this.cur_rp = rp;
}
}
internal class PlanesQueue {
internal AiAircraft aircraft { get; set; }
internal AiAirport baseAirport { get; set; }
internal int state = 0;
internal ServiceType State { get { return (ServiceType)state; } set { state = (int)value; } }
internal int Lifetime = 0;
internal float health = 1;
public PlanesQueue(AiAircraft aircraft, AiAirport baseAirport, int state) {
this.aircraft = aircraft;
this.baseAirport = baseAirport;
this.state = state;
}
}
internal List<TechCars> CurTechCars = new List<TechCars>();
internal List<PlanesQueue> CurPlanesQueue = new List<PlanesQueue>();
TechCars TmpCar = null;
bool MissionLoading = false;
internal double PseudoRnd(double MinValue, double MaxValue) {
return rnd.NextDouble() * (MaxValue - MinValue) + MinValue;
}
public override void OnActorTaskCompleted(int missionNumber, string shortName, AiActor actor) {
base.OnActorTaskCompleted(missionNumber, shortName, actor);
AiActor ai_actor = actor as AiActor;
if (ai_actor != null) {
if (ai_actor is AiGroundGroup)
for (int i = 0; i < CurTechCars.Count; i++) { // If serving the technology reached to serviced aircraft, allow it to be free
if (CurTechCars[i].TechCar == ai_actor as AiGroundGroup)
if (CurTechCars[i].RouteFlag == 1)
EndPlaneService(i);
else
CheckNotServicedPlanes(i);
};
}
}
internal void CheckNotServicedPlanes(int techCarIndex) {
for (int j = 0; j < CurPlanesQueue.Count; j++) {
if (CurTechCars[techCarIndex].TechCar.IsAlive() && (CurPlanesQueue[j].baseAirport == CurTechCars[techCarIndex].BaseAirport) && ((CurTechCars[techCarIndex].CarType & CurPlanesQueue[j].State) != 0) && (CurTechCars[techCarIndex].servPlaneNum == -1)) {
if (SetEmrgCarRoute(j, techCarIndex)) { // send a machine to service aircraft found
return;
}
}
}
}
internal void EndPlaneService(int techCarIndex) {
if (CurTechCars[techCarIndex].cur_rp == null) return;
CurTechCars[techCarIndex].cur_rp = null; // reset the trip
if (CurTechCars[techCarIndex].servPlaneNum >= 0) {
CurPlanesQueue[CurTechCars[techCarIndex].servPlaneNum].State &= ~CurTechCars[techCarIndex].CarType; // remove the type of service in the aircraft serviced, if there is
CurTechCars[techCarIndex].servPlaneNum = -1; // reset the number of serviced aircraft
Timeout(5f, () => {
if (!MoveFromRWay(techCarIndex)) { // check to stand there on ?, and leave with her if so.
CurTechCars[techCarIndex].RouteFlag = 0;
CheckNotServicedPlanes(techCarIndex); // and see if there are still unserved aircraft
}
});
} else Timeout(5f, () => {
CurTechCars[techCarIndex].RouteFlag = 0;
CheckNotServicedPlanes(techCarIndex); // and see if there are still unserved aircraft
});
}
internal bool MoveFromRWay(int carNum) {
bool result = false;
if ((GamePlay.gpLandType(CurTechCars[carNum].TechCar.Pos().x, CurTechCars[carNum].TechCar.Pos().y) & LandTypes.ROAD) == 0)
return result;
Point3d TmpPos = CurTechCars[carNum].TechCar.Pos();
while (((GamePlay.gpLandType(TmpPos.x, TmpPos.y) & LandTypes.ROAD) != 0)) {
TmpPos.x += 10f;
TmpPos.y += 10f;
};
Point2d EmgCarStart, EmgCarFinish;
EmgCarStart.x = CurTechCars[carNum].TechCar.Pos().x; EmgCarStart.y = CurTechCars[carNum].TechCar.Pos().y;
EmgCarFinish.x = TmpPos.x; EmgCarFinish.y = TmpPos.y;
CurTechCars[carNum].servPlaneNum = -1;
CurTechCars[carNum].RouteFlag = 0;
CurTechCars[carNum].cur_rp = null;
CurTechCars[carNum].cur_rp = GamePlay.gpFindPath(EmgCarStart, 10f, EmgCarFinish, 10f, PathType.GROUND, CurTechCars[carNum].TechCar.Army());
result = true;
return result;
}
public bool SetEmrgCarRoute(int aircraftNumber,int carNum) {
bool result = false;
if (CurTechCars[carNum].TechCar != null) {
CurTechCars[carNum].servPlaneNum = aircraftNumber; // set the number of serviced aircraft
if (CurTechCars[carNum].cur_rp == null) {
Point2d EmgCarStart, EmgCarFinish, LandedPos;
LandedPos.x = CurPlanesQueue[aircraftNumber].aircraft.Pos().x; LandedPos.y = CurPlanesQueue[aircraftNumber].aircraft.Pos().y;
int Sign = ((carNum % 2) == 0) ? 2 : -2;
EmgCarStart.x = CurTechCars[carNum].TechCar.Pos().x; EmgCarStart.y = CurTechCars[carNum].TechCar.Pos().y;
EmgCarFinish.x = LandedPos.x - PseudoRnd(2f, 5f) * ((LandedPos.x - EmgCarStart.x) / (Math.Abs(LandedPos.x - EmgCarStart.x))) - Sign;
EmgCarFinish.y = LandedPos.y - PseudoRnd(2f, 5f) * ((LandedPos.y - EmgCarStart.y) / (Math.Abs(LandedPos.y - EmgCarStart.y))) - Sign;
CurTechCars[carNum].cur_rp = GamePlay.gpFindPath(EmgCarStart, 10f, EmgCarFinish, 10f, PathType.GROUND, CurTechCars[carNum].TechCar.Army());
result = true;
}
}
return result;
}
public override void OnMissionLoaded(int missionNumber) {
base.OnMissionLoaded(missionNumber);
if (missionNumber > 0) {
List<string> CarTypes = new List<string>();
CarTypes.Add(":0_Chief_Emrg_");
CarTypes.Add(":0_Chief_Fire_");
CarTypes.Add(":0_Chief_Fuel_");
CarTypes.Add(":0_Chief_Ammo_");
CarTypes.Add(":0_Chief_Bomb_");
CarTypes.Add(":0_Chief_Prisoner_");
CarTypes.Add(":0_Chief_Engineer_");
AiGroundGroup MyCar = null;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < CarTypes.Count; j++) {
MyCar = GamePlay.gpActorByName(missionNumber.ToString() + CarTypes[j] + i.ToString()) as AiGroundGroup;
if (MyCar != null) {
TmpCar = new TechCars(MyCar, FindNearestAirport(MyCar), null);
TmpCar.CarType = (ServiceType)(1 << j);
TmpCar.cur_rp = null;
if (!CurTechCars.Contains(TmpCar))
CurTechCars.Add(TmpCar);
MissionLoading = false;
};
}
}
}
}
public override void OnTickGame() {
base.OnTickGame();
try {
if (Time.tickCounter() % 64 == 0) {
for (int i = 0; i < CurPlanesQueue.Count; i++) {
CurPlanesQueue[i].Lifetime++;
if ((CurPlanesQueue[i].State == ServiceType.NONE) || (CurPlanesQueue[i].aircraft == null) || (CurPlanesQueue[i].Lifetime > 200)) {
for (int j = 0; j < CurTechCars.Count; j++)
if (CurTechCars[j].servPlaneNum == i)
EndPlaneService(j);
CurPlanesQueue.RemoveAt(i);
}
};
for (int i = 0; i < CurTechCars.Count; i++) {
TechCars car = CurTechCars[i];
if ((car.TechCar != null && car.cur_rp != null) && (car.cur_rp.State == RecalcPathState.SUCCESS) ) {
if (car.TechCar.IsAlive() && (car.RouteFlag == 0)/* && (car.servPlaneNum != -1)*/) {
car.RouteFlag = 1;
car.cur_rp.Path[0].P.x = car.TechCar.Pos().x; car.cur_rp.Path[0].P.y = car.TechCar.Pos().y;
car.TechCar.SetWay(car.cur_rp.Path);
//if (car.servPlaneNum != -1) car.RouteFlag = 0;
}
double Dist = Math.Sqrt((car.cur_rp.Path[car.cur_rp.Path.Length - 1].P.x - car.TechCar.Pos().x) * (car.cur_rp.Path[car.cur_rp.Path.Length - 1].P.x - car.TechCar.Pos().x) + (car.cur_rp.Path[car.cur_rp.Path.Length - 1].P.y - car.TechCar.Pos().y) * (car.cur_rp.Path[car.cur_rp.Path.Length - 1].P.y - car.TechCar.Pos().y));
if (car.servPlaneNum != -1) {
if (Dist < ((CurPlanesQueue[car.servPlaneNum].aircraft.Type() == AircraftType.Bomber) ? 20f : 10f))
EndPlaneService(i);
} else if (Dist < 15f) {
EndPlaneService(i);
}
}
if ((car.cur_rp == null) && (car.RouteFlag == 0) && (car.servPlaneNum != -1)) {
EndPlaneService(i);
};
};
}
} catch (Exception e) {}
}
internal AiAirport FindNearestAirport(AiActor actor) {
AiAirport aMin = null;
double d2Min = 0;
Point3d pd = actor.Pos();
int n = GamePlay.gpAirports().Length;
for (int i = 0; i < n; i++) {
AiAirport a = (AiAirport)GamePlay.gpAirports()[i];
if (!a.IsAlive())
continue;
Point3d pp;
pp = a.Pos();
pd.z = pp.z;
double d2 = pd.distanceSquared(ref pp);
if ((aMin == null) || (d2 < d2Min)) {
aMin = a;
d2Min = d2;
}
}
if (d2Min > 2250000.0)
aMin = null;
return aMin;
}
internal ISectionFile CreateEmrgCarMission(Point3d startPos, double fRadius, int portArmy, int planeArmy, AircraftType type, float health, Point3d aircraftPos) {
ISectionFile f = GamePlay.gpCreateSectionFile();
string sect;
string key;
string value;
string ChiefName1 = "0_Chief_" + (health < 1f ? "Fire_" : "Fuel_");
string ChiefName2 = "0_Chief_" + (health < 1f ? "Emrg_" : "Ammo_");
string ChiefName3 = "0_Chief_" + (health < 1f ? "Bomb_" : "Bomb_");
string ChiefName4 = "0_Chief_" + (health < 1f ? "Eng_" : "Eng_");
if (portArmy == planeArmy) { // its arrived
switch (portArmy) {
case 1:
if (health < 1f) {
sect = "CustomChiefs";
key = "";
value = "Vehicle.custom_chief_emrg_0 $core/icons/tank.mma"; // firetruck
f.add(sect, key, value);
value = "Vehicle.custom_chief_emrg_1 $core/icons/tank.mma"; // ambulance
f.add(sect, key, value);
value = "Vehicle.custom_chief_emrg_2 $core/icons/tank.mma"; // engineers
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_0";
key = "Car.Austin_K2_ATV";
value = "";
f.add(sect, key, value);
key = "TrailerUnit.Fire_pump_UK2_Transport";
value = "1";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_1";
key = "Car.Austin_K2_Ambulance";
value = "";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_2";
key = "Vehicle.Scammell_Pioneer_SV2S";
value = "";
f.add(sect, key, value);
sect = "Chiefs";
key = "0_Chief_Fire_0";
value = "Vehicle.custom_chief_emrg_0 gb /skin0 materialsSummer_RAF";
f.add(sect, key, value);
key = "0_Chief_Emrg_1";
value = "Vehicle.custom_chief_emrg_1 gb /skin0 materialsSummer_RAF";
f.add(sect, key, value);
key = "0_Chief_Eng_2";
value = "Vehicle.custom_chief_emrg_2 gb /skin0 MaterialsSummer_RAF";
f.add(sect, key, value);
} else {
sect = "CustomChiefs";
key = "";
value = "Vehicle.custom_chief_emrg_0 $core/icons/tank.mma";
f.add(sect, key, value);
value = "Vehicle.custom_chief_emrg_1 $core/icons/tank.mma";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_0"; // tankers
key = "Car.Albion_AM463";
value = "";
f.add(sect, key, value);
if (type == AircraftType.Bomber) { // more bombers to bomb and picked up goryuchku
key = "Car.Fordson_N";
value = "";
f.add(sect, key, value);
key = "TrailerUnit.Towed_Bowser_UK1_Transport";
value = "1";
f.add(sect, key, value);
}
sect = "Vehicle.custom_chief_emrg_1"; // weapon
value = "";
key = "Car.Bedford_MW_open";
f.add(sect, key, value);
if (type == AircraftType.Bomber) { // bombers to bomb picked up
sect = "CustomChiefs";
key = "";
value = "Vehicle.custom_chief_emrg_2 $core/icons/tank.mma";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_2";
value = "";
key = "Car.Fordson_N";
value = "";
f.add(sect, key, value);
key = "TrailerUnit.BombLoadingCart_UK1_Transport";
value = "1";
f.add(sect, key, value);
key = "TrailerUnit.BombLoadingCart_UK1_Transport";
f.add(sect, key, value);
};
sect = "Chiefs";
key = "0_Chief_Fuel_0";
value = "Vehicle.custom_chief_emrg_0 gb /skin0 materialsSummer_RAF";
f.add(sect, key, value);
key = "0_Chief_Ammo_1";
value = "Vehicle.custom_chief_emrg_1 gb /skin0 materialsSummer_RAF/tow00_00 1_Static";
f.add(sect, key, value);
if (type == AircraftType.Bomber) {
key = "0_Chief_Bomb_2";
value = "Vehicle.custom_chief_emrg_2 gb /tow01_00 2_Static/tow01_01 3_Static/tow01_02 4_Static/tow01_03 5_Static/tow02_00 6_Static/tow02_01 7_Static";
f.add(sect, key, value);
}
sect = "Stationary";
key = "1_Static";
value = "Stationary.Morris_CS8-Bedford_MW_CargoAmmo3 gb 0.00 0.00 0.00";
f.add(sect, key, value);
if (type == AircraftType.Bomber) { // bomb ship
key = "2_Static";
value = "Stationary.Weapons_.Bomb_B_GP_250lb_MkIV gb 0.00 0.00 0.00";
f.add(sect, key, value);
key = "3_Static";
value = "Stationary.Weapons_.Bomb_B_GP_250lb_MkIV gb 0.00 0.00 0.00";
f.add(sect, key, value);
key = "4_Static";
value = "Stationary.Weapons_.Bomb_B_GP_250lb_MkIV gb 0.00 0.00 0.00";
f.add(sect, key, value);
key = "5_Static";
value = "Stationary.Weapons_.Bomb_B_GP_250lb_MkIV gb 0.00 0.00 0.00";
f.add(sect, key, value);
key = "6_Static";
value = "Stationary.Weapons_.Bomb_B_GP_500lb_MkIV gb 0.00 0.00 0.00";
f.add(sect, key, value);
key = "7_Static";
value = "Stationary.Weapons_.Bomb_B_GP_500lb_MkIV gb 0.00 0.00 0.00";
f.add(sect, key, value);
};
};
break;
case 2:
sect = "CustomChiefs";
key = "";
value = "Vehicle.custom_chief_emrg_0 $core/icons/tank.mma"; // firetruck
f.add(sect, key, value);
value = "Vehicle.custom_chief_emrg_1 $core/icons/tank.mma"; // ambulance
f.add(sect, key, value);
value = "Vehicle.custom_chief_emrg_2 $core/icons/tank.mma"; // engineers
f.add(sect, key, value);
if (health < 1f) {
sect = "Vehicle.custom_chief_emrg_0";
key = "Car.Renault_UE";
value = "";
f.add(sect, key, value);
key = "TrailerUnit.Foam_Extinguisher_GER1_Transport";
value = "1";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_1";
if (PseudoRnd(0f, 1f) < 0.5f) {
key = "Car.Opel_Blitz_med-tent";
} else { key = "Car.Opel_Blitz_cargo_med"; };
value = "";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_2";
/////////////////////////////// key = "";
value = "";
f.add(sect, key, value);
sect = "Chiefs";
key = "0_Chief_Fire_0";
value = "Vehicle.custom_chief_emrg_0 de ";
f.add(sect, key, value);
key = "0_Chief_Emrg_1";
value = "Vehicle.custom_chief_emrg_1 de ";
f.add(sect, key, value);
key = "0_Chief_Eng_2";
value = "Vehicle.custom_chief_emrg_1 de ";
f.add(sect, key, value);
} else {
sect = "Vehicle.custom_chief_emrg_0";
key = "Car.Opel_Blitz_fuel";
value = "";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_1";
key = "Car.Renault_UE";
f.add(sect, key, value);
key = "TrailerUnit.Oil_Cart_GER1_Transport";
value = "1";
f.add(sect, key, value);
key = "Car.Renault_UE";
value = "";
f.add(sect, key, value);
key = "TrailerUnit.Anlasswagen_(starter)_GER1_Transport";
value = "1";
f.add(sect, key, value);
if (type == AircraftType.Bomber) { // bomb ship
sect = "CustomChiefs";
key = "";
value = "Vehicle.custom_chief_emrg_2 $core/icons/tank.mma";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_2";
key = "Car.Renault_UE";
value = "";
f.add(sect, key, value);
key = "TrailerUnit.HydraulicBombLoader_GER1_Transport";
value = "1";
f.add(sect, key, value);
key = "Car.Renault_UE";
value = "";
f.add(sect, key, value);
key = "TrailerUnit.BombSled_GER1_Transport";
value = "1";
f.add(sect, key, value);
}
sect = "Chiefs";
key = "0_Chief_Fuel_0";
value = "Vehicle.custom_chief_emrg_0 de";
f.add(sect, key, value);
key = "0_Chief_Ammo_1";
value = "Vehicle.custom_chief_emrg_1 de";
f.add(sect, key, value);
if (type == AircraftType.Bomber) {
key = "0_Chief_Bomb_2";
value = "Vehicle.custom_chief_emrg_2 de /tow01_00 1_Static/tow03_00 2_Static";
f.add(sect, key, value);
sect = "Stationary";
key = "1_Static";
value = "Stationary.Weapons_.Bomb_B_SC-250_Type2_J de 0.00 0.00 0.00";
f.add(sect, key, value);
key = "2_Static";
value = "Stationary.Weapons_.Bomb_B_SC-1000_C de 0.00 0.00 0.00";
f.add(sect, key, value);
};
};
break;
default:
break;
}
} else {
switch (portArmy) {
case 1:
if (health < 1f) {
sect = "CustomChiefs";
key = "";
value = "Vehicle.custom_chief_emrg_0 $core/icons/tank.mma"; // Firetruck
f.add(sect, key, value);
value = "Vehicle.custom_chief_emrg_1 $core/icons/tank.mma"; // ambulance
f.add(sect, key, value);
value = "Vehicle.custom_chief_emrg_2 $core/icons/tank.mma"; // armored car
f.add(sect, key, value);
value = "Vehicle.custom_chief_emrg_3 $core/icons/tank.mma"; // engineers
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_0";
key = "Car.Austin_K2_ATV";
value = "";
f.add(sect, key, value);
key = "TrailerUnit.Fire_pump_UK2_Transport";
value = "1";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_1";
key = "Car.Austin_K2_Ambulance";
value = "";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_2";
key = "Car.Beaverette_III";
value = "";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_3";
/////////////////////// key = "Car.Austin_K2_ATV";
value = "";
f.add(sect, key, value);
sect = "Chiefs";
key = "0_Chief_Fire_0";
value = "Vehicle.custom_chief_emrg_0 gb /skin0 materialsSummer_RAF";
f.add(sect, key, value);
key = "0_Chief_Emrg_1";
value = "Vehicle.custom_chief_emrg_1 gb /skin0 materialsSummer_RAF";
f.add(sect, key, value);
key = "0_Chief_Prisoner_2";
value = "Vehicle.custom_chief_emrg_2 gb ";
f.add(sect, key, value);
ChiefName3 = "0_Chief_Prisoner_";
key = "0_Chief_Eng_3";
//////////////////////////// value = "Vehicle.custom_chief_emrg_1 gb /skin0 materialsSummer_RAF";
f.add(sect, key, value);
} else {
sect = "CustomChiefs";
key = "";
value = "Vehicle.custom_chief_emrg_0 $core/icons/tank.mma"; // Firetruck
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_0";
key = "Car.Beaverette_III";
value = "";
f.add(sect, key, value);
sect = "Chiefs";
key = "0_Chief_Prisoner_0";
value = "Vehicle.custom_chief_emrg_0 gb ";
f.add(sect, key, value);
ChiefName1 = "0_Chief_Prisoner_";
};
break;
case 2:
if (health < 1f) {
sect = "CustomChiefs";
key = "";
value = "Vehicle.custom_chief_emrg_0 $core/icons/tank.mma"; // Firetruck
f.add(sect, key, value);
value = "Vehicle.custom_chief_emrg_1 $core/icons/tank.mma"; // ambulance
f.add(sect, key, value);
value = "Vehicle.custom_chief_emrg_2 $core/icons/tank.mma"; // armoured car
f.add(sect, key, value);
value = "Vehicle.custom_chief_emrg_3 $core/icons/tank.mma"; // engineers
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_0";
key = "Car.Renault_UE";
value = "";
f.add(sect, key, value);
key = "TrailerUnit.Foam_Extinguisher_GER1_Transport";
value = "1";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_1";
key = "Car.Opel_Blitz_cargo_med";
value = "";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_2";
key = "Car.SdKfz_231_6Rad";
value = "";
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_3";
/////////////////////// key = "Car.SdKfz_231_6Rad";
value = "";
f.add(sect, key, value);
sect = "Chiefs";
key = "0_Chief_Fire_0";
value = "Vehicle.custom_chief_emrg_0 de";
f.add(sect, key, value);
key = "0_Chief_Emrg_1";
value = "Vehicle.custom_chief_emrg_1 de";
f.add(sect, key, value);
key = "0_Chief_Prisoner_2";
value = "Vehicle.custom_chief_emrg_2 de /marker0 1940-42_var1";
f.add(sect, key, value);
ChiefName3 = "0_Chief_Prisoner_";
key = "0_Chief_Eng_2";
///////////////////////// value = "Vehicle.custom_chief_emrg_1 de";
f.add(sect, key, value);
} else {
sect = "CustomChiefs";
key = "";
value = "Vehicle.custom_chief_emrg_0 $core/icons/tank.mma"; // Firetruck
f.add(sect, key, value);
sect = "Vehicle.custom_chief_emrg_0";
key = "Car.SdKfz_231_6Rad";
value = "";
f.add(sect, key, value);
sect = "Chiefs";
key = "0_Chief_Prisoner_0";
value = "Vehicle.custom_chief_emrg_0 de /marker0 1940-42_var1";
f.add(sect, key, value);
ChiefName1 = "0_Chief_Prisoner_";
};
break;
default:
break;
};
}
Point3d TmpStartPos = startPos;
TmpStartPos.x += PseudoRnd(-30f, 30f) + fRadius; TmpStartPos.y += PseudoRnd(-30f, 30f) + fRadius;
Point3d BirthPos = EmrgVehicleStartPos(TmpStartPos, startPos);
sect = ChiefName1+"0" + "_Road";
key = "";
value = BirthPos.x.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.y.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.z.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " 0 92 5 ";
f.add(sect, key, value);
BirthPos.x -= 50f * ((BirthPos.x - aircraftPos.x) / Math.Abs(BirthPos.x - aircraftPos.x)); BirthPos.y -= 50f * ((BirthPos.y - aircraftPos.y) / Math.Abs(BirthPos.y - aircraftPos.y));
value = BirthPos.x.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.y.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.z.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
f.add(sect, key, value);
TmpStartPos = startPos;
TmpStartPos.x += PseudoRnd(-30f, 30f) - fRadius; TmpStartPos.y += PseudoRnd(-30f, 30f) + fRadius;
BirthPos = EmrgVehicleStartPos(TmpStartPos, startPos);
//BirthPos = TmpStartPos;
sect = ChiefName2+"1" + "_Road";
key = "";
value = BirthPos.x.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.y.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.z.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " 0 92 5 ";
f.add(sect, key, value);
BirthPos.x -= 50f * ((BirthPos.x - aircraftPos.x) / Math.Abs(BirthPos.x - aircraftPos.x)); BirthPos.y -= 50f * ((BirthPos.y - aircraftPos.y) / Math.Abs(BirthPos.y - aircraftPos.y));
value = BirthPos.x.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.y.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.z.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
f.add(sect, key, value);
TmpStartPos = startPos;
TmpStartPos.x += PseudoRnd(-30f, 30f) + fRadius; TmpStartPos.y += PseudoRnd(-30f, 30f) - fRadius;
BirthPos = EmrgVehicleStartPos(TmpStartPos, startPos);
sect = ChiefName3 + "2" + "_Road";
key = "";
value = BirthPos.x.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.y.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.z.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " 0 92 5 ";
f.add(sect, key, value);
BirthPos.x -= 50f * ((BirthPos.x - aircraftPos.x) / Math.Abs(BirthPos.x - aircraftPos.x)); BirthPos.y -= 50f * ((BirthPos.y - aircraftPos.y) / Math.Abs(BirthPos.y - aircraftPos.y));
value = BirthPos.x.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.y.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.z.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
f.add(sect, key, value);
TmpStartPos = startPos;
TmpStartPos.x += PseudoRnd(-30f, 30f) + fRadius; TmpStartPos.y += PseudoRnd(-30f, 30f) - fRadius;
BirthPos = EmrgVehicleStartPos(TmpStartPos, startPos);
sect = ChiefName4 + "3" + "_Road";
key = "";
value = BirthPos.x.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.y.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.z.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " 0 92 5 ";
f.add(sect, key, value);
BirthPos.x -= 50f * ((BirthPos.x - aircraftPos.x) / Math.Abs(BirthPos.x - aircraftPos.x)); BirthPos.y -= 50f * ((BirthPos.y - aircraftPos.y) / Math.Abs(BirthPos.y - aircraftPos.y));
value = BirthPos.x.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.y.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + BirthPos.z.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat);
f.add(sect, key, value);
return f;
}
internal Point3d EmrgVehicleStartPos(Point3d startPos, Point3d endPos) {
Point3d TmpPos = startPos;
while (((GamePlay.gpLandType(TmpPos.x, TmpPos.y) & LandTypes.WATER) != 0) ) {
TmpPos.x -= (TmpPos.x - endPos.x) / 10f;
TmpPos.y -= (TmpPos.y - endPos.y) / 10f;
};
return TmpPos;
}
internal void CheckEmrgCarOnAirport(int aircraftNumber)
{
// Check whether there cars at the airport
AiGroundGroup MyCar = null;
for (int i = 0; i < CurTechCars.Count; i++) {
if (CurTechCars[i].TechCar != null ) {
if (CurTechCars[i].TechCar.IsAlive() && CurTechCars[i].BaseAirport == CurPlanesQueue[aircraftNumber].baseAirport && (CurTechCars[i].CarType & CurPlanesQueue[aircraftNumber].State)!=0) {
MissionLoading = false;
MyCar = CurTechCars[i].TechCar;
if ((CurTechCars[i].cur_rp == null) && (CurTechCars[i].RouteFlag == 0) && (CurTechCars[i].servPlaneNum == -1)) // ???? ????? ??? ???? - ???????? ????????
SetEmrgCarRoute(aircraftNumber, i);
}
}
};
if ((MyCar == null) && !MissionLoading) {
MissionLoading = true;
int ArmyPos = 0;
if (GamePlay.gpFrontExist()) {
ArmyPos = GamePlay.gpFrontArmy(CurPlanesQueue[aircraftNumber].baseAirport.Pos().x, CurPlanesQueue[aircraftNumber].baseAirport.Pos().y);
} else { ArmyPos = CurPlanesQueue[aircraftNumber].aircraft.Army(); };
// Create a mission with cars
GamePlay.gpPostMissionLoad(CreateEmrgCarMission(CurPlanesQueue[aircraftNumber].baseAirport.Pos(), (CurPlanesQueue[aircraftNumber].baseAirport.FieldR() / 4), ArmyPos, CurPlanesQueue[aircraftNumber].aircraft.Army(), CurPlanesQueue[aircraftNumber].aircraft.Type(),CurPlanesQueue[aircraftNumber].health, CurPlanesQueue[aircraftNumber].aircraft.Pos()));
}
return;
}
public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft) {
base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);
Timeout(5, () => {
aircraft.Destroy();
});
}
public override void OnAircraftLanded(int missionNumber, string shortName, AiAircraft aircraft) {
base.OnAircraftLanded(missionNumber, shortName, aircraft);
AiAirport NearestAirport = FindNearestAirport(aircraft);
bool isHuman = false;
for (int i = 0; i < aircraft.Places(); i++)
if (aircraft.Player(i) != null)
isHuman = true;
if ((NearestAirport != null) && (isHuman)) {
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;
CurPlane.State |= ServiceType.ENGINEER;
} 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;
};
}
}
I added your script above to a simple enemy bomber intercept mission, forced a crash-landing and here comes your ambulance
It's rather a big script mate, can you tell us er, what should we do with it
I can see that it's possible to add that complex script to a simple user-created Single mission (like the one I tested your script on) - what to expect then I mean, in a single-play mission?
I'm impressed not only by how your script slips in there seamlessly but I'm further impressed with Maddox devs that I could save a track and then convert the track to an avi from the FMB. We've arrived in the future apparently
Ming
'You are either a hater or you are not' Roman Halter
#3395355 - 09/22/1101:34 PMRe: Ambulance Station: notes from the Cavern
[Re: Ming_EAF19]
Joined: Jun 2001 Posts: 2,264No457_Squog
Squadron Leader
I can't really take credit for the script - I haven't changed much from naryv(sp)'s script in the scale of things...
I watched your vid... I see now why I had so much trouble breaking the aircraft on landing! It's just too gut wrenching to see a spit pull itself to pieces on the field!
After watching the video - did you wait long enough for the other vehicles to arrive? Normally they spawn quite a distance away. There should be a truck with a crane assembly come to the rescue...
I was in quick-testing-mode squog, I suddenly had the idea that maybe I could insert your script (crowbar it seemed, no reason why it should work) into an already prepared mission with no script previously - just to see what would happen. Stone me but everything worked, my flight's operations were not hobbled, the ambulance appeared on cue. I at least expected 'Plane does not exist' or 'Script error' error messages
This gives one confidence in the FMB and underlines the suspicion that there's a very good combat flight-sim under the bonnet. The very fetching bonnet with a blonde curl
An airfield with all the buildings, a fire station with a fire engine or two outside standing by. Some scheme to detect a plane incoming damaged. Trigger the fire engines to navigate safely from the fire station to the crash-landed plane. Trigger a bell or Doppler-two when the fire engines set off
did you wait long enough for the other vehicles to arrive?
Good point! And no-doh, next time
But anyway I proved the concept QED
Ming
'You are either a hater or you are not' Roman Halter
#3395561 - 09/22/1105:54 PMRe: Ambulance Station: notes from the Cavern
[Re: Ming_EAF19]
Joined: Jan 2009 Posts: 4,737FearlessFrog
Senior Member
One thing I'm still trying to figure out is a more general mechanism to do add-ins for the sim. So far what we have is the ability to add script to individual missions, and if the script is written in such a way not to expect certain objects to be there but create them on demand then they will usually work.
There is a 'client add-in' interface that's so far a mystery, and that looks like the best thing for adding various single-player new gubbins, i.e. a better map or perhaps another new window on top of the existing game (but still part of it, if you see what I mean). The various SDK's can't come soon enough, as the add-in interface is pretty non-descript enough to make it hard to guess at (other than just being a standard .NET add-in component).
Really great stuff. Like a great mystery, waiting to see what comes next.
"A time when America was great,,when the chrome was thick and the women were straight" - Micheal Savage
"If you really want to experience flight in this life then you have to strap a DC-3 to your ass." - Buffalo Joe McBryan President & Captain Buffalo Airways
#3395739 - 09/22/1109:15 PMRe: Ambulance Station: notes from the Cavern
[Re: Ming_EAF19]
Maybe some clues to setting a trigger for our desired aircraft-state ApproachingDamaged
OnAircraftDamaged (and heading in to land)
OnAircraftCrashLanded (no extra coding but we'd like the emergency services coming to meet the plane as it's rtb-ing)
Point3d (if this returns the XYZ position of an object)
Pos (if this returns an object's position)
Vector2d (if the 2D vector includes a radar sweep, maybe Cartesian-to-polar conversion for a distance)
CoverageR (this could be R for radius as the very next two variables/members listed could be airstrips, referencing 'AiAirportStripState') StripCount StripState
If only as usual, but someone may know, we cast our bread on the waters and five Hail Marys
Ming
'You are either a hater or you are not' Roman Halter
#3641800 - 09/10/1205:34 PMRe: Ambulance Station: notes from the Cavern
[Re: Ming_EAF19]
Joined: May 2006 Posts: 1,088SlipBall
disillusioned
I'm a little late but great thread! I have only just recently taken an interest in scripts...if I may make a suggestion here, please add a car loaded with lawyers chasing the ambulance
Post composed with speech to text, it woks grape!
Clod OEM screenshots & videos of Eu release..So I fly the original game because I am a off-liner and the game's AI was broken after the last good patch, game version 1.0.13954 GigaByteBoard...64bit...FX 4300 3.8, G. Skill sniper 1866 32GB, EVGA GTX 660 ti 3gb, Raptor 64mb cache, Planar 120Hz 2ms, CH controls, Tir5
#3642713 - 09/12/1203:39 AMRe: Ambulance Station: notes from the Cavern
[Re: Ming_EAF19]
is it possible to turn this into an "preferences option" that can be turned on/of in the CoD settings so it is active for all missions and flights, rather then have done manually for each mission ? if it cant be integrated into the current menu's could we possibly create a small external proggy like the old il2-stab where it "crowbar's" (ming terminology) these settings into the game each time it starts up ? we'd need the options to include something like:
1) on "landing with damaged plane" - fire engine on/off - ambulance on/off - mechanics truck on/off - normally there would/should also be a jeep with some senior officers and other pilots rushing to the scene to help on/off - few folks arriving on bicycles ?
2) object density (to get multiples of each of those moving objects to the crash scene) low/med/high
similar routines could be created for undamaged friendly aircraft landing, where it only involves refueling and rearming trucks, and a vehicle with some mechanics maybe
lastly, could we not create some 3) standard AI routine of vehicles and other objects moving around the base, so that the area seems "alive" and buzzing with activity as it normally would/should be ? to avoid this being a drain on resources by having all bases do this while no humans are at them (since nobody is there to enjoy it), could this not be triggered by something like "human flown aircraft" within 2 km of friendly/enemy base (eg roughly visual range. these routines could involve a few jeeps, trucks, supply vehicles or even bicycles moving around (and occasionally taking a shortcut across a runway), where they move in a predetermined way from huts to hangers, to stationary planes etc (this can be done very simply initially to add some life, and could be made more complex later)
the sim has heaps of goodies under the hood, and i am sure it would increase interest and appeal if some of these more advanced elements start being activated. the il2 stab type proggy could even be setup so it can be used to load other AI object routines (created by other users in the future)
Be advised, we got zips in the wire
#3642776 - 09/12/1207:30 AMRe: Ambulance Station: notes from the Cavern
[Re: Ming_EAF19]
Bloody hell, hail to the Cavern Warriors!... Just seen this thread, great stuff being discovered here, well done to all!
Me thinks they have all retired from scripting.
Post composed with speech to text, it woks grape!
Clod OEM screenshots & videos of Eu release..So I fly the original game because I am a off-liner and the game's AI was broken after the last good patch, game version 1.0.13954 GigaByteBoard...64bit...FX 4300 3.8, G. Skill sniper 1866 32GB, EVGA GTX 660 ti 3gb, Raptor 64mb cache, Planar 120Hz 2ms, CH controls, Tir5
#3644166 - 09/14/1201:16 PMRe: Ambulance Station: notes from the Cavern
[Re: Ming_EAF19]