selectPlayer: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " it's" to " it is")
m (Text replacement - "ArmA II" to "{{arma2}}")
 
(51 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma |Game name=
|game1= ofpe
|version1= 1.00


|1.00|Game version=
|game2= arma1
|version2= 1.00


|arg= local |Arguments=
|game3= arma2
|version3= 1.00


|eff= global |Effects in MP=
|game4= arma2oa
____________________________________________________________________________________________
|version4= 1.50


| Move player into given unit. Some usage advices:
|game5= tkoh
* Try avoiding [[selectPlayer]] on editor-placed units in multiplayer, as it may, on occasion, lead to some undefined behaviour.
|version5= 1.00
* If you need to [[selectPlayer]] into another unit, consider [[createUnit|creatingUnit]] dynamically.<br><br>
{{Informative | Before {{arma3}} it was possible to [[selectPlayer]] another player-controlled unit, leading to control issues. }}
{{Warning | Creating and immediately selecting player into newly created unit could cause all sort of problems due to possible delay in unit initialization. Give unit some time to propagate properly on network before selecting player into it.}} |DESCRIPTION=
____________________________________________________________________________________________


| [[selectPlayer]] unitName |SYNTAX=
|game6= arma3
|version6= 0.50


|p1= unitName: [[Object]] |PARAMETER1=
|arg= local


| [[Nothing]] |RETURNVALUE=
|eff= global
____________________________________________________________________________________________
 
|x1= <code>[[selectPlayer]] bob;</code> |EXAMPLE1=
____________________________________________________________________________________________


| [[selectNoPlayer]], [[Team_Switch]], [[switchCamera]] |SEEALSO=
|gr1= Object Manipulation
 
|gr2= Multiplayer
 
|descr= Move player into given unit. Some usage advices:
* Avoid using [[selectPlayer]] on editor-placed units in multiplayer, as it may, on occasion, lead to some undefined behaviour.
* If you need to [[selectPlayer]] into another unit, consider [[createUnit|creating a unit]] dynamically.{{Feature|informative|Before {{arma3}} it was possible to [[selectPlayer]] another player-controlled unit, leading to control issues. }}
{{Feature|warning|
Creating and immediately selecting player into newly created unit could cause all sort of problems due to possible delay in unit initialisation.
Give the unit some time to propagate properly on the network before using this command on it.
}}
}}


<h3 style="display:none">Notes</h3>
|s1= [[selectPlayer]] unitName
<dl class="command_description">
 
<!-- Note Section BEGIN -->
|p1= unitName: [[Object]]
 
|r1= [[Nothing]]
 
|x1= <sqf>selectPlayer bob;</sqf>
 
|seealso= [[selectNoPlayer]] [[remoteControl]] [[Team Switch]] [[switchCamera]] [[teamSwitch]] [[enableTeamSwitch]]
}}


<dd class="notedate">Posted on June 24, 2015 - 23:34 (UTC)</dd>
{{Note
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
|user= Killzone_Kid
<dd class="note">
|timestamp= 20150624233400
{{Important | Most of the notes below do not apply to Arma 3 anymore. }}
|text= {{Feature|important|Most of the notes below do not apply to Arma 3 anymore. }}
</dd>
}}


<dd class="notedate">Posted on 14 May 2011
{{Note
<dt class="note">[[User:SnowSky|SnowSky]]
|user= SnowSky
<dd class="note">
|timestamp= 20100302230900
'''This command has significant effects on [[Multiplayer Scripting#Locality|locality]]'''!<br>
|text= '''This command has significant effects on [[Multiplayer Scripting#Locality|locality]]'''!<br>
Notes on locality issues with selectPlayer in multiplayer environments:
Notes on locality issues with selectPlayer in multiplayer environments:
<br><br>
<br><br>
Line 50: Line 61:
<br><br>
<br><br>
2) The identity of units are not transferred properly: If your old unit dies, this will count for your stats. Your old unit might remain identifiable as you (if you aim at the unit you see your own name). Your new unit will keep it is name, face and voice (face can be set dynamically, but name, voice and glasses have to be defined before mission start in the description.ext). When chatting, not the name of your original identity, but the identity of the transferred to person will show.<br><br>
2) The identity of units are not transferred properly: If your old unit dies, this will count for your stats. Your old unit might remain identifiable as you (if you aim at the unit you see your own name). Your new unit will keep it is name, face and voice (face can be set dynamically, but name, voice and glasses have to be defined before mission start in the description.ext). When chatting, not the name of your original identity, but the identity of the transferred to person will show.<br><br>
Those 2 Points were for ArmA I, I am currently analyzing the behaviour in ArmA II with version 1.08 + OA 1.57<br>
Those 2 Points were for ArmA I, I am currently analyzing the behaviour in {{arma2}} with version 1.08 + OA 1.57<br>
So with ArmA II, you still have to keep an eye on locality (otherwise the AI will controll the unit you are), but there are cool possibilities now: if you do a "selectPlayer unitVarName",the unit takes your identity (with name, voice, face and glasses) - and your identity is also visible on other clients!<br><br>
So with {{arma2}}, you still have to keep an eye on locality (otherwise the AI will controll the unit you are), but there are cool possibilities now: if you do a "selectPlayer unitVarName",the unit takes your identity (with name, voice, face and glasses) - and your identity is also visible on other clients!<br><br>
But you have to remember that your old unit will stay with your Identity. Dies the old unit, the stats count it. An other thing you have to pay attention is the Death for your new unit - you have to register an EventHandler, otherwise you will stay in your dead unit, and also the MenuOption Respawn won't help you out! 3.Jan. 2011
But you have to remember that your old unit will stay with your Identity. Dies the old unit, the stats count it. An other thing you have to pay attention is the Death for your new unit - you have to register an EventHandler, otherwise you will stay in your dead unit, and also the MenuOption Respawn won't help you out! 3.Jan. 2011
<br><br>
<br><br>
Line 58: Line 69:
<br><br>
<br><br>
Tried to create ingame a group with a selectPlayer Unit (on both clients), and joint the new squad. The result was, the group was local to the client who created the group, so after that, all other units that join that Group are - as you may think already, local to that single client. 18.May 2011
Tried to create ingame a group with a selectPlayer Unit (on both clients), and joint the new squad. The result was, the group was local to the client who created the group, so after that, all other units that join that Group are - as you may think already, local to that single client. 18.May 2011
}}


{{Note
|user= Besselinksjm
|timestamp= 20100617161900
|text= 4) After switching to a unit that's not local, the unit will remain local to you after switching back. For example, if we have units A and B, and a client starts as unit A and unit B is AI under server control. If you switch to unit B, it will take some time, but eventually you can control the movement of unit B (see (1) above). Now if you switch back to unit A, unit B will remain [[Multiplayer Scripting#Locality|local]] to you, the player. Any server-side scripts which try to execute local arguments – such as [[doMove]] – will fail.
}}


<dd class="notedate">Posted on -
{{Note
<dt class="note">[[User:Besselinksjm|besselinksjm]]
|user= Kju
<dd class="note">
|timestamp= 20100617172000
3) After switching to a unit that's not local, the unit will remain local to you after switching back. For example, if we have units A and B, and a client starts as unit A and unit B is AI under server control. If you switch to unit B, it will take some time, but eventually you can control the movement of unit B (see (1) above). Now if you switch back to unit A, unit B will remain [[local]] to you, the player. Any server-side scripts which try to execute local arguments -- such as doMove -- will fail.
|text= A working implementation can be found at {{Link|http://dev-heaven.net/projects/clanbase-aas/repository/revisions/master/entry/core/cb_aas_20_ChernarusTemplate.Utes/changePlayerModel.sqf|A&S ProMode dev-heaven repo}}, acc guest, pw guest or at {{Link|http://pastebin.jonasscholz.de/834|pastebin}}.<br>
 
<dd class="notedate">Posted on -
<dt class="note">[[User:kju|kju]]
<dd class="note">
A working implementation can be found at [http://dev-heaven.net/projects/clanbase-aas/repository/revisions/master/entry/core/cb_aas_20_ChernarusTemplate.Utes/changePlayerModel.sqf A&S ProMode dev-heaven repo], acc guest, pw guest or at [http://pastebin.jonasscholz.de/834 pastebin].<br>
Be careful to learn all the pitfalls and things you need to take into consideration to have this working in MP.
Be careful to learn all the pitfalls and things you need to take into consideration to have this working in MP.
}}


<dd class="notedate">Posted on 09 March 2014
{{Note
<dt class="note>[[User:EUTWtrnapster|EUTWtrnapster]]
|user= EUTWtrnapster
<dd class="note">
|timestamp= 20140309190600
Arma 3 (v1.13): In MP the Identity and the name carries over to the new Unit but not in SP. Use [[setName]] to set the name in SP.
|text= {{arma3}} (v1.13): In MP the Identity and the name carries over to the new Unit but not in SP. Use [[setName]]+[[profileName]] to set the name in SP.
 
|game= arma3
<!-- Note Section END -->
|version= 1.13
</dl>
}}
 
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|SELECTPLAYER]]
[[Category:Scripting Commands OFP Elite |SELECTPLAYER]]
[[Category:Scripting Commands Armed Assault|SELECTPLAYER]]
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Command Group: Team Switch]]

Latest revision as of 18:43, 29 March 2024

Hover & click on the images for description

Description

Description:
Move player into given unit. Some usage advices:
  • Avoid using selectPlayer on editor-placed units in multiplayer, as it may, on occasion, lead to some undefined behaviour.
  • If you need to selectPlayer into another unit, consider creating a unit dynamically.
    Before Arma 3 it was possible to selectPlayer another player-controlled unit, leading to control issues.
Creating and immediately selecting player into newly created unit could cause all sort of problems due to possible delay in unit initialisation. Give the unit some time to propagate properly on the network before using this command on it.
Groups:
Object ManipulationMultiplayer

Syntax

Syntax:
selectPlayer unitName
Parameters:
unitName: Object
Return Value:
Nothing

Examples

Example 1:
selectPlayer bob;

Additional Information

See also:
selectNoPlayer remoteControl Team Switch switchCamera teamSwitch enableTeamSwitch

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
Killzone_Kid - c
Posted on Jun 24, 2015 - 23:34 (UTC)
Most of the notes below do not apply to Arma 3 anymore.
SnowSky - c
Posted on Mar 02, 2010 - 23:09 (UTC)
This command has significant effects on locality!
Notes on locality issues with selectPlayer in multiplayer environments:

1) If you switch to a unit that's not local, control over movement will not be given to you immediately. For example, if you switch to an AI unit whose leader is a player, you will not be able to control the movement of your new avatar, as its control remains with the leader unit. You will however be able to look around while the unit walks automatically.

2) The identity of units are not transferred properly: If your old unit dies, this will count for your stats. Your old unit might remain identifiable as you (if you aim at the unit you see your own name). Your new unit will keep it is name, face and voice (face can be set dynamically, but name, voice and glasses have to be defined before mission start in the description.ext). When chatting, not the name of your original identity, but the identity of the transferred to person will show.

Those 2 Points were for ArmA I, I am currently analyzing the behaviour in Arma 2 with version 1.08 + OA 1.57
So with Arma 2, you still have to keep an eye on locality (otherwise the AI will controll the unit you are), but there are cool possibilities now: if you do a "selectPlayer unitVarName",the unit takes your identity (with name, voice, face and glasses) - and your identity is also visible on other clients!

But you have to remember that your old unit will stay with your Identity. Dies the old unit, the stats count it. An other thing you have to pay attention is the Death for your new unit - you have to register an EventHandler, otherwise you will stay in your dead unit, and also the MenuOption Respawn won't help you out! 3.Jan. 2011

3) If you do a selectPlayer call, join,joinSilent,joinAs,joinAsSilent wont work anymore correctly. Means: Your unit joins the other group AND your unit will be local to the other group. so at the moment you can use selectPlayer only as a single human player in a group. In the later day I will try what happens if both human players are units by selectPlayer, and both join the same group (till yet tried with one selectPlayer unit and one originUnit) 14.May 2011

Tried to create ingame a group with a selectPlayer Unit (on both clients), and joint the new squad. The result was, the group was local to the client who created the group, so after that, all other units that join that Group are - as you may think already, local to that single client. 18.May 2011
Besselinksjm - c
Posted on Jun 17, 2010 - 16:19 (UTC)
4) After switching to a unit that's not local, the unit will remain local to you after switching back. For example, if we have units A and B, and a client starts as unit A and unit B is AI under server control. If you switch to unit B, it will take some time, but eventually you can control the movement of unit B (see (1) above). Now if you switch back to unit A, unit B will remain local to you, the player. Any server-side scripts which try to execute local arguments – such as doMove – will fail.
Kju - c
Posted on Jun 17, 2010 - 17:20 (UTC)
A working implementation can be found at A&S ProMode dev-heaven repo (dead link), acc guest, pw guest or at pastebin (dead link).
Be careful to learn all the pitfalls and things you need to take into consideration to have this working in MP.
EUTWtrnapster - c
Posted on Mar 09, 2014 - 19:06 (UTC)

Arma 3 (v1.13): In MP the Identity and the name carries over to the new Unit but not in SP. Use setName+profileName to set the name in SP.