Multiplayer
78 scripting commands. Also as Markdown for agents.
- addMPEventHandlerAdds a multiplayer event handler (EH) to the given object and returns EH handle. See Event Handlers.
- addPlayerScoresMP server only: Adds player score.
- addPublicVariableEventHandlerThis event handler will detect if a missionNamespace variable (it is attached to) has been broadcast over network with publicVariable,…
- addScoreAdds a number to the score of a unit. Negative values will remove from the score.
- addScoreSideAdds side score. This is shown in the MP score tab as the total score. MP only.
- adminThis is dedicated server command, which queries the admin state of any client on the network by their client (owner) id.
- allPlayersReturns a list of all units controlled by connected clients. This includes: - Normal human players (including dead players) - Virtual Entities (see…
- allUsersReturns a list of player ids of all the users on an MP server.
- clientOwnerReturns the machine network ID of the client executing the command.
- didJIPChecks if the current client Joined In Progress.
- didJIPOwnerChecks if the current owner of supplied Object Joined In Progress. Returns false on clients.
- disableRemoteSensorsThis command will halt raycasting calculations (on the local machine only) for all groups which don't contain *any* local entities.
- estimatedEndServerTimeEstimated end of MP game in seconds converted to serverTime.
- estimatedTimeLeftSets the estimated time left in the game that is shown in the "Game in progress" screen or in the master browser.
- exportJIPMessagesCreates a log file containing an overview on all JIP (network) messages currently in the JIP queue. The file is created in the same directory as .rpt…
- forceRespawnForces the unit to respawn. The effect is as if the player pressed the RESPAWN button in the game pause menu; the unit is killed but there is no "X…
- getClientStateReturns client state in network game. Works on both, client and dedicated server. The following states are possible:
- getClientStateNumberReturns client state in network game. Works on both, client and dedicated server. The following states are possible:
- getPlayerIDReturns user DirectPlay ID, which can be used with getUserInfo, and is found in allMapMarkers results and in some mission event handlers such as…
- getPlayerScoresReturns the unit's table of scores (infantry kills, soft vehicle kills, armor kills, air kills, deaths, total score) in multiplayer or an empty array…
- getPlayerUIDReturn a UniqueID of the given unit (player).
- getRespawnVehicleInfoReturns various properties for the respawning vehicle (see Vehicle Respawn). All properties are synched over the network and should be the same on…
- getServerInfoGet the current server instance's settings from server config.
- getUserInfoReturns extended information about given server user.
- getVariableReturns the value of variable in the variable space assigned to various data types. All available data types combinations:
- groupFromNetIdGet group from the provided unique ID. For objects, use objectFromNetId.
- groupOwnerReturns the machine network ID of the client to which the group is local. This command only works when called from the server. When called from a…
- hasInterfaceReturns true if the computer has an interface (a real player). False for a dedicated server or for a headless client.
- hostMissionHost the multiplayer mission defined in the config class and opens the lobby with the scenario loaded. Must be called in UI action from a dialog.
- isDedicatedReturns true if the machine executing the command is a dedicated multiplayer server. Returns false in single player.
- isMultiplayerReturn true if multiPlayer.
- isMultiplayerSoloReturns true when playing a game in solo multiplayer (for example Apex coop campaign PLAY SOLO option).
- isPlayerChecks if given person is a player. Returns true for headless clients as well.
- isRemoteExecutedReturns true if the code context is being remote executed by remoteExec or remoteExecCall. In SP always returns false. See also isRemoteExecutedJIP:
- isRemoteExecutedJIPReturns true if the code context is being remote executed from the JIP queue by remoteExec or remoteExecCall (when JIP param was set). It is a subset…
- isServerReturns true if the machine executing the command is the server in a multiplayer game or is running single player. It will return true for both…
- localCheck if given unit is local on the computer in multiplayer games - see Multiplayer Scripting#Locality.
- localNamespaceReturns local Namespace attached to the mission. Has the same lifetime as missionNamespace but variables cannot be broadcasted out of or into this…
- logNetworkRegisters new log file recording a network traffic and returns handle of the log. The log file is saved inside the Arma 3 root folder.
- logNetworkTerminateTerminates a network log file started with logNetwork with the given handle
- netIdGet the unique ID of an object or a group.
- objectFromNetIdGet object with given unique ID. For groups, use groupFromNetId.
- onPlayerConnectedThis command will execute the provided code on the server whenever a player connects to a multiplayer session.
- onPlayerDisconnectedThis command will execute attached code whenever a player is leaving an MP session. The code will receive a number of special variables:
- ownerOn server machine, returns the machine network ID of the client to which the object is local. Otherwise returns 0. For use on clients clientOwner…
- playableSlotsNumberReturns the number of available slots in mission per side (both empty and taken). In singleplayer mission, it returns number of playable units per…
- playableUnitsReturns a list of playable units in a multiplayer game (occupied by both AI or players), created on the following sides east/opfor, west/blufor,…
- playerRespawnTimeReturn the player's remaining time before respawn, or -1 if it is not available (such as when the player is alive).
- playersNumberReturns count of occupied role selection slots for given side. Players who claimed a slot in the lobby but did not start the mission are counted as…
- publicVariableReliably broadcasts missionNamespace variable and its current value to all computers (server/client).
- publicVariableClientSend the variable value to the client computer - same limitations regarding variable type as publicVariable.
- publicVariableServerSend the variable value to the server - same limitations regarding variable type as publicVariable.
- remoteExecAsks the server to execute the given function or script command on the given target machine(s). - Functions are executed in the scheduled…
- remoteExecCallUnscheduled version of remoteExec. The only difference between remoteExec and remoteExecCall is that remoteExecCall will run functions in unscheduled…
- remoteExecutedJIPIDReturns JIP ID of the persistent call generated from JIP queue for the joining player (see remoteExec).
- remoteExecutedOwnerReturns the machine network ID of the client that initiated Remote Execution.
- removeAllMPEventHandlersRemoves all MP event handlers of the given type which were added by addMPEventHandler. Command needs to be executed only on one PC for MP event…
- removeMPEventHandlerRemoves MP event handler added by addMPEventHandler.
- removeSwitchableUnitRemove a unit from the list of units available for Team Switch.
- respawnVehicleSets vehicle as respawnable in MP game (see Vehicle Respawn). The vehicle will be spawned at the locality and coordinates it was prior to destruction.
- roleDescriptionReturns unit description set in the editor and visible on role selection screen in multiplayer.
- scoreReturns the person's score in MP.
- scoreSideReturns score for the given side. MP Only.
- selectPlayerMove player into given unit. Some usage advices: - Avoid using selectPlayer on editor-placed units in multiplayer, as it may, on occasion, lead to…
- sendAUMessageSend the command to the list of clients.
- sendUDPMessageSend message to given address using UDP protocol. Returns false if the message has not been delivered
- serverCommandExecutes the given server command. Requires you to be logged-in admin as client to execute on a client, or provide the serverCommandPassword with the…
- serverCommandAvailableReturns true if given serverCommand is available on current machine, false if not.
- serverCommandExecutableReturns true if the serverCommand can be performed on the machine and in this exact environment, otherwise false.
- serverNameReturns name of the hosting server in MP, "" in SP.
- serverNamespaceReturns server's namespace. This namespace is only available on the server for the server's uptime duration (same as uiNamespace).
- serverTimeReturns the time since latest server (re)start in seconds.
- setGroupOwnerChanges the ownership of a group (and all its units) to a given client. The group leader must not be a player. This command only works when called…
- setOwnerFrom server machine, change the ownership of an object to a given client. Using command in an unintended way will log a message to .rpt file.
- setPlayableCreate a multiplayer role for the unit. The roles created this way are used for Join In Progress and Team Switch.
- setPlayerRespawnTimeSets the time interval (in seconds) that the player must wait before respawn, for the next respawn only. It resets to mission default on mission…
- setVariableSet variable to given value in the variable space of given element. Can be used to broadcast variables over the network.
- switchableUnitsReturns a list of playable units available for switching to - Command is relative to the client on which it is executed and will only show playable…