setOwner: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - ">Posted on February ([0-9]{2})[ a-zA-Z]*, ([0-9]{4})" to ">Posted on $2-02-$1")
m (Text replacement - "{{Feature|Important|" to "{{Feature|important|")
 
(3 intermediate revisions by the same user not shown)
Line 19: Line 19:


|pr= {{Feature|arma3|Since {{arma3}} v1.40, this command should not be used to transfer ownership of units with AI with the exception of [[agents]].}}
|pr= {{Feature|arma3|Since {{arma3}} v1.40, this command should not be used to transfer ownership of units with AI with the exception of [[agents]].}}
{{Feature|Important|'''Prior to {{arma3}} v1.40''' it was not possible to transfer the ownership from a client back to the server.}}
{{Feature|important|'''Prior to {{arma3}} v1.40''' it was not possible to transfer the ownership from a client back to the server.}}


|s1= object [[setOwner]] clientID
|s1= object [[setOwner]] clientID


|p1= object: [[Object]] - Object to transfer
|p1= object: [[Object]] - object to transfer


|p2= clientID: [[Number]] - The [[Multiplayer_Scripting#Machine_network_ID | machine network ID]] of the new [[owner]].
|p2= clientID: [[Number]] - the [[Multiplayer_Scripting#Machine_network_ID | machine network ID]] of the new [[owner]].


|r1= [[Boolean]] - Returns [[true]] if ownership was successfully transferred, otherwise [[false]]
|r1= [[Boolean]] - returns [[true]] if ownership was successfully transferred, otherwise [[false]]


|x1= <sqf>_someObject setOwner 12;</sqf>
|x1= <sqf>_someObject setOwner 12;</sqf>

Latest revision as of 00:23, 2 February 2024

Hover & click on the images for description

Description

Description:
From 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. To transfer ownership of all AI units in a group properly, use setGroupOwner instead.
Problems:
Arma 3
Since Arma 3 v1.40, this command should not be used to transfer ownership of units with AI with the exception of agents.
Prior to Arma 3 v1.40 it was not possible to transfer the ownership from a client back to the server.
Groups:
Multiplayer

Syntax

Syntax:
object setOwner clientID
Parameters:
object: Object - object to transfer
clientID: Number - the machine network ID of the new owner.
Return Value:
Boolean - returns true if ownership was successfully transferred, otherwise false

Examples

Example 1:
_someObject setOwner 12;
Example 2:
_someObject setOwner (owner _playerObject);

Additional Information

See also:
owner setGroupOwner groupOwner didJIPOwner

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Posted on 2017-08-22 - 18:56 (UTC)
Demellion
NOTE: There are some interesting behaviour about the specific owner digits like 0 -2 and 2:
  1. Any mission objects (generated from SQM) initially have 0 owner state, but it is not local to ANYONE (0) like it is expected to be, but actually only to a SERVER (2). You can't make any object owner to be 0 once it was changed.
  2. Trying to change ownership to any negative digit will always result in attempt to transfer ownership to SERVER (2). Once it is unit (non-agent) it will fail and revert* to initial ownership.
  3. *Changing ownership of a unit (non-agent) actually gives a result for a brief time after this action is performed. What actually happens next - ownership is getting reverted with a message to RPT of a server. This can be seen by reading results of (owner _object) in really fast cycle.
Posted on 2019-02-12 - 01:15 (UTC)
jonpas
Prints RPT warning "setGroupOwner should be used" as soon as there is one unit inside the vehicle, but performs the action successfully.