RHS Feedback - AFRF
View Issue Details
0004712AFRF[All Projects] Generalpublic2018-10-28 03:002018-10-28 14:49
0004712: rhs_gripod.sqf assumes player always has primary weapon, can hang UI on opening arsenal
rhs_gripod.sqf installs handlers on the InventoryClosed and arsenalOpened events which throw script errors on line 31 when the player has no primary weapon. In the case of the arsenalOpened event, the Arma 3 UI will hang entirely, requiring a forced restart.

I'm not sure what these event handlers are for other than removing themselves, but they should at least be checking whether the player has a primary weapon.

I haven't checked whether other scripts have a similar problem. rhs_gripod.sqf exists in both AFRF and USAF in rhs_c_weapons.pbo.
To get a (harmless?) script error:
1. Equip weapon with grip pod.
2. Drop it on the floor from inventory.
3. Close inventory.

To get a UI lock:
1. In Eden Editor, create mission with "survivor" player (from independent faction) and arsenal with grip pod weapon inside. Enable respawn on death position.
2. Start mission as multiplayer.
3. Open arsenal, equip your grip pod weapon. Close arsenal.
4. Manually respawn. You should respawn with no weapons.
5. Now attempt to open arsenal. It should hang the UI on the arsenal loading screen.
No tags attached.
Issue History
2018-10-28 03:00jaj22New Issue
2018-10-28 09:08reyhardNote Added: 0008728
2018-10-28 09:08reyhardAssigned To => reyhard
2018-10-28 09:08reyhardStatusnew => feedback
2018-10-28 14:48jaj22Note Added: 0008733
2018-10-28 14:48jaj22Statusfeedback => new
2018-10-28 14:49reyhardStatusnew => resolved
2018-10-28 14:49reyhardFixed in Version => 0.4.9
2018-10-28 14:49reyhardResolutionopen => fixed

2018-10-28 09:08   
Can you post that error message here?
2018-10-28 14:48   
Sure, forgot to post that. From the RPT:

19:35:50 Error in expression <urrentMagazine _p;

_p addWeapon _t;
_p addMagazine [(primaryWeaponMagazine _p) >
19:35:50 Error position: <addMagazine [(primaryWeaponMagazine _p) >
19:35:50 Error Type Any, expected String
19:35:50 File \rhsafrf\addons\rhs_c_weapons\scripts\rhs_gripod.sqf [RHS_fnc_accGripod], line 31

I'm new to Arma scripting but it looks like primaryWeaponMagazine returns a zero-element array here, selecting the first element returns some sort of null (type Any?), and then addMagazine flakes out because the first parameter isn't a string.

It always seems to link RHSAFRF even if I'm using USAF weapons. That's probably not weird to anyone else.