Jump to content
l4z0rr0b0tz

Multiplayer Surrender Script

Recommended Posts

Hey all,

I've been working on a surrender script for MP.  It is working  but there is an issue.    It appears to work correctly on the screen of the client, but for other clients, the hands up animation looks fine, but the hands down animation glitches out and does weird things.  I'm currently looking into how to use RemoteExec but I'm pretty new to MP scripting.  Any advice would be appreciated.  

My script, placed in initPlayerLocal.sqf  (I am using a keydown listener to toggle this function but you could just as easily make an addaction menu for it):

fnc_surrender = {
        _animst = animationstate player;
        if (_animst == "AmovPercMstpSsurWnonDnon") then {player switchmove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"} else {player action ["SWITCHWEAPON",player,player,-1];player action ["Surrender",player];};
};

A video of what is happening:
https://streamable.com/73bh2

Thank you!

Share this post


Link to post
Share on other sites

I solved the issue:

Read up about RemoteExec and figured out if I run switchmove on everyone's machine on the network it looks correct.

Called this function instead by saying [player] remotexec [fn_surrender,0,true];

fnc_surrender = {

_p = _this select 0;
        _animst = animationstate _p;
        if (_animst == "AmovPercMstpSsurWnonDnon") then {_P switchmove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"} else {_P action ["SWITCHWEAPON",_P,_P,-1];_P action ["Surrender",_P];};
};

There is some other stuff you have to do also to get it to work, it's in other scripts though and I'm not gonna post it all here since nobody cares haha

  • Like 5

Share this post


Link to post
Share on other sites
On ‎2‎/‎17‎/‎2017 at 1:20 AM, l4z0rr0b0tz said:

I I solved the issue:

Read up about RemoteExec and figured out if I run switchmove on everyone's machine on the network it looks correct.

Called this function instead by saying [player] remotexec [fn_surrender,0,true];

fnc_surrender = {

_p = _this select 0;
        _animst = animationstate _p;
        if (_animst == "AmovPercMstpSsurWnonDnon") then {_P switchmove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"} else {_P action ["SWITCHWEAPON",_P,_P,-1];_P action ["Surrender",_P];};
};

There is some other stuff you have to do also to get it to work, it's in other scripts though and I'm not gonna post it all here since nobody cares haha

I do care and a working multiplayer script for AI surrendering is my goal. Would you share a standalone version? 🙂 Thank you in advance! 🙂

  • Thanks 1

Share this post


Link to post
Share on other sites

Hi there! 🙂 I am still interested in this script and I would like to know if you would help me with it for multiplayer. All I need is a standalone version. Thank you in advance.

 

Share this post


Link to post
Share on other sites
On 2/17/2017 at 1:20 AM, l4z0rr0b0tz said:

There is some other stuff you have to do also to get it to work, it's in other scripts though and I'm not gonna post it all here since nobody cares haha

 

Hello there @l4z0rr0b0tz !

 

The forum is an actual information database , so everyone will get benefit from your posts.

You should reconsider about it .

 

and by the way here is also what i'm using in my GF_Missions script :

Spoiler

//________________	GF_Missions_addaction_Join_Disband_Hostage	________________

GF_Missions_addaction_Join_Disband_Hostage = {
[_this, 
[
    "<t size=""1.2"" font=""RobotoCondensedBold"" color=""#FF9933"">" + "Hostage Join Group", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];		
		private _target = _this select 0;
		private _caller = _this select 1;
		private _actionId = _this select 2;
		[_target] joinSilent _caller;	
		_target setCaptive false;
		_target enableAI 'MOVE';
		[_target, _actionid] remoteExec ["removeAction"];
		
		[_target,[
    "<t size=""1.2"" font=""RobotoCondensedBold"" color=""#FF9933"">" + "Disband Hostage", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];		
		private _target = _this select 0;
		private _caller = _this select 1;
		private _actionId = _this select 2;
		_Group = createGroup civilian;
		[_target]  joinSilent _Group; 
		_target setCaptive false;
		_target removeAction _actionId;
		_target spawn GF_Missions_addaction_Join_Disband_Hostage;
    },
    [],1.5,true,true,"","true",8,false,"", ""
]] remoteExec ["addAction"];
    },[], 1.5,true,true,"","true",8,false,"",""
]] remoteExec ["addAction"];
};
publicVariable "GF_Missions_addaction_Join_Disband_Hostage";


//________________	GF_Missions_addaction_Release_Tie_Hostage	________________

GF_Missions_addaction_Release_Tie_Hostage = {
[_this, 
[
    "<t size=""1.2"" font=""RobotoCondensedBold"" color=""#FF9933"">" + "Release Hostage", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];		
		private _target = _this select 0;
		private _caller = _this select 1;
		private _actionId = _this select 2;
		[[_target,'Acts_ExecutionVictim_Unbow'] remoteExec ['switchMove']];
		_target enableAI 'anim';		
		[_target, _actionid] remoteExec ["removeAction"];
		
		[_target,[
    "<t size=""1.2"" font=""RobotoCondensedBold"" color=""#FF9933"">" + "Tie Hostage", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];		
		private _target = _this select 0;
		private _caller = _this select 1;
		private _actionId = _this select 2;
		[[_target,'Acts_ExecutionVictim_Loop'] remoteExec ['switchMove']];
		_target disableAI 'anim';	
		_target removeAction _actionId;
		_target spawn GF_Missions_addaction_Release_Tie_Hostage;
    },
    [],1.5,true,true,"","true",8,false,"", ""
]] remoteExec ["addAction"];
    },[], 1.5,true,true,"","true",8,false,"",""
]] remoteExec ["addAction"];
};
publicVariable "GF_Missions_addaction_Release_Tie_Hostage";

 

Spoiler

//________________ Spawn the Hostage	________________

_Hostage = createGroup civilian;
GF_Missions_Hostage_11 = _Hostage createUnit ["C_journalist_F", _Pos_1, [], 0, "CAN_COLLIDE"];

//________________	addaction	________________

GF_Missions_Hostage_11 setskill 1;
GF_Missions_Hostage_11 setdamage 0.5;
GF_Missions_Hostage_11 disableai "MOVE";

removeAllWeapons GF_Missions_Hostage_11;
removeAllItems GF_Missions_Hostage_11;
removeAllAssignedItems GF_Missions_Hostage_11;
removeUniform GF_Missions_Hostage_11;
removeVest GF_Missions_Hostage_11;
removeBackpack GF_Missions_Hostage_11;
removeHeadgear GF_Missions_Hostage_11;
removeGoggles GF_Missions_Hostage_11;

GF_Missions_Hostage_11 forceAddUniform "U_C_WorkerCoveralls";
[GF_Missions_Hostage_11,[0,"GF_Missions\images\GF_Uniform_Prisoner.paa"]] remoteExec ["setObjectTexture",0,true];
GF_Missions_Hostage_11 setcaptive true;
[[GF_Missions_Hostage_11,"Acts_ExecutionVictim_Loop"] remoteExec ["switchMove"]];
GF_Missions_Hostage_11 disableAI "anim";


 
//________________	GF_Missions_addaction_Join_Disband_Hostage	________________

GF_Missions_Hostage_11 spawn GF_Missions_addaction_Join_Disband_Hostage;

//________________	GF_Missions_addaction_Release_Tie_Hostage	________________

GF_Missions_Hostage_11 spawn GF_Missions_addaction_Release_Tie_Hostage;

 

 

  • Like 3

Share this post


Link to post
Share on other sites
14 hours ago, GEORGE FLOROS GR said:

 

Hello there @l4z0rr0b0tz !

 

The forum is an actual information database , so everyone will get benefit from your posts.

You should reconsider about it .

 

and by the way here is also what i'm using in my GF_Missions script :

  Hide contents


//________________	GF_Missions_addaction_Join_Disband_Hostage	________________

GF_Missions_addaction_Join_Disband_Hostage = {
[_this, 
[
    "<t size=""1.2"" font=""RobotoCondensedBold"" color=""#FF9933"">" + "Hostage Join Group", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];		
		private _target = _this select 0;
		private _caller = _this select 1;
		private _actionId = _this select 2;
		[_target] joinSilent _caller;	
		_target setCaptive false;
		_target enableAI 'MOVE';
		[_target, _actionid] remoteExec ["removeAction"];
		
		[_target,[
    "<t size=""1.2"" font=""RobotoCondensedBold"" color=""#FF9933"">" + "Disband Hostage", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];		
		private _target = _this select 0;
		private _caller = _this select 1;
		private _actionId = _this select 2;
		_Group = createGroup civilian;
		[_target]  joinSilent _Group; 
		_target setCaptive false;
		_target removeAction _actionId;
		_target spawn GF_Missions_addaction_Join_Disband_Hostage;
    },
    [],1.5,true,true,"","true",8,false,"", ""
]] remoteExec ["addAction"];
    },[], 1.5,true,true,"","true",8,false,"",""
]] remoteExec ["addAction"];
};
publicVariable "GF_Missions_addaction_Join_Disband_Hostage";


//________________	GF_Missions_addaction_Release_Tie_Hostage	________________

GF_Missions_addaction_Release_Tie_Hostage = {
[_this, 
[
    "<t size=""1.2"" font=""RobotoCondensedBold"" color=""#FF9933"">" + "Release Hostage", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];		
		private _target = _this select 0;
		private _caller = _this select 1;
		private _actionId = _this select 2;
		[[_target,'Acts_ExecutionVictim_Unbow'] remoteExec ['switchMove']];
		_target enableAI 'anim';		
		[_target, _actionid] remoteExec ["removeAction"];
		
		[_target,[
    "<t size=""1.2"" font=""RobotoCondensedBold"" color=""#FF9933"">" + "Tie Hostage", 
    {
        params ["_target", "_caller", "_actionId", "_arguments"];		
		private _target = _this select 0;
		private _caller = _this select 1;
		private _actionId = _this select 2;
		[[_target,'Acts_ExecutionVictim_Loop'] remoteExec ['switchMove']];
		_target disableAI 'anim';	
		_target removeAction _actionId;
		_target spawn GF_Missions_addaction_Release_Tie_Hostage;
    },
    [],1.5,true,true,"","true",8,false,"", ""
]] remoteExec ["addAction"];
    },[], 1.5,true,true,"","true",8,false,"",""
]] remoteExec ["addAction"];
};
publicVariable "GF_Missions_addaction_Release_Tie_Hostage";

 

  Hide contents


//________________ Spawn the Hostage	________________

_Hostage = createGroup civilian;
GF_Missions_Hostage_11 = _Hostage createUnit ["C_journalist_F", _Pos_1, [], 0, "CAN_COLLIDE"];

//________________	addaction	________________

GF_Missions_Hostage_11 setskill 1;
GF_Missions_Hostage_11 setdamage 0.5;
GF_Missions_Hostage_11 disableai "MOVE";

removeAllWeapons GF_Missions_Hostage_11;
removeAllItems GF_Missions_Hostage_11;
removeAllAssignedItems GF_Missions_Hostage_11;
removeUniform GF_Missions_Hostage_11;
removeVest GF_Missions_Hostage_11;
removeBackpack GF_Missions_Hostage_11;
removeHeadgear GF_Missions_Hostage_11;
removeGoggles GF_Missions_Hostage_11;

GF_Missions_Hostage_11 forceAddUniform "U_C_WorkerCoveralls";
[GF_Missions_Hostage_11,[0,"GF_Missions\images\GF_Uniform_Prisoner.paa"]] remoteExec ["setObjectTexture",0,true];
GF_Missions_Hostage_11 setcaptive true;
[[GF_Missions_Hostage_11,"Acts_ExecutionVictim_Loop"] remoteExec ["switchMove"]];
GF_Missions_Hostage_11 disableAI "anim";


 
//________________	GF_Missions_addaction_Join_Disband_Hostage	________________

GF_Missions_Hostage_11 spawn GF_Missions_addaction_Join_Disband_Hostage;

//________________	GF_Missions_addaction_Release_Tie_Hostage	________________

GF_Missions_Hostage_11 spawn GF_Missions_addaction_Release_Tie_Hostage;

 

 

Mr. Floros, Sir, Yes, Sir! 🙂 Thank you very much again! As always! 🙂

  • Thanks 1

Share this post


Link to post
Share on other sites
9 hours ago, black_hawk_mw2_87 said:

Mr. Floros, Sir, Yes, Sir! 🙂 Thank you very much again! As always! 🙂

 

You're welcome !  :wave:

  • 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

×