Posted: . At: 9:26 AM. This was 3 years ago. Post ID: 14905
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.





How to have an addaction in Arma 3 that pops up when you are near.


An addaction in Arma 3 can be used to access anything you wish, but they have a 50m range. This can be fixed easily, the example below uses a 2m range for the addaction.

[hightablelaptop,["Switch off Comms.","deleteVehicle (_this select 0)",[],0,true,true,"","(_this distance _target) < 2"]] remoteExec ["addAction",0];

This is the statement that controls this.

(_this distance _target) < 2

So, use this if you wish to have a nice useful addaction on a box or other object and want to only have it show up when the user is very close.

Below is another option, this will add an arsenal hold action to all crates of a certain class name.

{
	[_x, "Open the Arsenal", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "(_this distance _target < 6) && (isNull (findDisplay 162))", "isNull (findDisplay 162)", {}, BIS_holdActionProgress, {["Open",true] call BIS_fnc_arsenal;}, {}, [], 0.3, nil, false] call BIS_fnc_holdActionAdd;
 
} forEach (allMissionObjects "Misc_palletsfoiled_heap");

This is a very useful way to have an arsenal option easily added to multiple objects in your base. Disable simulation and damage on each object.

Save a player`s loadout when the arsenal is closed.

[ missionNamespace, "arsenalClosed", {
	systemChat "Arsenal Loadout Saved";
	player setVariable ["Saved_Loadout",getUnitLoadout player];
}] call BIS_fnc_addScriptedEventHandler;

Set the mission time to the time of the server. Put this code in initServer.sqf at the top.

if (isServer) then {
        waitUntil {time > 0};
        [missionStart select [0,5]] remoteExec ["setDate"];
};

Then put this code below it.

handleDisconnect = {
        _unit = _this select 0;
		_containers = nearestObjects[_unit,["WeaponHolderSimulated"],8];
        {
			deleteVehicle _x;
		} foreach _containers;
        deleteVehicle _unit;
};
 
addMissionEventHandler ["HandleDisconnect",{
	_this call handleDisconnect;
	false
}];

This will delete player bodies when they leave your server.

this addAction ["Teleport to FOB", {[player, [5309.6,10749.3,0]] call KER_fnc_teleport;}, "", 0, true, true, "", ""];

The code above is another example, this is how to call a function in an addaction. This is very useful to know.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.