Jump to content
Sign in to follow this  
Majestic Madman

Agents not moving to position on Dedicated Server

Recommended Posts

I've made attack dogs. Everything works on local hosts or singleplayer, but the agents won't move to a position when they're being create and directed on a dedicated server.
Created a simple script for the sake of test:
This runs in the init.sqf for testing so I get 2 dogs, one for the server and one for the client to observe the behaviour.

The 3 move commands aren't required, but just showing that the server doesn't work with any of them

mm_fnc_SpawnDog = {  
	params ["_pos"];  

	// Variables =============================================================
	_Class = "Alsatian_Random_F";  
	_Anim = "Dog_Sprint";  

	// Create Unit =============================================================  
	private _newDog = createAgent [_Class, _pos , [], 0, "NONE"];   
	_newDog setVariable ["BIS_fnc_animalBehaviour_disable", true];  
	_newDog setVariable [ "AgentObj" , _newDog , true ];   

	// Behaviour =======================================  
	_newDog playMoveNow _Anim;  
	
	// Indicator =======================================
	_Class = "Sign_Arrow_Green_F";
	if ( isServer ) then { _Class = "Sign_Arrow_F" };
	_Indicator = createVehicle [ _Class , getPos _NewDog , [] , 0 , "NONE" ];
	_Indicator attachTo [ _NewDog , [ 0 , 0 , 2 ] ];
	_newDog;  
};   


Sleep 3;

_Player = allPlayers select 0; 
MM_TestDog = [ _Player getRelPos [ 15 , 0 ]  ] call mm_fnc_SpawnDog; 

WHile { True } do { 
	_PlayerPos = getPos _Player;
    MM_TestDog setDestination [ _PlayerPos , "LEADER PLANNED", true];
	MM_TestDog moveTo _PlayerPos;
	MM_TestDog doMove _PlayerPos;
	Sleep 5;
}; 


The client dog (Green) starts running north (Expected Behaviour) then turns around and heads straight back to the client.
The server dog (Red) keepings running north ( Spawns facing north, and setting the run animation keeps it moving indefeinelty ) but will never turn or re-direct.

It also doesn't matter if I use an absolute position [ 0,0,0] , [ 10000 , 10000 , 0 ] etc.

3Hq13Dv.gif

Edit:
The server logs show that the server isn't actually applying the move commands, rather than it just being desync between client and server

Server Side Logs:
11:50:51 Agent Destination Player: B Alpha 1-1:1 (Madman) REMOTE
11:50:51 Agent Spawn Pos: [7212.9,3036.77,0]
11:50:51 Agent Created: Agent 0x2c500180
11:50:51 Initiated Move From | To: [7212.9,3036.77,0] | [7212.9,3021.77,0.00143909]
11:50:51 Agent Position: [7212.9,3036.77,0] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 15
11:50:52 Agent Position: [7212.9,3038.36,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 16.5959
11:50:53 Agent Position: [7212.9,3041.58,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 19.8105
11:50:54 Agent Position: [7212.9,3045.15,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 23.3823
11:50:55 Agent Position: [7212.9,3048.72,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 26.9541
11:50:56 Agent Position: [7212.9,3052.29,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 30.5259
11:50:57 Agent Position: [7212.9,3055.86,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 34.0977
11:50:58 Agent Position: [7212.9,3060.15,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 38.3838
11:50:59 Agent Position: [7212.9,3063.72,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 41.9556
11:51:00 Agent Position: [7212.9,3067.29,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 45.5273
11:51:01 Agent Position: [7212.9,3070.87,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 49.0991
11:51:02 Agent Position: [7212.9,3074.44,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 52.6709
11:51:03 Agent Position: [7212.9,3078.01,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 56.2427
11:51:04 Agent Position: [7212.9,3081.58,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 59.8145
11:51:05 Agent Position: [7212.9,3085.15,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 63.3862
11:51:06 Agent Position: [7212.9,3088.72,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 66.958
11:51:07 Agent Position: [7212.9,3092.3,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 70.5298
11:51:08 Agent Position: [7212.9,3095.87,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 74.1016
11:51:09 Agent Position: [7212.9,3099.44,0.00143862] | Destination [7212.9,3021.77,0.00143909] | Distance From Destination: 77.6733

 

Edited by Majestic Madman
Added Logs from server side

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×