Preview of JC4MP with tornado
Just Cause 4 Multiplayer Mod logo.

JC4MP Forum

This forum is a read-only mirror of the JC4MP Discord server. To participate in the forum, please join the Discord server.

Help with conditional UI scripts

Avatar for Hugom2 H

Hugom2

Anarchic Toy Vehicle
5d ago

So I have problem with a bunch of client UI scripts that I can't get to work properly. Basically:

  • UI that's always loaded works fine for everybody. Like: a health bar on top of the screen, or an inventory that you open on the press of a button.

  • UI that only works on a certain condition is problematic. This could be a prompt appearing when you are close to a certain coördinate, or a respawn menu showing when the player has died. Anything that can't be accessed or seen at any time.

  • As the player who hosts the server, conditional UI works fine for me. It also works for other players, but only when I reload the resource while the players are already in the server. Otherwise, they can't see any of this UI.

Also possibly important: all of these scripts rely on a shared file that contains a list of locations with coordinates and such. They are part of the same resource, so when I reload the client scripts, I also reload this shared script.

Does anyone know if there's some kind of trick to make client UI scripts like that work automatically when players join the server? I tried a bunch of stuff like onplayerjoin or onresource start, and some other ways to make the client wait, but nothing I try has any effect (or makes it worse).

Avatar for SPAG33TI S

SPAG33TI

Vast Challenge
5d ago

umm, i still don't understand what is the purpose you are trying to achieve. so you have a imgui UI that is supposed to render only under certain conditions? but they don't?

Avatar for Hugom2 H

Hugom2

Anarchic Toy Vehicle
5d ago

They only appear to someone on the server when I restart the resource, or to myself because I'm hosting it

Avatar for Hugom2 H

Hugom2

Anarchic Toy Vehicle
5d ago

For instance: a POI marker that is invisible to other people joining the server, until I restart the resource

Avatar for Hugom2 H

Hugom2

Anarchic Toy Vehicle
5d ago

Or a revive prompt that doesn't appear until I've restarted it after someone joined

Avatar for Hugom2 H

Hugom2

Anarchic Toy Vehicle
5d ago

In terms of purpose (the reason this UI is conditional): I can't show a prompt to open a location menu when you're not at that location, or show all POI markers wherever you are, because they your screen will be filled, or show a revive prompt in the middle of your screen when you're not dead. The way all of these work is fine for me, and fine for other players after I've restarted the resource, but by default this UI doesn't appear to any other player besides me and I do not know how I can fix that

Avatar for SPAG33TI S

SPAG33TI

Vast Challenge
5d ago

sounds like a scripting problem