Skip to main content
Everything needed to drive fog of war from another resource: reveal an area as a quest reward, check whether a player has been somewhere before offering them something, and react to first-time discoveries.
Every export is framework-neutral. The same call behaves identically on VORP and on RSG, because all framework access goes through the built-in bridge.

Conventions

Server exports are called as exports.dd_fogofwar:Name(...) from any server script and take the player’s source as their first argument. Mutating exports return a boolean: false means the player had no resolvable character, or the region name was unknown. Client exports are called as exports.dd_fogofwar:Name(...) from a client script and take no source.

Server exports

RevealArea

Reveals a circular area and writes it to the database, so it survives relogs and restarts. This is the export to use for treasure maps, cartography rewards and story unlocks.
radius is in world units. The circle is decomposed into explored cells at Config.CellSize resolution, so very small radii snap to at least one cell.

RevealRegion

The same thing by name, using a region already defined in Config.Discoveries.regions. Keeps the coordinates in the config instead of spread across your scripts.
Returns false and logs a debug line if no region with that name exists.

ResetPlayer

Wipes every stored chunk, the full-reveal marker and all discovery records for that owner, then resets the client’s fog immediately.
This is destructive and takes effect at once. Under PersistenceMode = 'account' it wipes the progress of every character on that account, not just the active one.

IsExplored

Checks a world position against the player’s stored exploration. Useful for gating: only offer a fast travel destination, a delivery job or a map marker for places the player has actually been.
This reads from the database on every call, so it is not something to run in a loop. Check once when a menu opens or a job is offered, not per frame.

GetExploredPercent

The share of the playable map the player has uncovered, as a number between 0 and 100. Returns 100.0 for a fully revealed map without counting cells.
The playable area is derived from Config.MapBounds, so a custom map needs those bounds adjusted for the number to mean anything.

Client exports

IsExplored on the client answers from the cached grid, counts Config.PreRevealedZones as explored, and returns true for everything while the map is fully revealed or while the resource is inactive. It is cheap enough to call per blip or per marker, which is exactly what the blip manager integration does.

Events

dd_fogofwar:discovered

A server event, fired once per character the first time a discovery happens. Both zone discoveries and custom regions use it.
Zone keys are defined in shared/zones.lua. Custom region keys are whatever you set as name in Config.Discoveries.regions.
Zone keys come straight from the game and their casing is not consistent: town:valentine and town:Rhodes and town:StDenis all coexist. Copy the exact key out of shared/zones.lua instead of guessing it from the label.
The event fires after the discovery has been recorded, so it will not fire again for that character on a relog. Rewards configured in Config.Discoveries are paid by the resource itself; use this event for anything beyond money and items.

Blip integration

Config.HideBlipsInFog wires fog of war into the free DD Blip Manager companion resource. On character load, fog of war registers a rule with the blip manager that hides any blip sitting on an unexplored cell, and refreshes it whenever the fog state changes. If you build your own visibility logic on top, the blip manager exposes SetRuleEnabled, RegisterRule and Refresh for exactly that. Fog of war owns the rule named fow; register your own under a different name rather than overriding it.