Jump to content
Sign in to follow this  
Kleshya

How to make an action only for one side?

Recommended Posts

For example, i place a laptop, and give it an action "Hack it". Blufor need to secure it, and Opfor need to hack. Obviously, blufor dont need this action, and i need to hide it from them. How can i do this?

Share this post


Link to post
Share on other sites

Thank you. And one more, how can i do the same for BIS_fnc_holdActionAdd function, and for multiple sides? Just enumeration using or, or something else?

Share this post


Link to post
Share on other sites

Take a look at the documentation and you will find conditions for BIS_fnc_holdActionAdd as well.

If you want multiple sides, use something like:

side (group player) in [west,east]

Share this post


Link to post
Share on other sites

Or you can do an if statement with no condition before using the addAction command. Not sure if this is true or not but I heard using conditions or lots of heavy condition checks can have an impact on performance? Maybe someone can confirm whether this is true or not... Though, as that is just a side check it shouldn't really hurt I don't think.

Quote

Special variables passed to the script code are _target (object to which action is attached to) and _this (caller/executing person).

(side _this == blufor)
if ((side player == blufor)) then
{
	// addAction...
};

BIS_fnc_holdActionAdd:

[player, "Kill", "", "", "(side _this == blufor)", "true", {hintSilent "Hello!";}, {systemChat str (_this select 4);}, {player setDamage 1;}, {hintSilent "Splat.";}, [], 10, nil, true, false] call BIS_fnc_holdActionAdd;

(modified example from the Wiki)

Share this post


Link to post
Share on other sites

Always use {side (group player)} instead of {side player}, as the side of the player may change to civilian (on setCaptive for example) or to enemy (on accidental team killing for example), but the side of his group does not change with that. Unless of course you specifically want that.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Oh, I didn't know that. Thanks! Will be useful in the future.

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  

×