nearestBuilding crashes the game with Altis
Closed, ResolvedPublic


Everytime I try to copy building class with this code, the game halts so that it needs to forced to shut down. The same identical code worked with Stratis without problems. Also other nearestObjects-type command seem to be unstable with Altis. Including NearestObjects [player, ["house"], 200];


Legacy ID
Steps To Reproduce

Use this code, e.g. next to the tower fortress building (even I think it crashes the game everywhere).

_nul = nearestBuilding getposATL thistrigger execVM "copyclass.sqf";

private ["_array","_unit"];
_array = _this select 0;
_unit = [];
{_unit = _unit + [typeof _x];} foreach _array;
copyToClipboard format["%1",_unit];
hint "Classes copied!";

SaOk edited Steps To Reproduce. (Show Details)Aug 31 2013, 5:15 PM
SaOk edited Additional Information. (Show Details)
SaOk set Category to Scripting.
SaOk set Reproducibility to Always.
SaOk set Severity to Crash.
SaOk set Resolution to Fixed.
SaOk set Legacy ID to 4108343290.May 7 2016, 4:25 PM

confirmed, seems to only happen on Altis

Curetia added a subscriber: Curetia.May 7 2016, 4:25 PM

confirmed and yes it is only on Altis

It seems almost all of the nearest commands (nearestObject,nearestBuilding) are broken so they crash the game. Even more strange is that not everybody has the issue. Some people only get lag, others have the whole game crash back to the desktop. This problem is ONLY on Altis. On Stratis the command works as it should with no issues. It never shows any errors, nothing. Theres nothing in the RPT log. I think they might be something if the game creates a dump file somewhere...

ceeeb added a comment.Sep 2 2013, 2:26 AM

Confirmed, although nearestBuilding only causes Arma3.exe to hang for several minutes (it becomes unresponsive, stuck at 0 FPS, CPU load 100% on one core). When it finishes, the command returns the expected result and the game returns to normal.

I have not had any problems with nearObjects, nearestObject or nearestObjects.

I ran into this problem today during development as well.
No problems testing on Stratis.
Also Nou reports "nearEntities is fairly quick"

We need dxdiag and files from this folder for solve your problem. C:\Users\<Name>\AppData\Local\Arma 3\
Can you upload somewhere in winrar package please?
When package will be smaller than 2,097k, so you can attach here. When package will be bigger, please use some free sharing service and post link here. Thank you.

I wanted reproduce this crash, but game didn't crash me and when I use example from Steps the reproduce, so I have this errror:
Error in expression <0;
_unit = [];
{_unit = _unit + [typeof _x];} foreach _array;
copyToClipboard fo>

Error position: <_x];} foreach _array;

copyToClipboard fo>

Error Undefined variable in expression: _x

File C:\Users\astaroth\Documents\Arma 3\missions\copy_test.Altis\copyclass.sqf, line 4

Ok I have done what you explained and here is my file:

I placed myself on Altis and entered "nearestBuilding player" in the Debug console.
After pressing Enter game froze (i killed it after 1min).
Dxdiag and rpt file appended as ""

ceeeb added a comment.Sep 5 2013, 12:51 PM

Astaroth, the repro steps above are over complicated. Most of that script has nothing to do with the problem.

Clean Repro:

  1. In mission editor, create a new mission on Altis.
  2. Place the player as any soldier unit, anywhere on the map.
  3. Preview mission.
  4. Open debug console.
  5. In any watch field, type "myBuilding"
  6. In execute field, type "myBuilding = nearestBuilding player"
  7. On pushing enter, observe game hang or crash.
  8. If game has hung, wait several minutes. Game should return to normal operation, and the "myBuilding" watch field should contain an expected building object.
  9. Repeat steps from 1, using Stratis instead of Altis. Note the game does not hang or crash, the nearestBuilding command returns the result near instantly as expected.
  1. (optional) Repeat all 9 again steps using other commands in place of nearestBuilding (nearObjects, nearestObject, etc). I can not personally create any problems with these commands, but others have reported having similar hangs.

Thank you for clearer repro steps.

Dunno if this helps, I have noticed that when nearestBuilding executed for the first time it takes longer then when it is executed subsequently. It is almost as the game caches the buildings around player. Because Altis is so big could this be the cause?

Re-confirmed - it has killed all the scripts that spawn AI in buildings, which is a huge problem for mission-making for me.

Can repro with the following in unit init:
this setPos ((nearestBuilding this) buildingPos 1)

This really needs to get fixed, it ruins a lot of scripts.

Executing nearestBuilding freezes my game for 30-60 seconds then it runs again.

Still present in release version.

Seems fixed with todays update.

This still happens for me.

Would adding a parameter for the radius of the area searched like nearObjects has fix this?

This is fixed in dev branch but not in stable for me. I haven't tested it fully, but as of the last update to dev branch, my scripts started working again. Went back to stable and got the same crash I used to get.

Fix is in dev version now only. Fix for stable version will be in first patch.

Confirmed fixed for me on 03.110218 dev branch using ceeeb's repo steps.

SaOk added a subscriber: SaOk.May 7 2016, 4:25 PM
SaOk added a comment.Sep 21 2013, 12:14 AM

Thanks for the fix (working instantly now, so far). :)

Add Comment