Zones and utility grids
The Combat plugin's gameplay zones with membership events and rules, and power or water networks of utility nodes.
Both systems come with the Combat, Interaction & RPG plugin (off by default; enable it in the Plugins window). Engine/Plugins/Combat/Combat.mplugin
Zones
A zone is a named region of the level made of one or more box or sphere volumes. Place an AZoneActor, or add a Zone component to any entity. Volumes are axis-aligned.
| Field | Meaning |
|---|---|
zoneId | Volumes with the same id form one zone |
displayName, zoneTypeTag | A name for UI and a free-form type such as safe, hostile or interior |
shape, halfExtents, radius | The volume |
priority | Where volumes overlap, the highest wins, then the smaller |
noCombat | Weapons and melee refuse to fire or attack inside |
noBuild | Building placement is refused inside |
ambienceId | Selects the music score's ambience bed; see Music and mixing |
statusEffectId | A .statuseffect applied while inside and removed on leaving |
Characters join zones automatically. When an entity's zone changes, the zone system fires OnZoneLeft and OnZoneEntered, and the ZoneLeft and ZoneEntered events on the entity's Visual Scripting graph.
Touching zones form a room graph: GetZoneNeighbors(zoneId) lists neighbors and FindZonePath(from, to) returns the chain of zones between two, for AI and level logic.
MZoneStatics offers GetPlayerZone, IsInZone, CountEntitiesInZone, IsPlayerCombatBlocked and GetZoneTypeTag.
Utility grids
Utility grids are power or water networks of placed nodes, for base-building and factory games. Place an AUtilityNodeActor, or add a UtilityNode component.
| Field | Meaning |
|---|---|
gridType, customGridTag | Power, Water or Custom; different grids never mix |
role | Producer (supplies capacity), Consumer (draws demand) or Conduit (a link) |
connectionRadius | Two nodes connect when their distance is within the larger radius |
fuelItemId, fuelBurnTime | An item a producer burns from its inventory, one unit per burn time; out of fuel means no output |
Connected nodes form networks. In each network, supply is shared among consumers smallest demand first, and a consumer is powered only when its whole demand fits. Networks rebuild when nodes move, appear or disappear. The system fires OnNetworkPowered, OnNetworkUnpowered and OnNodePowerChanged, with matching Visual Scripting events on the nodes.
A crafting station with requiresPower only crafts while a powered node is nearby. See Interaction and inventory.
MUtilityStatics offers IsNodePowered, GetNetworkSupply, GetNetworkDemand and GetNetworkCount.
Related
- Survival and economy
- Abilities, health and damage for status effects
Engine sources
This page describes behavior implemented in these files of the engine repository, checked against commit 5922e6e5e.
- Engine/Plugins/Combat/Combat.mplugin