Page MenuHomeFeedback Tracker

[DEV] 'unknown enum value "local"' error when calling BIS_fnc_objectVar
Closed, ResolvedPublic

Description

I'm running the latest version of the Arma3 development branch and haven't seen this issue in a previous Arma3 version.

When calling BIS_fnc_objectVar on objects of certain types i get the error

Error in expression <object setvehiclevarname _var;
_object addeventhandler ["local",{[[_this select>
Error position: <addeventhandler ["local",{[[_this select>
Error Foreign error: Unknown enum value: "local"
File /temp/bin/A3/Functions_F/Objects/fn_objectVar.sqf..., line 53

So far this happened only on objects of the following types:

UnderwaterMinePDM_Range_Ammo
DemoCharge_Remote_Ammo_Scripted
ClaymoreDirectionalMine_Remote_Ammo_Scripted
ATMine_Range_Ammo
APERSMine_Range_Ammo
SLAMDirectionalMine_Wire_Ammo
BombCluster_01_UXO1_Ammo_F

Details

Severity
Minor
Resolution
Not A Bug
Reproducibility
Always
Operating System
Windows 7 x64
Category
General

Event Timeline

Ron4Swat created this task.Apr 15 2023, 5:36 AM
Ron4Swat changed Operating System from Windows 10 x64 to Windows 7 x64.
TRAGER added a subscriber: TRAGER.Apr 15 2023, 6:52 AM
This comment was removed by BIS_fnc_KK.
This comment was removed by phathai8tuantuoi.

This is the correct behaviour as you are trying to add entity event handler to projectile https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Projectile_Event_Handlers

BIS_fnc_KK closed this task as Resolved.Apr 15 2023, 10:29 PM
BIS_fnc_KK changed Resolution from Open to Not A Bug.
Ron4Swat added a comment.EditedApr 16 2023, 1:30 PM

But i'm not trying adding the "local" event to the object myself, i'm just calling BIS_fnc_objectVar, and inside Arma3 code (/temp/bin/A3/Functions_F/Objects/fn_objectVar.sqf..., line 53) its attempted to add the event.

P.S. Confirmed by checking BIS_fnc_objectVar in Eden Function Viewer.

OK, let me explain. "local" even is for objects classed as "entity", you are passing the object classed as "shot", which is what projectiles and mines are. Shots don't have "local" EH hence you get no EH error. This is not a bug.

BIS_fnc_objectVar is suppossed to give me back a string name for a object. That it requires a "entity" object and does not support "projectile" objects is not obvious, especially as that kind of differentiation doesn't seem to exist in sqf, at least to my knowledge.

Is there even a way in sqf to detect if a object is a "projectile" or a "entity"?

Shouldn't BIS_fnc_objectVar at least itself detect if the object is a proper one and only add the "local" event if the passed object is of the proper kind?

That it requires a "entity" object and does not support "projectile" objects is not obvious

BIS_fnc_objectVar is a script function, scripts do not know what type of object it is just that it is an object. I am telling you the cause of the error, now you know too so you can avoid passing unsupported objects