rimblock 0 Posted January 26, 2015 I would like to create a unit on the server and then pass it to a specific client as the commands that need to be run against it need to be local to a specific players client instance. Is there a way to pass ai unit ownership to a client via SQF or is there an activity that automatically passes ownership (like getting in to a vehicle as a drive passes ownership of that vehicle to the drivers client). Thanks. Share this post Link to post Share on other sites
killzone_kid 1331 Posted January 26, 2015 Can make ai join your group this should do it theoretically. Share this post Link to post Share on other sites
dreadedentity 278 Posted January 26, 2015 I would like to create a unit on the server and then pass it to a specific client as the commands that need to be run against it need to be local to a specific players client instance. Why do it this way? If you create a unit from a client, it will be local to that client. https://community.bistudio.com/wiki/Locality_in_Multiplayer#Basic_Rules Rule #5 Share this post Link to post Share on other sites
Schatten 290 Posted January 26, 2015 https://community.bistudio.com/wiki/setOwner? Share this post Link to post Share on other sites
rimblock 0 Posted January 26, 2015 Can make ai join your group this should do it theoretically. Ok, if you are in group of one then presumabily you would also be the leader. Adding the AI to the group would add it as a group member ?. switching the player from the unit it is controlling to the new AI would leave the previous unit as the leader or would leadership move with the player ?. Also, according to the Wiki there seems to be reports that you cannot just kill the old unit as it affects scores (and possibly more) so you have to hide them away. Why do it this way? If you create a unit from a client, it will be local to that client.https://community.bistudio.com/wiki/Locality_in_Multiplayer#Basic_Rules Rule #5 Yep, the creater is the owner. Got that. The thing is that I am trying to stop the client from creating units if possible. https://community.bistudio.com/wiki/setOwner? That looks to be the command that may just sort it out. Thanks for that. Sorry for being a little unclear. I wanted to avoid the "try this script" sort of canned replies. The preference is to create a new unit on the server for the player to control and load it up with the players gear and then pass ownership over to the client to do the move with selectplayer. I would like to limit the clients ability to create units, add weapons / backpacks etc where reasonibly possible. This is for a multiplayer mod. All the scripts I have come across for switching players to different units are client centric which is why I didn't really want a canned solution. Many thanks for all the info to all. Share this post Link to post Share on other sites
killzone_kid 1331 Posted January 26, 2015 That looks to be the command that may just sort it out. Thanks for that. Sorry for being a little unclear. I wanted to avoid the "try this script" sort of canned replies. The preference is to create a new unit on the server for the player to control and load it up with the players gear and then pass ownership over to the client to do the move with selectplayer. I would like to limit the clients ability to create units, add weapons / backpacks etc where reasonibly possible. This is for a multiplayer mod. All the scripts I have come across for switching players to different units are client centric which is why I didn't really want a canned solution. Many thanks for all the info to all. You should have explained this from the start. You don't need any command to change ownership, selectPlayer changes unit locality automatically. Share this post Link to post Share on other sites
dreadedentity 278 Posted January 26, 2015 Also, according to the Wiki there seems to be reports that you cannot just kill the old unit as it affects scores (and possibly more) so you have to hide them away. deleteVehicle Share this post Link to post Share on other sites
rimblock 0 Posted January 27, 2015 You should have explained this from the start. You don't need any command to change ownership, selectPlayer changes unit locality automatically. Sure but the notes in the Wiki entry have the following (concern in bold)... 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 If it will take some time to switch then maybe it is better to pass control over to the relevent client before switching. If it not longer takes any amount of time the player is likely to notice then maybe the Wiki could do with a new note. I can potentially build and equip the AI unit on the server, pass ownership over to the client then fire a PVC to get the cleint to spawn a script to check for ownership and then move the player to the new AI. If you feel this will be slower than equiping the AI unit on the server, firing a PVC to get the client to spawn a script to move the player to the new AI and confirm onwership is with the client then it would be great to hear. I am just trying to find various alternatives and by asking the question the way I did I got to hear about 'setOwner' which will most likely be very helpful later on in my conversion project so doubly helpful. ---------- Post added at 01:46 ---------- Previous post was at 01:43 ---------- deleteVehicle Does this negate any issues of deleting your original player unit as noted in the selectplayer wiki entry ?. But you have to remember that your old unit will stay with your Identity. Dies the old unit, the stats count it. Thanks Share this post Link to post Share on other sites
killzone_kid 1331 Posted January 27, 2015 setOwner is server only command and you wanted client command if I'm not mistaken. Also that wiki note could be in relation to older games, many things have changed. You should always try it for yourself, even Arma 3 is getting optimised so what is on wiki can be slightly different. Share this post Link to post Share on other sites
rimblock 0 Posted January 27, 2015 setOwner is server only command and you wanted client command if I'm not mistaken. Also that wiki note could be in relation to older games, many things have changed. You should always try it for yourself, even Arma 3 is getting optimised so what is on wiki can be slightly different. Sure and my query was to create on the server then push to the client. Just wanted a few options if possible. Will probably try both and see which works better. Thanks for the advise. Share this post Link to post Share on other sites
dreadedentity 278 Posted January 27, 2015 Does this negate any issues of deleting your original player unit as noted in the selectplayer wiki entry ?. I'm not sure what you mean by this, but deleting your old player will take care of the issue of you losing points when it gets killed (because it can never get killed) Share this post Link to post Share on other sites
rimblock 0 Posted January 28, 2015 I'm not sure what you mean by this, but deleting your old player will take care of the issue of you losing points when it gets killed (because it can never get killed) Ok, I see. The issue occurs if the original unit is 'killed' rather than deleted (ie. deletion does not kill and remove, it just removes). Good to know. thanks. Share this post Link to post Share on other sites
jshock 513 Posted January 28, 2015 (edited) Ok, I see. The issue occurs if the original unit is 'killed' rather than deleted (ie. deletion does not kill and remove, it just removes).Good to know. thanks. Important to note that a deleted unit still satisfies the "!alive" condition (may be unrelated, but eh). Edited January 28, 2015 by JShock Share this post Link to post Share on other sites
rimblock 0 Posted January 28, 2015 Important to note that a deleted unit still satisfies the "!alive" condition (may be unrelated, but eh). As this is for player unit model change I suspect this maybe ok. If the peocess is to move the player to the new model (unit) and then uncouple the old unit from the game (delete EH etc) and then delete the unit then the unit should not be referenced in future as the conversion I am working on is player rather than unit centric. Thanks for everyone input. Share this post Link to post Share on other sites
simicsko 4 Posted August 31, 2022 What was the final solution? How to transfer the AI unit created on the server to the client? Share this post Link to post Share on other sites
pierremgi 4903 Posted August 31, 2022 1 hour ago, simicsko said: What was the final solution? How to transfer the AI unit created on the server to the client? Use setGroupOwner (on server, after you created your unit) 1 Share this post Link to post Share on other sites
simicsko 4 Posted August 31, 2022 12 minutes ago, pierremgi said: Use setGroupOwner (on server, after you created your unit) Thank you so much. 😉 Share this post Link to post Share on other sites
Harzach 2517 Posted August 31, 2022 Read the notes on the Biki as they pertain to your situation. Share this post Link to post Share on other sites