netId: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(Add 2.18 feature)
 
(44 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma3 |= Game name
|game1= arma3
|version1= 0.50


|0.50|= Game version
|game2= arma2oa
____________________________________________________________________________________________
|version2= 1.63


| Unique ID of object or group.  |= Description
|gr1= Multiplayer
____________________________________________________________________________________________


| '''netId''' var |= Syntax
|descr= Get the unique ID of an object or a group.


|p1= var: [[Object]] or [[Group]] |= PARAMETER1 
|mp= <nowiki/>
* In singleplayer: {{GVI|arma3|2.18|size= 0.75}} returns a net ID (different from [[BIS_fnc_netId]]'s output), before that it returned an empty string in single player (see [[BIS_fnc_netId]] and [[BIS_fnc_objectVar]])
* In multiplayer: works as described


| [[String]] |= RETURNVALUE
|s1= [[netId]] objOrGroup


|p1= objOrGroup: [[Object]] or [[Group]]


|x1= <code>_playerNetId = [[netId]] [[player]];</code>|= EXAMPLE1
|r1= [[String]]


____________________________________________________________________________________________
|x1= <sqf>_playerNetId = netId player;</sqf>


| [[objectFromNetId]] |= SEEALSO
|seealso= [[objectFromNetId]] [[groupFromNetId]] [[BIS_fnc_objectFromNetId]] [[BIS_fnc_netId]] [[BIS_fnc_groupFromNetId]] [[BIS_fnc_objectVar]]
}}


| |= MPBEHAVIOUR
{{Note
____________________________________________________________________________________________
|user= Demellion
|timestamp= 20181019134000
|text= Even if the returned value is in format of '''owner:uniqueid''', it doesn't follow the current ownership of an object ([[owner]] for example).<br>
This command keeps the '''original owner''' of a created object.
}}
}}
<h3 style='display:none'>Notes</h3>
<dl class='command_description'>
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style='display:none'>Bottom Section</h3>
[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on April 2, 2015 - 09:55 (UTC)</dd>
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
<dd class="note">
[[netId]] in SP is "". Here is the function that will give you universal [[netId]] that works both in SP and MP
<code>KK_fnc_netId <nowiki>=</nowiki> {
[[if]] ([[isMultiplayer]]) [[exitWith]] {[[netId]] _this};
[[private]] "_netId";
_netId <nowiki>=</nowiki> _this [[getVariable]] "_netId";
[[if]] ([[isNil]] "_netId") [[then]] {
KK_var_globID <nowiki>=</nowiki> ([[missionNamespace]] [[getVariable]] ["KK_var_globID", 0]) + 1;
_netId <nowiki>=</nowiki> [[format]] ["0:%1", KK_var_globID];
_this [[setVariable]] ["_netId", _netId];
};
_netId
};
//example
_playerNetId <nowiki>=</nowiki> [[player]] [[call]] KK_fnc_netId;
</code>
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 18:25, 4 July 2024

Hover & click on the images for description

Description

Description:
Get the unique ID of an object or a group.
Multiplayer:
Groups:
Multiplayer

Syntax

Syntax:
netId objOrGroup
Parameters:
objOrGroup: Object or Group
Return Value:
String

Examples

Example 1:
_playerNetId = netId player;

Additional Information

See also:
objectFromNetId groupFromNetId BIS_fnc_objectFromNetId BIS_fnc_netId BIS_fnc_groupFromNetId BIS_fnc_objectVar

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
Demellion - c
Posted on Oct 19, 2018 - 13:40 (UTC)
Even if the returned value is in format of owner:uniqueid, it doesn't follow the current ownership of an object (owner for example).
This command keeps the original owner of a created object.