PDA

View Full Version : Loadouts


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.

FG28_Kodiak
11-12-2011, 04:36 AM
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.

Yes its possible you can use

this Member from maddox.game.Player to force the player to a specific plane:
void PlaceEnter(maddox.game.world.AiActor actor, int indxPlace)

and this to kick ;) him out of a plane
void PlaceLeave(int indxPlace)

Ataros
11-12-2011, 08:15 AM
Yes its possible you can use

this Member from maddox.game.Player to force the player to a specific plane:
void PlaceEnter(maddox.game.world.AiActor actor, int indxPlace)

Vetochka just offered a sample script for this. Not tested yet and will be developed further. http://www.sukhoi.ru/forum/showthread.php?t=72896

Osprey
11-14-2011, 09:07 PM
Kind of a twist on this, but I was wondering if there is a way to identify players that have either brought back damaged planes, or didn't return to base, and stopping these players from being able to spawn new planes? Would work great for a longer mission time online campaign.

Bumping this. Would be very useful.

Ataros
11-15-2011, 05:51 PM
I think it is possible to check aircraft status OnAircraftLanded and OnAircraftCrushlanded with getParameter (?) and deny use of aircraft in a similar way to Spitfire IIa limiting scripts.

FG28_Kodiak
11-15-2011, 08:27 PM
GetParameters is not usefull in this case, i have tested it.
Make a List wich stores the players and 'his' actor. Use OnAircraftDamaged to look if a plane is damaged, store the damage information in the List, if the plane is in there.
The devs have 'forgotten' to implement a health member for AiAircraft.

ATAG_Bliss
11-15-2011, 08:49 PM
Doesn't an aircraft only show "landed" status after it has taken off? I know there's a bug that can cause the game to think you have landed on a spawn (hence planes randomly disappearing after you take off - despawn script running). But my point is, if the game doesn't think you've landed, and for instance, you don't have any fuel to start your engine, (saying you screwed up in your loadout as an example), then wouldn't that person's only option to get a new plane be to reconnect to the server?

I loved the old refly button. We definitely need something like this, but not unless it would allow you to get out of your plane on the runway, even if just spawned..