武装突袭3

武装突袭3

MGI ADVANCED MODULES
Suggested Code Improvement/Fix
Hey! Fantastic set of functions and modules here, they are really helpful for mission making and not having to reinvent the wheel in .sqf :D

One issue I found: The one-man tank script doesn't always work for certain APCs, like the BTR-60 from Global Mobilization. Additionally, it doesn't support cars with mounted weapons systems the BTR-40 (ZPU-4) or Hunters/Qilins, etc.

The problem is here in Line 76 of fn_module1Man.sqf:
"if (_veh1Tk isKindOf 'tank' or _veh1Tk isKindOf 'Wheeled_APC_F') then {"

This misses some of the gunner positions and naming schema (for example in the Config browser, BTR-60: ["gm_gc_army_btr60pb","gm_gc_army_btr60pb_base","gm_btr60pb_base","gm_btr60_base","gm_wheeled_APC_base","gm_wheeled_base","Car_F","Car","LandVehicle","Land","AllVehicles","All"])

Rather than checking the class, you can check if it has any turrets:

private _hasDriver = count (fullCrew [_veh1Tk, 'driver', true]) > 0;
private _hasTurrets = count (allTurrets _veh1Tk) > 0;

if (_hasDriver && _hasTurrets && !(_veh1Tk isKindOf 'Air')) then {

I tested this version with a several armed cars, APCs, and tanks, spanning the vanilla and CDLC vehicles, and it seems to work fine (although you can drive the vehicle from literally any seat). This functionality works well for me and my friends, as we typically only have 4-7 players and need the flexibility of operating vehicles solo without having to fuss with commanding the AI.

For vehicles that do not have any mounted weapons, you still need to use the driver's seat to control the vehicles. The logic check could be expanded to include "or _veh1Tk isKindOf 'Car_F'" or similar to extend the functionality to unarmed vehicles.

Additionally, the !(_veh1Tk isKindOf 'Air') I included in my implementation because I haven't had the chance to yet test with helicopters and aircraft for stability/functionality.

Anyway, I figured I'd let you know in case you'd like to update your mod to incorporate this. Feel free to DM me if you have any other questions.
最后由 Spenglerian 编辑于; 13 小时以前