After an interesting question on the arma 3 discord, about how to add actions to trees, here is what we came up with.
Paste this block somewhere that the client machine will execute it (init.sqf, initplayerlocal.sqf, etc)
comment "Paste this block somewhere that the clients machine will execute it.";
if (isDedicated) exitWith {};
if (!hasInterface) exitWith {};
tag_fnc_myTreeCode = {
comment 'This is your tree function!';
_cursorObject = cursorObject;
if (!(['\tree\',((getModelInfo _cursorObject) select 1),FALSE] call BIS_fnc_inString)) exitWith {titleText ['Sorry Im nota tree!','PLAIN',1];};
titleText ['Hello human','PLAIN',1];
};
tag_fnc_isTargetTree = {
private _return = FALSE;
_cursorObject = cursorObject;
if (!isNull _cursorObject) then {
if ((player distance _cursorObject) < 10) then {
_modelInfo = getModelInfo _cursorObject;
if (!(_modelInfo isEqualTo [])) then {
if (['\tree\',(_modelInfo select 1),FALSE] call BIS_fnc_inString) then {
_return = TRUE;
};
};
};
};
_return;
};
tag_var_action = [
'Hello tree',
tag_fnc_myTreeCode,
nil,
50,
TRUE,
TRUE,
'',
'[] call tag_fnc_isTargetTree',
5,
FALSE
];
player addAction tag_var_action;
player addEventHandler [
'Respawn',
{
player addAction tag_var_action;
}
];
The client will be able to walk up and scroll on a tree. Edit the code above for your uses.