This code is placed in the initPlayerLocal.sqf. This will draw player icons and names on the GPS display. This is a very useful Arma 3 code sample.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | [] spawn { waitUntil {!isNull (uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull])}; disableSerialization; private _display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; private _miniMapControlGroup = _display displayCtrl 13301; private _miniMap = _miniMapControlGroup controlsGroupCtrl 101; _miniMap ctrlAddEventHandler ["Draw", { (_this select 0) drawIcon [ getText (configFile >> "CfgVehicles" >> typeOf (vehicle player) >> "icon"), sidecolorplayer, getPos player, 19, 19, getDir player, format ["%1:%2", profileName ,getText (configFile >> "CfgVehicles" >> typeOf (vehicle player) >> "displayName")], 1, 0.03, "PuristaMedium", "top" ] }]; }; |
Use this code for a player to heal to full health when they use a First Aid Kit.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | player addEventHandler ["HandleHeal", { _this spawn { params ["_injured","_healer"]; missionNamespace setVariable ['Health',getDammage _injured,FALSE]; _damage = Health; if (_injured == _healer) then { waitUntil { damage _injured != _damage }; if (damage _injured < _damage) then { titletext ["You used Bandages and Morphine.", "PLAIN DOWN"]; _injured setDamage 0; }; }; }; }]; |
That is also very useful indeed.