Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mechanized infantry shoots friendly units that start firing their weapon #314

Closed
blake8090 opened this issue Mar 14, 2022 · 3 comments · Fixed by #321
Closed

Mechanized infantry shoots friendly units that start firing their weapon #314

blake8090 opened this issue Mar 14, 2022 · 3 comments · Fixed by #321
Labels

Comments

@blake8090
Copy link

Mods (complete and add to the following information):

  • Arma 3: 2.08.148892
  • CBA: 3.15.6
  • LAMBS_DANGER: 2.5.4 dev

Description:

Suppose a unit is next to a separate group of friendly infantry with an armored vehicle (APC or tank).
When the unit starts shooting, the armored vehicle will order the infantry to shoot and kill the unit, despite being on the same side.

Steps to reproduce:

  • Open Eden editor and select any terrain
  • Place a rifleman (as player)
  • Place another rifleman and any APC or tank and group them together. They should be the same side as the player
  • Start the scenario
  • Start shooting anywhere while moving
  • Soon the friendly AI will start shooting at the player

Expected behavior:

When a friendly unit starts shooting, nearby friendly mechanized infantry should not target that unit.

Where did the issue occur?

  • Singleplayer

Additional context:

  • This occurs with all units of any side
  • Interestingly enough, mechanized units will not shoot civilians

Videos:

Below is a link to a video showing how to reproduce this issue:
https://imgur.com/a/2lzAbrR

@blake8090
Copy link
Author

Looks like I don't have write access to push a branch and open a pull request, but here's some notes on the technical fix:

Within fnc_brainVehicle.sqf, there's a block of code beginning on line 147 which has armored vehicles tell any available infantry in the group to engage enemy units:

// foot infantry support
private _units = [_unit] call EFUNC(main,findReadyUnits);
if !(_units isEqualTo [] && {_unit knowsAbout _dangerCausedBy < 2}) then {
    {
        _x setUnitPosWeak "MIDDLE";
        _x doWatch _dangerCausedBy;
        _x doTarget _dangerCausedBy;
        _x doFire _dangerCausedBy;
    } foreach _units;
};

The fix would be to add a check for the side before telling units to shoot. For example:

// foot infantry support
private _units = [_unit] call EFUNC(main,findReadyUnits);
private _validTarget = side _unit isNotEqualTo side _dangerCausedBy;
if (_validTarget && !(_units isEqualTo [] && {_unit knowsAbout _dangerCausedBy < 2})) then {
    {
        _x setUnitPosWeak "MIDDLE";
        _x doWatch _dangerCausedBy;
        _x doTarget _dangerCausedBy;
        _x doFire _dangerCausedBy;
    } foreach _units;
};

@nk3nny
Copy link
Owner

nk3nny commented Jun 8, 2022

Excellent find and repo!

nk3nny added a commit that referenced this issue Jun 8, 2022
… weapon

Fix Mechanized infantry shoots friendly units that start firing their weapon
Fix Vehicles jinking to own side shooting(!)

Reference: #314

Thanks blake8090
@nk3nny
Copy link
Owner

nk3nny commented Jun 8, 2022

#321

nk3nny added a commit that referenced this issue Jun 8, 2022
… weapon (#321)

Fix Mechanized infantry shoots friendly units that start firing their weapon
Fix Vehicles jinking to own side shooting(!)

Reference: #314

Thanks blake8090
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants