Jump to content
Sign in to follow this  
Cryptdik

Hold Action that recruits target NPC help

Recommended Posts

Trying to use the BIS_fnc_holdActionAdd function in a unit's Init line so that you can approach them and recruit their group to your group, MP compatible. I've tried a number of variations based on the info here but have had no success: https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd 
 

[player, "Recruit", "", "", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, {(group _target) join (group _caller)}, {}, [], 2, nil, true, false] remoteExec ["BIS_fnc_holdActionAdd", 0, _target];

The error I get is:
 |#|remoteExec ["BIS_fnc_holdActionAdd", 0, _target]; ERROR TYPE ANY

Any help is appreciated, I'm not too fluent in scripting.

Share this post


Link to post
Share on other sites

I think I got it to work by doing this, one for each of the civs in the group. Is there a simpler way to do this yet?

 

[civ1, "Recruit", "", "", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, {[civ1, civ2, civ3, civ4] join _caller}, {}, [], 2, nil, true, false] remoteExec ["BIS_fnc_holdActionAdd", 0, civ1];

[civ2, "Recruit", "", "", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, {[civ1, civ2, civ3, civ4] join _caller}, {}, [], 2, nil, true, false] remoteExec ["BIS_fnc_holdActionAdd", 0, civ2];

[civ3, "Recruit", "", "", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, {[civ1, civ2, civ3, civ4] join _caller}, {}, [], 2, nil, true, false] remoteExec ["BIS_fnc_holdActionAdd", 0, civ3];

[civ4, "Recruit", "", "", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, {[civ1, civ2, civ3, civ4] join _caller}, {}, [], 2, nil, true, false] remoteExec ["BIS_fnc_holdActionAdd", 0, civ4];

Share this post


Link to post
Share on other sites
On 5/31/2018 at 1:38 PM, Cryptdik said:

I think I got it to work by doing this, one for each of the civs in the group. Is there a simpler way to do this yet?

 

[civ1, "Recruit", "", "", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, {[civ1, civ2, civ3, civ4] join _caller}, {}, [], 2, nil, true, false] remoteExec ["BIS_fnc_holdActionAdd", 0, civ1];

[civ2, "Recruit", "", "", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, {[civ1, civ2, civ3, civ4] join _caller}, {}, [], 2, nil, true, false] remoteExec ["BIS_fnc_holdActionAdd", 0, civ2];

[civ3, "Recruit", "", "", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, {[civ1, civ2, civ3, civ4] join _caller}, {}, [], 2, nil, true, false] remoteExec ["BIS_fnc_holdActionAdd", 0, civ3];

[civ4, "Recruit", "", "", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, {[civ1, civ2, civ3, civ4] join _caller}, {}, [], 2, nil, true, false] remoteExec ["BIS_fnc_holdActionAdd", 0, civ4];

you could use cursorObject and isKindOf to go about this. heres the setup but with addAction, only shows on units that are not in your group, same faction, less than 2 meters. convert it to use with holdActionAdd and just change conditions to your liking. cursorObject being the main help

player addAction ["Invite to group",
{
	_unit = cursorObject;
	_sender = (_this select 0);
	[_sender] remoteExecCall ["BUF_fnc_addPlayerToGroup", _unit, true];
}, [], 0, false, true, "", 
"cursorObject isKindOf 'MAN' && !(group cursorObject isEqualTo group _this) && side cursorObject isEqualTo side _this && cursorObject distance _target < 2"];

 

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  

×