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];
{F21820}
Description
Details
- Legacy ID
- 4108343290
- Severity
- Crash
- Resolution
- Fixed
- Reproducibility
- Always
- Category
- Scripting
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";
Copyclass.sqf:
private ["_array","_unit"];
_array = _this select 0;
_unit = [];
{_unit = _unit + [typeof _x];} foreach _array;
copyToClipboard format["%1",_unit];
hint "Classes copied!";
Event Timeline
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...
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.
http://feedback.arma3.com/how-to-user.html.html
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:
http://www.fungamer-2.net/downloads/ArmA3_error_nearestBuilding.zip
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 "wallside_crashfiles.zip"
Astaroth, the repro steps above are over complicated. Most of that script has nothing to do with the problem.
Clean Repro:
- In mission editor, create a new mission on Altis.
- Place the player as any soldier unit, anywhere on the map.
- Preview mission.
- Open debug console.
- In any watch field, type "myBuilding"
- In execute field, type "myBuilding = nearestBuilding player"
- On pushing enter, observe game hang or crash.
- If game has hung, wait several minutes. Game should return to normal operation, and the "myBuilding" watch field should contain an expected building object.
- 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.
- (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.
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.
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.