JC4MP Forum
Help with conditional UI scripts
Hugom2
Anarchic Toy VehicleSo 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).
SPAG33TI
Vast Challengeumm, 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?
Hugom2
Anarchic Toy VehicleThey only appear to someone on the server when I restart the resource, or to myself because I'm hosting it
Hugom2
Anarchic Toy VehicleFor instance: a POI marker that is invisible to other people joining the server, until I restart the resource
Hugom2
Anarchic Toy VehicleOr a revive prompt that doesn't appear until I've restarted it after someone joined
Hugom2
Anarchic Toy VehicleIn 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
SPAG33TI
Vast Challengesounds like a scripting problem