Page MenuHomeFeedback Tracker

setOwner breaking mandatory AI functionalities
Closed, ResolvedPublic

Description

setOwner can't be used without breaking the AI!
Neither doMove, Move nor applying waypoints works after switching locality!

Only if the unit is created on the client or the server directy (without switching locality), the unit can be moved.
either I'am missing something obvious or setOwner atm. is completely useless in a classic scripting scenario. {F25185}

Details

Legacy ID
1926376313
Severity
None
Resolution
Fixed
Reproducibility
Always
Category
Engine
Steps To Reproduce

Repro, connect to a dedicated server with a client/hc:

  • Create group and unit on server
  • setOwner the unit on any clients/HC machine
  • Execute doMove / move on the clients machine (where the unit is local)
  • See the unit not move at all, unitReady seems to be true instantly

see code snipped below

Additional Information

Spawn in debug console globally (Stratis) if connected as the client, adapt _locality if you wanna use you HC instead of the player

  • spawn {

STARTPOS = [1772.49,5706.24,0.00143862];
ENDPOS = [1779.07,5680.48,0.00143862];
TIMER = time;

OBJECT = nil;
LOCALITY = nil;
READY = nil;

player setpos STARTPOS;

sleep 5; titleText ["Creating unit on server and setting ownership to player unit!","PLAIN"];

if (isServer) then {
_unit = (createGroup CIVILIAN) createUnit ["C_man_1_1_F", STARTPOS, [], 0, "NONE"];
_locality = owner (([] call BIS_fnc_ListPlayers) select 0);

waituntil {local _unit};

[_unit,_locality] spawn {(_this select 0) setowner (_this select 1)};

    
    waituntil {!local _unit};

    LOCALITY = _locality;
    OBJECT = _unit;
    
    publicvariable "LOCALITY";
    publicvariable "OBJECT";

};

sleep 2; titleText ["Waiting for unit to be ready!","PLAIN"];

waituntil {!isnil "OBJECT" && {!isnil "LOCALITY"}};

sleep 2; titleText ["Trying to move unit where unit is local!","PLAIN"];

if (local OBJECT) then {
OBJECT doMove ENDPOS;

diag_log format["doMove called for %1 on locality %2 where unit is local %3",OBJECT,LOCALITY,local OBJECT];

waituntil {unitReady OBJECT};
READY = true; publicvariable "READY";

};

sleep 2; titleText ["Waiting for unitReady!","PLAIN"];

waituntil {!isnil "READY"};

if (OBJECT distance ENDPOS > 2) then {

titleText ["Unit did not move to endpos!","PLAIN"];

} else {

titleText ["Unit did move to endpos successfully!","PLAIN"];

};

sleep 2; titleText ["Ending test for setowner!","PLAIN"];
};

Event Timeline

highhead edited Steps To Reproduce. (Show Details)Nov 22 2014, 9:29 PM
highhead edited Additional Information. (Show Details)
highhead set Category to Engine.
highhead set Reproducibility to Always.
highhead set Severity to None.
highhead set Resolution to Fixed.
highhead set Legacy ID to 1926376313.May 7 2016, 7:52 PM
highhead edited a custom field.

added simple repro mission, with 3 tests:

  • AI creation on server, changing owner to client, executing domove (not working)
  • AI creation on server, not changing owner, executing domove (working)
  • AI creation on client, not changing owner, executing domove (working)

forgot one bit in test

For the AI to be challenging at all, this needs to be fixed.

Similar issue here (AI do nothing when transferred Server => HC)

http://feedback.arma3.com/view.php?id=21192

New command setGroupOwner introduced in rev. 129068. It changes the locality of whole groups (unless the leader is player).
SetOwner will no longer work with AI entities.
Syntax: group setGroupOwner clientid
It is serverside only and it is possible to transfer AI's locality (incl. brain and state) to the server.

"New command setGroupOwner introduced in rev. 129068."

Tomorrow basically, fingers crossed

Hi!

Thanks! Thats awesome!

Just a question -> brain/state from server to a different locality, i guess?
And will it work for groups that have been created on a different locality too (ergo call command serverside on any group to have full control)?

Thanks for your work!

Yes, it should be working that way.

Heya Ice!

I believe its not working as intended (sorry)! Groups switched to another locality, won't accept move/domove commands from a different locality (esp. server).

Execute globally in debug console
headless is the name for HC

  • spawn {

if (local player) then {POS = getpos player; publicvariable "POS"};

if (isServer) then {
TESTGROUPSERVER = [POS, WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad")] call BIS_fnc_spawnGroup;

TESTGROUPSERVER setGroupOwner (owner headLess);

waituntil {!local (leader TESTGROUPSERVER)};

TESTGROUPSERVER move (getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition"));

PublicVariable "TESTGROUPSERVER";
};

};

// wont move the unit...

also tested with different positions.
Group is created at player pos, but wont move at all...

The unit is funnily even calling out "MOVE TO blah"... but isnt moving at all!

it seems to be working with waypoints, but not with move/domove