📄️ Client events
Every built-in event the client fires to its scripts. Register a handler with Event.Add in any client or shared script; see Events for how handlers, cancelling and custom events work. Messages sent by the server with Net.SendToPlayer/Net.Broadcast are not events of this list, see Net.
📄️ Net (client)
Client scripts send events to the server with Net.Send; how remote events work, what can be sent and how to receive events with Net.AddEvent is on the shared Net page.
📄️ Commands
Client scripts can register named commands with the Cmd table, and run them by name with Cmd.Execute. Chat resources use this for "slash commands" any client script can execute them, for example from a key binding or a menu button. The server has no Cmd table: server console commands are built in and can't be extended by scripts, see Server console.
📄️ World (client)
On the client, the World table controls world-wide settings such as time of day, gravity, time scale and the map waypoint, and spawns purely local game objects.
📄️ Weather (client)
On the client, the Weather table strikes local lightning.
📄️ Local
The Local table holds actions that only make sense for the local player, the player running this client: playing animations and game actions on their character, unlocking abilities, enabling the hoverboard, moving their character directly and showing the scan view. To read information about the local player, get their character with World.LocalPlayer() and use the PlayerObjectHandle methods; see Players.
📄️ Client
The Client table describes the JC4MP client itself: its version, how long it has been running, and detailed statistics about its connection to the server. Use it for version checks, client-side timing, and network debug overlays.
📄️ Game
The Game table reports the state of the game itself (title screen, loading, in game...). Use it to wait until the game has finished loading before doing something that needs the world, or to tell whether the player is in a menu.
📄️ Game objects
Besides the synced network objects (players, vehicles, NPCs... reached through object handles), client scripts can hold direct references to objects inside this client's game: a point of interest on the map, a client-only rigid object, a water box, a force pulse, a player's character, a visual effect. These references are the usertypes on this page.
📄️ Input
The Input table reads the keyboard and mouse, turns the player's game controls off and on (for menus), reads and triggers the local player's game actions, and accesses the Windows clipboard.
📄️ Camera
The Camera table works with the game camera the player currently sees through: projecting world positions to the screen (for name tags, markers and other 2D overlays), reading its position, changing its field of view, and shaking it.
📄️ Render
The Render table gives the size of the game's drawing area and draws simple debug shapes into the 3D world. Use Render.GetSize to lay out webviews and convert between pixels and screen fractions, and Render.DrawSphere to visualize positions, radii and areas while building a script.
📄️ FX
The FX table plays the game's visual effects (fire, smoke, sparks, explosions' particles, impacts, water splashes, trails...) anywhere in the world. Use it for cosmetic feedback: a marker flare, an impact where a script-made shot lands, smoke over a capture point.
📄️ Sound
The Sound table plays your own audio files in the game: music, voice lines, UI sounds, or positional sounds placed in the world. You load a file shipped with your resource under a name of your choice, then play it as many times as you like. Every play returns a SoundChannel that controls that one playback (volume, pitch, pause, position).
📄️ Physics
The Physics table queries the game's physics world. Its raycast finds the first thing with collision along a line: the ground, buildings, props, vehicles, characters. Use it for line of sight checks, to find where a shot or a look ray lands, to snap things to surfaces, or to find which synced object the player is looking at.
📄️ Terrain
The Terrain table queries the island's ground (the heightmap terrain, not buildings or props) and lets you push the vegetation around. Use it to find the ground under a point without a physics raycast, for example to place objects or spawn points on the ground, and for cosmetic effects such as grass and trees bending away from a blast.
📄️ NavMesh
The NavMesh table reads the game's navigation mesh: the walkable surface the game's AI uses to find paths on foot. Use it to check whether a point is reachable on foot, to snap positions to walkable ground (for spawn points, NPC destinations or checkpoints), or to visualize the walkable area.
📄️ RoadGraph
The RoadGraph table reads the game's road graph: the network of roads, sea lanes, air routes, sidewalks and railways that the game's traffic follows (cars drive the land roads, civilians walk the pedestrian paths on the sidewalks). Use it to find roads near a point, to spawn vehicles or NPCs on roads and sidewalks, or to build routes.
📄️ Weapon
A weapon inside the game. Giving, removing and reading the weapons of players is done on the player objects instead (see Player), with weapon names from the weapons list.
📄️ GameUI
The GameUI table changes parts of Just Cause 4's own HUD: the region name shown on screen and the weapons display. For fully custom interfaces, use webviews instead.
📄️ Asset
The Asset table tells you whether a game asset (a model, a collision shape, an effect, a texture...) is currently loaded in the game's resource cache on this client. Just Cause 4 streams most assets in and out as the player moves around, and some spawn functions only work, or only look right, when the assets they need are already loaded. Check first with Asset.IsLoaded to avoid spawning invisible or collisionless objects.
📄️ UI and WebView
Every custom interface in JC4MP is a web page (HTML, CSS and JavaScript) rendered by an embedded Chromium browser and drawn over the game. The WebView table creates and controls these pages from a client script: where they sit on screen, whether they are shown, whether they take the mouse and keyboard, and how messages travel between Lua and the page's JavaScript. The small UI table holds the cursor helpers that go with them. The JavaScript side of a page is documented in WebView pages (JavaScript).
📄️ WebView pages (JavaScript)
A webview shows an ordinary web page (HTML, CSS and JavaScript, rendered by Chromium) on top of the game. This page documents what is available to JavaScript inside such a page: the window.JC4MP bridge object used to exchange messages with the resource's Lua scripts, how to reference the resource's own files, and the browser features that are restricted. Creating and controlling webviews from Lua is covered in UI and WebView.
🗃️ Objects
6 items
🗃️ Enums
10 items