Jump to content
fin_soldier

HoldAction Disabled for Specific Player

Recommended Posts

Hello,

 

In an upcoming mission, there are four playable units in total,

two of which are supposed to release the other two from being restrained.

 

I'm trying to figure out a way to disable the restrained from being able to unbind themselves from captivity.

 

In this test, I'm only using units P1 and P3 along with BIS_fnc_holdActionAdd.

P1 being free, and P3 being captive.

 

Here's how the HoldAction is set up:

 

29I3vD0.png

7ztAWau.jpg

 

I tried putting P1 as trigger owner, but it didn't work either.

Below are images of how I want it to work:

 

yBgledj.jpg

dDJomFb.jpg

 

Maybe there's a way to disable P3 from being able to do any action?

 

Thanks in advance! :)

Share this post


Link to post
Share on other sites

In the "condition for the action to be shown" you can add this :

"p1 distance p3 < 5 && !(captive _this)",

So :

[
	p3,
	"Release Player",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"p1 distance p3 < 5 && !(captive _this)",
	"p1 distance p3 < 5",
	{},
	{},
	{p3 playMove "Acts_AidlPsitMstpSsurWnonDnon_out"; p3 setCaptive false;},
	{},
	[],
	5,
	0,
	true,
	false
]   remoteExec ["BIS_fnc_holdActionAdd", 0 , p3];

 

  • Thanks 1

Share this post


Link to post
Share on other sites
23 hours ago, Crazy_Man said:

In the "condition for the action to be shown" you can add this :


"p1 distance p3 < 5 && !(captive _this)",

So :


[
	p3,
	"Release Player",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"p1 distance p3 < 5 && !(captive _this)",
	"p1 distance p3 < 5",
	{},
	{},
	{p3 playMove "Acts_AidlPsitMstpSsurWnonDnon_out"; p3 setCaptive false;},
	{},
	[],
	5,
	0,
	true,
	false
]   remoteExec ["BIS_fnc_holdActionAdd", 0 , p3];

 

 

Thanks!

I'll try it out tomorrow.

Share this post


Link to post
Share on other sites
On 6/8/2020 at 9:03 PM, Crazy_Man said:

In the "condition for the action to be shown" you can add this :


"p1 distance p3 < 5 && !(captive _this)",

 So :


[
	p3,
	"Release Player",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"p1 distance p3 < 5 && !(captive _this)",
	"p1 distance p3 < 5",
	{},
	{},
	{p3 playMove "Acts_AidlPsitMstpSsurWnonDnon_out"; p3 setCaptive false;},
	{},
	[],
	5,
	0,
	true,
	false
]   remoteExec ["BIS_fnc_holdActionAdd", 0 , p3];

  

 

This pops up in the trigger :

 

v605s6f.jpg

Share this post


Link to post
Share on other sites
[
	p3,
	"Release Player",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"p1 distance p3 < 5 && !(captive _this)", // HERE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	"p1 distance p3 < 5",
	{},
	{},
	{p3 playMove "Acts_AidlPsitMstpSsurWnonDnon_out"; p3 setCaptive false;},
	{},
	[],
	5,
	0,
	true,
	false
]   remoteExec ["BIS_fnc_holdActionAdd", 0 , p3];

Not in the trigger condition but in the "condition for the action to be shown", see the HERE !!!! in the code above.

 

In the trigger condition just keep the p1 distance p3 < 5

 

😉

Share this post


Link to post
Share on other sites
20 minutes ago, Crazy_Man said:

[
	p3,
	"Release Player",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"p1 distance p3 < 5 && !(captive _this)", // HERE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	"p1 distance p3 < 5",
	{},
	{},
	{p3 playMove "Acts_AidlPsitMstpSsurWnonDnon_out"; p3 setCaptive false;},
	{},
	[],
	5,
	0,
	true,
	false
]   remoteExec ["BIS_fnc_holdActionAdd", 0 , p3];

Not in the trigger condition but in the "condition for the action to be shown", see the HERE !!!! in the code above.

 

In the trigger condition just keep the p1 distance p3 < 5

 

😉

 

Oh damn, it actually works!

Thank you so much!

 

But I heard HoldAction won't work on hosted server?

Share this post


Link to post
Share on other sites

The effect of the action with addaction or BIS_fnc_holdActionAdd is local to the client who performs the action, only issue i know.

 

Since you use playMove and setCaptive in the script, these two command are broadcasted over the network but the arguments they take need to be local to the machine that performs these commands.

 

See Multiplayer Scripting

 

I think (I'm not sure) that objects named in the Eden editor are broadcasted.

 

If it doesn't works let me know 🙂

Share this post


Link to post
Share on other sites
1 hour ago, Crazy_Man said:

 

 

 

I think (I'm not sure) that objects named in the Eden editor are broadcasted

 

Yes they are. Objects named in the editor are known and broadcasted to all players and the server.

  • Thanks 1

Share this post


Link to post
Share on other sites
8 hours ago, Crazy_Man said:

The effect of the action with addaction or BIS_fnc_holdActionAdd is local to the client who performs the action, only issue i know.

 

Since you use playMove and setCaptive in the script, these two command are broadcasted over the network but the arguments they take need to be local to the machine that performs these commands.

 

See Multiplayer Scripting

 

I think (I'm not sure) that objects named in the Eden editor are broadcasted.

  

If it doesn't works let me know 🙂

 

7 hours ago, Tankbuster said:

Yes they are. Objects named in the editor are known and broadcasted to all players and the server.

 

So this should work on a local hosted game?

Share this post


Link to post
Share on other sites

I created multiple of these actions, but whenever one player does the action, the action for others should be deleted.

 

I tried:

Quote

[triggername] call BIS_fnc_holdActionRemove;

And:

Quote

deletevehicle triggername;

 

The action doesn't seem to disappear.

It's just kinda silly when you've already released the player, and the actions sticks to him.

Share this post


Link to post
Share on other sites

EDITED

 

Try this :

[
	p3,
	"Release Player",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"_this distance _target < 5 && !(captive _this)",
	"_caller distance _target < 5",
	{},
	{},
	{
		(_this select 0) playMove "Acts_AidlPsitMstpSsurWnonDnon_out";
		(_this select 0) setCaptive false;

		[[(_this select 0), (_this select 2)], {
			params ["_target", "_actionId"];

			[_target, _actionId] call BIS_fnc_holdActionRemove;

		}] remoteExec ["call", 0, true];
	},
	{},
	[],
	5,
	0,
	false,
	false
] remoteExecCall ["BIS_fnc_holdActionAdd", 0, true];

Normaly it will work for hosted games.

 

Edited by Crazy_Man
I've said bullshit...
  • Like 1

Share this post


Link to post
Share on other sites
On 6/15/2020 at 8:56 PM, Crazy_Man said:

EDITED

 

Try this :


[
	p3,
	"Release Player",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unbind_ca.paa",
	"_this distance _target < 5 && !(captive _this)",
	"_caller distance _target < 5",
	{},
	{},
	{
		(_this select 0) playMove "Acts_AidlPsitMstpSsurWnonDnon_out";
		(_this select 0) setCaptive false;

		[[(_this select 0), (_this select 2)], {
			params ["_target", "_actionId"];

			[_target, _actionId] call BIS_fnc_holdActionRemove;

		}] remoteExec ["call", 0, true];
	},
	{},
	[],
	5,
	0,
	false,
	false
] remoteExecCall ["BIS_fnc_holdActionAdd", 0, true];

Normaly it will work for hosted games.

 

 

This gave me an error.

But, I found out 3DEN Enhanced has a Hostage attribute for units, and it works fine.

I think I might just run with it, as I'm not really good with scripts after all. 😁

 

But thanks a lot for the help anyways!

  • 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

×