In the meantime, I thought that you guys might be interested in implementing a fix in this for your mods (especially, if you've decided to give vehicle crews to all factions).
Since I don't have enough time to write the mod, I'll write a sketch of what you need to do. In the future, I'll write and distribute a prototype that fixes USF popcap for the Jackson. That way, you can more easily incorporate that for your mods.
The base parts:
Create an entity that holds the popcap
- Copy a retreat antenna entity
- Make the entity invisible
- Give the entity a popcap value
If we wanted to fix the Jackson, which has 14 popcap, the crew has 4 popcap. Thus, I would give the entity a popcap value of 10
Think of the possible states for your vehicle
Ideally, you want to link the popcap (soul) of the vehicle to give popcap while the vehicle is alive and abandoned.
Thus:
- If the vehicle is dead: no popcap
- If the vehicle is occupied by someone: the antenna shouldn't spawn. The vehicle already gives popcap to the occuping player
- At any other point in time, the (neutral) vehicle should have a player-owned (invisible) popcap antenna attached to it
Spawn the antenna when the conditions holds
The easiest way to keep track of the state of the vehicle is create a custom upgrade that keeps track of the state. The upgrade should be tied to the entity, so that the upgrade persists if the vehicle is decrewed.
Let's name the entity upgrade as "vehicle_decrewed_upgrade_mp".
Add a requirement action on the ebps file of your vehicle (jackson), to spawn a player-owned antenna for 99999 seconds while the upgrade is present.
Control when the conditions should hold
Given that you've determined that the antenna should spawn when the vehicle is decrewed, there are 3 types of event to consider:
1. When the vehicle dies, the upgrade should be removed
2. When the vehicle becomes captured, the antenna-upgrade should be removed.
3. When the player disembarks from he vehicle, the vehicle should receive the antenna-upgrade
1 is solved auto-magically by the game. When the vehicle dies, so does the requirement action.
To address 2, you can put an action_apply_ext in the sbps of the vehicle to remove the upgrade. Since action apply only executes once when a squad is formed (i.e., when a vehicle is captured), this is the ideal solution.
To address 3, you need to modify the vehicle_decrew abilities. There are currently 3 abilities; one for generic crew, one for m20 crew and one for medics. Ideally you want to do the same.
The trick to modifying the disembarkation abilities is make it so that the upgrade is applied right before the vehicle becomes neutral. If the upgrade comes too late, the spawned antenna-entity will not belong to the player; it will belong to the neutral player.
To do this, if the disembarkation has a delay of 2 seconds, apply the upgrade with a delay of 1.5 seconds (so that it occurs 0.5 seconds before the disembarkation).
If the disembarkation has no delay, then add one, accordingly.
Test and apply your mod
For the initial stages, you might make the popcap antenna visible, so that you can see if you've gotten that right. Then, when everything looks set, you can make it invisible again.
Remember that you need to apply the same procedure for every vehicle:
- ebps -> requirement action -> popcap antenna (with popcap tailored to the vehicle in question)
- sbps -> remove upgrade
For the live version, the list of vehicles should apply to all factions' vehicles, as USF crews can hop in and out of captured vehicles as well.
Additional ideas
Since you've fixed USF popcap, why not give them a bit of a bonus somewhere else too. How about making their ambulances worth 0 popcap to allow for more mobile play?
However, how do you prevent ambulances from being used to "hide" squads and deflate popcap in the same way?
First of all, you set your ambulance to 0 popcap. Then, while the ambulance is crewed, you want to check whether there is a medic squad occupying it (no change), or there's somebody else hiding in there (in which case, you want to apply a 4 popcap penalty to the ambulance).
In the ambulance's ebps, look for driver_action_apply. This one applies actions to the driver squad. What you want to do here is check whether the driver squad is a medic squad. You do this with a requirement action for the unit type.
Then, to apply the popcap antenna to the ambulance, do a change_target_action (self) inside the requirement action, and spawn the antenna, if necessary.