Jump to content
daza

SwitchMove Not working in MP but does in SP

Recommended Posts

I've made a hostage/rescue in SP the code to make the unit sit and remain in the chair works, but in MP the unit is standing through the chair rather than sitting. I do not know if it the switchmove is the one not playing ball or its the AttachTo? Since the unit is in the correct position i think the problem is the switchmove...?

 

This is what i have in the init of the Unit in question:

snipe SetCaptive true; RemoveAllWeapons snipe; snipe setBehaviour "SAFE"; 
snipe switchMove "InBaseMoves_SittingRifle1"; snipe disableAI "anim"; 
snipe attachTo [b3,[0,0, -0.47]]; 
snipe SetVectorDirAndUp [[1,0,0],[0,0,1]];

Share this post


Link to post
Share on other sites

switchMove won't work till you're in game, so maybe wrap that all in spawn with a delay?

0 = [] spawn {
    sleep 0.1;
    snipe SetCaptive true; 
    removeAllWeapons snipe; 
    snipe setBehaviour "SAFE";  
    snipe switchMove "InBaseMoves_SittingRifle1"; 
    snipe disableAI "anim";  
    snipe attachTo [b3,[0,0, -0.47]];  
    snipe SetVectorDirAndUp [[1,0,0],[0,0,1]];
};

Share this post


Link to post
Share on other sites

Hi Daza,

 

If you want to use switchMove in a multiplayer environment without using vehicle inits do the following:

 

5sdWfZw.png

 

To fix this you will need to remotely execute it on different machines like this:

 

First define a function somewhere that we will run on all machines, we will send the player and the animation to play as arguments

SyncSwitchMove = {
	if (isDedicated) exitwith {};

	private ["_player", "_anim"];

	_player = param [0,objNull];
	_anim = param [1,""];

	_player switchMove _anim;
};


Now in order to run this command we need to execute the following command, this will run the function on all computers except the server

 [snipe,"InBaseMoves_SittingRifle1"] remoteExec ["SyncSwitchMove", -2]; 

Of course you can put it in a vehicle init like you have but make sure you do the following before switchMove and also add a little delay:

uiSleep 0.1; //perform the rest of your code after this
snipe disableAI "autoTarget"; 

It might be that the animation stops because they 'noticed' unknown objects.

 

Hope that helps you out.

Kane,

-arma3projectlife.com

Share this post


Link to post
Share on other sites
SyncSwitchMove = {
    if (isDedicated) exitwith {};

    private ["_player", "_anim"];

    _player = param [0,objNull];
    _anim = param [1,""];

    _player switchMove _anim;
};

[snipe,"InBaseMoves_SittingRifle1"] remoteExec ["SyncSwitchMove", -2]; 

Why the heck would you do that?

[snipe,"InBaseMoves_SittingRifle1"] remoteExec ["switchMove",[0,-2] select (isMultiplayer && isDedicated),true];
  • Like 1

Share this post


Link to post
Share on other sites

Leave Caiden alone, he's only good at adding other people's content to his server.

  • Like 1

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

×