Arma-3-Survival icon indicating copy to clipboard operation
Arma-3-Survival copied to clipboard

Enemies Glitching through walls

Open TheMagicalKing opened this issue 3 years ago • 1 comments

Enemies glitch through walls despite an opening that's unaffected by any placeable structure.

How to replicate:

  • [find a construction site or any house that can be reinforced]

  • [reinforce the area with military walls leaving an opening]

TheMagicalKing avatar Jun 17 '21 19:06 TheMagicalKing

Here is how I fixed it:

  1. SaltyDog.abramia\Functions\Build\fn_placeObject.sqf line 74 add:
[[_object], 'bulwark\solidObject.sqf'] remoteExec ['execVM', 2];

Here is the file: https://pastebin.com/h5hJ8syD

  1. Create a folder in your mission directory and call it "bulwark". Add a file to it solidObject.sqf Your misson folder should look like SaltyDog.abramia\bulwark\solidObject.sqf

Add this code to solidObject.sqf

private ["_object","_isHeld","_loopCount","_foundAIArr","_objRadius","_nearAI","_isPlaced","_aiDir","_aiGoToPos","_safePos"];

_object  = _this select 0;
_isHeld = _object getVariable "BLWK_heldObject";
_loopCount = 0;
_foundAIArr = [];
while {!(_object isEqualTo objNull) && !_isHeld} do {
    if (_loopcount >= 20) then {
        _loopCount = 0;
        _foundAIArr = [];
    };
    _loopCount = _loopCount + 1;
    _objRadius = (_object getVariable "Radius") + 1;
    _nearAI = _object nearEntities _objRadius;
    _isPlaced = _object getVariable "BLWK_heldObject";
    {
      if (SUICIDE_WAVE && (alive _x) && (side _x == east)) then {
        _x setDamage 1;
        deleteVehicle _object;
      }else{
        if (side _x == east && !(_x in _foundAIArr) && (alive _x)) then {
          doStop _x;
          _x disableAI "MOVE";
          _aiDir = _object getDir _x;
          _x setDir _aiDir;
          _aiGoToPos = _object getRelPos [random [-10,0,-10], _aiDir];
          _x setBehaviour "CARELESS";
          _x setUnitPos "UP";
          _x playActionNow "FastF";
          _x forceSpeed 6;
          _safePos = [_aiGoToPos, 0, 8, 2, 0] call BIS_fnc_findSafePos;
          _x enableAI "MOVE";
          _x doMove _safePos;
          _foundAIArr pushBack _x;
        };
      };
    } foreach _nearAI;
    sleep 0.1;
};

All my ideas came from here: https://github.com/Omnomios/DynamicBulwarks/blob/8778abe4b939d15946f17a785b51ec021de8697e/bulwark/solidObject.sqf

aussie-battler avatar Aug 29 '21 08:08 aussie-battler