MrSydney 1 Posted August 5, 2021 Hello, I am trying to get a simple hostage script to work on a dedicated multiplayer server, but it does not seem to work properly. I can see the "Free Hostage" option on the "hostage" AI, but the AI does not do anything after I select the option. While testing in the editor, the hostage is able to go to his next waypoint, but on the dedicated server, he is still stuck in place as if the script did not execute. The code I have to setup the hostage in "hostageSetup.sqf": hostage disableAI "move"; hostage setcaptive true; removeallweapons hostage; removebackpack hostage; removeGoggles hostage; removeHeadgear hostage; hostage unassignitem "nvgoggles"; hostage removeitem "nvgoggles"; removeVest hostage; hostage setunitpos "middle"; The code in "hostageAction.sqf": hostage setcaptive false; hostage setunitpos "auto"; hostage enableAI "Move"; And then finally the code in "init.sqf": execVM "hostageSetup.sqf"; hostage addaction ["Free Hostage",{ execVM "hostageAction.sqf" },nil,6,true,true,"","true",2,false,"",""]; Is there something I should add? Share this post Link to post Share on other sites
sarogahtyp 1109 Posted August 5, 2021 Try this as first line in hostageAction.sqf: [hostage, clientOwner] remoteExec ["setOwner", 2]; this orders the server to move the locality of the hostage to the client. It may take some time to change locality and therefore you should execute a sleep after it. A sleep for a second should be enough. 1 Share this post Link to post Share on other sites
MrSydney 1 Posted August 5, 2021 Thank you, I changed the "hostageAction.sqf" to: [hostage, clientOwner] remoteExec ["setOwner", 2]; sleep 2; hostage setcaptive false; hostage setunitpos "auto"; hostage enableAI "Move"; but in the editor I got an error message saying "Script command setOwner cannot be used for object 'C_man_polo_1_F'. Use setGroupOwner instead. And when tested on the dedicated server, I have the same result as before, where the AI does not move. However, I do not get the error message on the server. So I also tried to change it to "setGroupOwner" instead of "setOwner", which gave me the error in the editor: " '(_this select 0) |#|setGroupOnwer (_this select 1)' Error setGroupOwner: Type Object, expected Group". And on the dedicated server I had the same result as before. Is there a different way that this can be done maybe? Share this post Link to post Share on other sites
sarogahtyp 1109 Posted August 5, 2021 In this case try: [(group hostage), clientOwner] remoteExec ["setGroupOwner", 2]; 1 Share this post Link to post Share on other sites
MrSydney 1 Posted August 5, 2021 Thank you, that seems to have worked. Hostages now move to their first waypoint after they are freed. 1 Share this post Link to post Share on other sites
h4wek 43 Posted May 11, 2024 in my case it work in most cases but sometimes when I move to unit for capture it (joint to my group) using [(_this#0),clientowner] remoteexeccall ["setOwner",2,false] - this method not working at all, AI it stay remote forever and is no possibile to change it's locality to any other client, in WIKI is not any description when this command not affect on AI so how to find solution in this situation? Share this post Link to post Share on other sites
pierremgi 4910 Posted May 11, 2024 First, what is _this#0 ? We can't guess from where this local variable comes. Then, if you want the unit join your group, why not the join or joinSilent command? They are Global Argument, Global Effect Share this post Link to post Share on other sites
Harzach 2518 Posted May 11, 2024 9 hours ago, h4wek said: in WIKI is not any description when this command not affect on AI 1 Share this post Link to post Share on other sites
h4wek 43 Posted May 12, 2024 The problem is on interpretation of dedicated some AI units ready to join players on them - when players unconnect unexpected those units are seen by dedicated server as dummy players and all AI unist connected to them before player unconnect are blocked from all those commands (this#0) is just from add action form (as you can se below), before this is used join group ets here is whole command for join AI man unit and vehicle with AI units inside (example below it work in most cases perfectly just after unconnect players it stuck) and all those AI seems to be remote forever and all setowner and setowner group commands return false. //unit join private _idact_next = _x addAction ["<t color='#FFFF00'>" + localize "STR_JOIN_TO_GROUP" + "</t>",{[(_this#0)] join group (_this#1);[(_this#0),clientowner] remoteexeccall ["setOwner",2,false];dostop (_this#0);if (!(captive (_this#0)) && (((_this#0) getvariable ['SIDE',CIVILIAN]) != game_side_enemy)) then {(_this#0) enableAI 'all';[(_this#0), ([(_this#1)] call BIS_fnc_getUnitInsignia)] call BIS_fnc_setUnitInsignia}else {[(_this#0),remote_call_prisonner] remoteexeccall ['spawn',2];if (lifeState (_this#0) != "INCAPACITATED") then {(_this#0) enableAI "ANIM";(_this#0) enableAI "MOVE";dostop (_this#0);[(_this#0),"AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"] remoteexeccall ["switchMove"]}};(_this#0) call AI_group_change},nil,-850,true,true,"","(vehicle player == player) && (side _target != sideEnemy) && (lifeState _target != 'INCAPACITATED') && (((_target getvariable ['SIDE',CIVILIAN]) != game_side_enemy) || (captive _target)) && (group _target != group player) && (alive _target) && !(_target getvariable ['CAPTURED',false]) && !(isplayer _target)",_actionmanrange]; _x setvariable ["action_JOIN",_idact_next,false]; //vehicle join private _idact_next = _x addAction ["<t color='#FFFF00'>" + localize "STR_CAPTUREVEH" + "</t>",{(_this#0) lock 0;[(_this#0),clientowner] remoteexeccall ["setOwner",2,false];{if (!(isplayer _x) && (!(_x getVariable ['GRP_CHANGE', false]) || !(isplayer leader _x)) && (alive _x)) then {[_x] join (group (_this#1));[_x,clientowner] remoteexeccall ["setOwner",2,false];[_x, ([(_this#1)] call BIS_fnc_getUnitInsignia)] call BIS_fnc_setUnitInsignia;[[_x],AI_group_change] REMOTEEXECcall ["call",[0,-2] select isDedicated,true];_x enableAI 'all'}} foreach (crew (_this#0))},nil,-850,true,true,"","(vehicle player == player) && (side _target != sideEnemy) && (group _target != group player) && (alive _target) && ({!(isplayer _x) && (!(_x getVariable ['GRP_CHANGE', false]) || !(isplayer leader _x)) && (alive _x) && !(_x in (units group player))} count (crew _target) > 0)",10]; _x setvariable ["action_JOINVEH",_idact_next,false]; if setowner is not for that what is? (setowner group not work in some cases so good (even if this warning message is shown about setownergroup)), anyway problem is on other thing (unconnected player's units). So question still active what are circumstances for block AI units from change their locality on dedicated - and return false? Share this post Link to post Share on other sites