The Locality of Objects
By Spooner and Mandoble
The locality of an object determines which computer is the owner of this object. Many commands affect only to local objects, so the locality must be considered when we want to execute these commands over existing objects.
- The players: each player object is local to the corresponding client computer, or the server if server is not a dedicated one. Note that a dedicated server has no player, so the value of player on that machine is objNull.
- Group leaders that are not players (i.e. AI): local to the server.
- Any other AI soldier in a group: local to the computer where its leader is local.
- Empty vehicles: local to the server.
- "Empty" objects, such as ammo-boxes, which have been placed in the editor: local to the server.
- Occupied vehicles: local to the machine where the vehicle's driver is local.
- Gamelogics created within the editor or with createVehicle: always local to the server.
- Units created with createVehicleLocal: local to the client or server that executed the command (note that gamelogics might be created that way also). In many cases you might want to use gamelogics inside your scripts just for distance or angle calculations, and some of these scripts might be executed only by players (for example through an action menu). For these cases you don't need to create logics that are local to the server, but just local to the machine where the script is executed, so you may use createVehicleLocal command to create these logics and delete them, when they are not needed anymore, with the deleteVehicle command.
As can be seen, the locality of a unit might change during a game. For example, player A is driver of car B, so car B is local to the computer of player A. When player A gets out then car B will become local to the server. When player C becomes the new driver, the car will become local to player C's computer. The same goes for units which change groups or whose group leader changes.