Where script files, and scripts input into the editor, are executed
By Spooner and Mandoble
In many situations we must execute a script or command only once, not in every machine connected, or we must execute some code only there were a particular unit is local, or only in the server. To start with, let's see where the code is executed by default:
- Menu actions are executed only in the machine where the action is activated. That is, where the unit that activated the action is local.
- Triggers other than radio ones: the activation and deactivation code is executed on every machine connected where the condition is met.
- Waypoint activation commands are executed when the leader of the moving group is local.
- Eventhanders: in some cases they are executed globally, in others, locally. But always make sure the corresponding addEventHandler is executed on every machine, included any dedicated server.
- Code in init field of editor-placed units: executed on every machine, at game start, or when it joins the game (JIP).
- Code in init.sqf or init.sqs files: executed in every machine connected.
- Scripts executed from another script: executed there were the parent script is being executed.