AKA_Scorp
11-12-2011, 02:24 AM
I have been working on catching the load out and fuel a player spawns in with. After being able to catch the fuel using:
Double dFuel = aircraft.getParameter(ParameterTypes.S_FuelReserve ,-1);
I was convinced
Double dWeapon = aircraft.getParameter(ParameterTypes.S_BombReserve , -1);
would work for weapons but all I got was 0 no matter what load out I used.
Subtype -1 catches all the fuel but it doesn't work for bombs or guns, after some testing I found this worked:
for (int i = 0; i <= 10; i++)
{
try
{
dFuel = aircraft.getParameter(ParameterTypes.S_FuelReserve , i);
}
catch
{
dFuel = -1;
}
try
{
dWeapon = aircraft.getParameter(ParameterTypes.S_BombReserve , i);
}
catch
{
dWeapon = -1;
}
try
{
dGun = aircraft.getParameter(ParameterTypes.S_GunReserve, i);
}
catch
{
dGun = -1;
}
sline = String.Format("subtype {0:0} guns {1:0} bombs {2:0} fuel {3:0}",
i, dGun, dWeapon, dFuel);
AddtoEventlog(sline);
}
Giving this output:
[00:01:08] AKA_Scorp:BlenheimMkIV loaded guns 0 bombs 0 fuel 1564
subtype 0 guns 500 bombs 1 fuel 314
subtype 1 guns 2600 bombs 1 fuel 468
subtype 2 guns 0 bombs 1 fuel 468
subtype 3 guns 0 bombs 1 fuel 314
subtype 4 guns 0 bombs 0 fuel -1
subtype 5 guns 0 bombs 0 fuel -1
subtype 6 guns 0 bombs 0 fuel -1
subtype 7 guns 0 bombs 0 fuel -1
subtype 8 guns 0 bombs 0 fuel -1
subtype 9 guns 0 bombs 0 fuel -1
subtype 10 guns 0 bombs 0 fuel -1
[00:01:24] AKA_Scorp entered refly menu
[00:01:24] AKA_Scorp:SpitfireMkIa aircraft occupied at 167416.50 198912.70
[00:01:24] AKA_Scorp:SpitfireMkIa loaded guns 0 bombs 0 fuel 284
subtype 0 guns 300 bombs 0 fuel 284
subtype 1 guns 300 bombs 0 fuel -1
subtype 2 guns 300 bombs 0 fuel -1
subtype 3 guns 300 bombs 0 fuel -1
subtype 4 guns 300 bombs 0 fuel -1
subtype 5 guns 300 bombs 0 fuel -1
subtype 6 guns 300 bombs 0 fuel -1
subtype 7 guns 300 bombs 0 fuel -1
subtype 8 guns 0 bombs 0 fuel -1
subtype 9 guns 0 bombs 0 fuel -1
subtype 10 guns 0 bombs 0 fuel -1
The beaufighter had 4x250 bombs loaded. There must be away to figure out what type of bombs are loaded but I'm not sure where to look for that.
One other thing, is is possible to stop a player from creating another aircraft after he creates one? I'm looking at a way to keep a pilot in his aircraft once he has taken off until he has landed, bailed, disconnected etc.
Double dFuel = aircraft.getParameter(ParameterTypes.S_FuelReserve ,-1);
I was convinced
Double dWeapon = aircraft.getParameter(ParameterTypes.S_BombReserve , -1);
would work for weapons but all I got was 0 no matter what load out I used.
Subtype -1 catches all the fuel but it doesn't work for bombs or guns, after some testing I found this worked:
for (int i = 0; i <= 10; i++)
{
try
{
dFuel = aircraft.getParameter(ParameterTypes.S_FuelReserve , i);
}
catch
{
dFuel = -1;
}
try
{
dWeapon = aircraft.getParameter(ParameterTypes.S_BombReserve , i);
}
catch
{
dWeapon = -1;
}
try
{
dGun = aircraft.getParameter(ParameterTypes.S_GunReserve, i);
}
catch
{
dGun = -1;
}
sline = String.Format("subtype {0:0} guns {1:0} bombs {2:0} fuel {3:0}",
i, dGun, dWeapon, dFuel);
AddtoEventlog(sline);
}
Giving this output:
[00:01:08] AKA_Scorp:BlenheimMkIV loaded guns 0 bombs 0 fuel 1564
subtype 0 guns 500 bombs 1 fuel 314
subtype 1 guns 2600 bombs 1 fuel 468
subtype 2 guns 0 bombs 1 fuel 468
subtype 3 guns 0 bombs 1 fuel 314
subtype 4 guns 0 bombs 0 fuel -1
subtype 5 guns 0 bombs 0 fuel -1
subtype 6 guns 0 bombs 0 fuel -1
subtype 7 guns 0 bombs 0 fuel -1
subtype 8 guns 0 bombs 0 fuel -1
subtype 9 guns 0 bombs 0 fuel -1
subtype 10 guns 0 bombs 0 fuel -1
[00:01:24] AKA_Scorp entered refly menu
[00:01:24] AKA_Scorp:SpitfireMkIa aircraft occupied at 167416.50 198912.70
[00:01:24] AKA_Scorp:SpitfireMkIa loaded guns 0 bombs 0 fuel 284
subtype 0 guns 300 bombs 0 fuel 284
subtype 1 guns 300 bombs 0 fuel -1
subtype 2 guns 300 bombs 0 fuel -1
subtype 3 guns 300 bombs 0 fuel -1
subtype 4 guns 300 bombs 0 fuel -1
subtype 5 guns 300 bombs 0 fuel -1
subtype 6 guns 300 bombs 0 fuel -1
subtype 7 guns 300 bombs 0 fuel -1
subtype 8 guns 0 bombs 0 fuel -1
subtype 9 guns 0 bombs 0 fuel -1
subtype 10 guns 0 bombs 0 fuel -1
The beaufighter had 4x250 bombs loaded. There must be away to figure out what type of bombs are loaded but I'm not sure where to look for that.
One other thing, is is possible to stop a player from creating another aircraft after he creates one? I'm looking at a way to keep a pilot in his aircraft once he has taken off until he has landed, bailed, disconnected etc.