The GTG Safe Zone mod is published under the Arma Public License (APL)Example code is free to useSuggestions: Discord to the author
GTG Safe Zone
Limits and pitfalls
Almost every item here is a thing that works on your own machine: in singleplayer and in the Workbench the server and the client are one machine, and the question of who knows what is never asked.
In plain wordsThe short list: what the zone cannot do, and what looked fine in the Workbench until a dedicated server ran it.
Limits
| Limit | What to do about it |
|---|---|
| Vehicle turrets still fire | An engine limit. The shot goes off; the hit costs the shooter and the vehicle their protection. See Shooting from inside. |
| The action lock runs on the client | Treat it as feedback. The damage check on the server is the enforcement. See Blocking actions. |
| A shape the angle sort cannot order | A U or a star with deep notches: give every point of that zone an explicit order number. |
| Enemy AI in a zone without an owner is invulnerable | No owner means no enemy. Give the zone an owner, or let it find one in a base inside it. |
| Healing is never blocked | By design. The zone prevents harm and does not heal, so medics stay relevant. |
| Game Master damage is blocked too | Switch the zone off for a moment to kill somebody on purpose. |
| Throwing by AI | Blocking was confirmed for the player's input path. Whether AI uses the same path for grenades could not be confirmed without a running game. Test it. |
| Settings of a zone built in the Game Master do not survive a restart | The shape does, rebuilt from the point positions. For a permanent zone, build it into the world, where the settings sit on the prefab. |
Pitfalls that cost time
PitfallThe outline order is not a property of the points. Creation order, network delivery order and restore order after a restart are all different from each other, and none is guaranteed. Derive the order from the positions, or let the server decide it and replicate the result.
PitfallAnything built from entities is built once, on the server. A client that builds its own copy gets its own result. The first dedicated-server run showed three shapes for three players.
Pitfall
new fills in no attribute defaults. The editor attribute decides through a field (m_bIsServer) whether a change is sent to the server, and the serialiser sets that field's default. Attributes created in code with new never get it, so the dialog wrote every change on the client only and the server never had an owner for the zone. Three apparently separate faults – invulnerable enemy AI, no weapons released on alarm, a switch that did nothing – were one cause. Prove it in the log: the client reports the value set while the server reports the zone without an owner.PitfallDebug drawing is not for players. Lines drawn with the debug shape interface show in the World Editor and in diagnostic builds, not on a retail client. A feature built on them never worked in the game. Draw on the map instead.
PitfallThe returned shape object keeps the line alive. If you throw it away, the line is collected in the same frame. Use the once flag for lines drawn every frame.
PitfallA
const inside a class has to be static. Diagnostic switches and timings belong in static const members, and diagnostics belong off in a released build, or the log fills up in the first firefight.PitfallToLower() changes the string it is called on. Copy before you compare names.
Measured, not guessed
These numbers were taken on a live dedicated server, not reasoned out. The outline was identical for two clients standing in different places, and unchanged across a server restart with persistence. The alarm replicated in roughly half a second. The hold time kept to the configured sixty seconds. Forfeiting protection worked, and infantry weapons were blocked inside the zone. Vehicle turrets still fired, which is the known limit.