Comrades in Arms Discussion Board

Full Version: Custom actions; show text to a specific player only
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a problem with custom action. I've added an action to an object in a MP-compatible way:

Code:
addActionMP =
{
    private["_object","_screenMsg","_scriptToCall"];
    _object = _this select 0;
    _screenMsg = _this select 1;
    _scriptToCall = _this select 2;

    if(isNull _object) exitWith {};

    _object addAction [_screenMsg,_scriptToCall, nil,10,true,true,"","_this distance _target < 3"];
};

Now inside the script called when the action is executed...

1. How cen I get the player that triggered this action?
2. How can I display a text, either via hint or cutText to this player only?

_this select 1 in the action script is usually the unit that activated the action.

The effect of the script is local, so it SHOULD be running on the unit's machine only to be sure, you can use something like

Code:
if (local (_this select 1)) then {
   Hint "Fire and Blood!";
};

Thanks. So far I used "player" instead of _this select 1, not sure if correctly, but worked for me. When testing in SP. As for the hint to specific player I found some good info here https://forums.bistudio.com/topic/143835...ervehicle/
and after slight modification got it working with:

Code:
rHINT = [];
fnc_rHINT = {

    private ["_player","_message"];

    _player = _this select 0;

    if(!local _player) exitWith {};

    _message = _this select 1;

    if (!isNull _player && {local _player}) then {

        hint _message;

    };

};
"rHINT" addPublicVariableEventHandler {(_this select 1) call fnc_rHINT;};

calling it from action script with
Code:
rHINT = [_this select 1, "local message"];
rHINT call fnc_rHINT;