Accessing cgame from UI (without Cvars)

Hi !

I have a modding related question :
I’m making an inventory system, and the inventory is stored in cg.predictedPlayerstate (.inventory, int inventory[16]).
I would like to access this from my inventory screen, which is a classic UI screen.

I’ve seen some tools to get some Cvars values, but I haven’t found anything that looks in the cg structure.

Is what I’d like to do even possible ?

You cannot access it directly. (Certainly not with qvms, or without serious modifications to how cgame and ui are handled in the engine) You will have to send the data somehow. EG cvars or trap_SendServerCommand with sv_floodProtect 0.

If you are using the Team Arena menu (code/ui) as opposed to (code/q3_ui) code, you may be able to have the menu handling in cgame as well.

Allright, Thanks a lot !
I prepared myself for that solution - which will be much heavier that what I thought before, but nevermind :slight_smile:

Reading/writing from a file is also a possibility. Like a cache of the inventory for UI.