Only models defined in archetype files that are declared as PERMANENT_ITYP_FILE
or DLC_ITYP_REQUEST
are always available - any other models are subject to dynamic loading and are technically not intended to be used from script.
In your case, v_res_tre_storagebox
is defined in platform:/levels/gta5/interiors/int_props/int_residential.rpf:int_residential.#typ
, which is not such a permanently-loaded file.
The reason it works when you’re in some locations is because at such locations, you’re within the streaming bounds of a .#map
file which has a dependency on this .#typ
file.
As to a solution, at this time there’s no function to manually request a .#typ
file to be loaded from script. You could technically define it as a DLC_ITYP_REQUEST
, but this’d have other side effects (getting closer to hitting the 65k archetype limit as described in Too many archetypes leading to LOD/SLODs displaying - #3 by d-bubble), or you could duplicate both the model and the archetype definition into your own resource (with a different name, or you’d hit the duplicate archetype issue as described in LOD / SLOD Texture issues - #59 by lugubrious_loompa), so this is very easy to get wrong and the side effects of getting it wrong tend to suck.
Since this is intended base GTA behavior and not a bug, this topic has been moved out of Bug reports and into Discussion.