-
Content Count
254 -
Joined
-
Last visited
-
Medals
Everything posted by HallyG
-
EG Spectator Mode (Death Cam) Limit Side?
HallyG replied to MANTIA's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Apparently you can call the spectator script with whitelisted sides, so maybe you could change the whitelist according to the side the player was before death (switch do statement in playerKilled.sqf). Also there is an option to disable 3rd person perspective. // Param1: A string describing the action to be taken by the spectator function // Param2: The custom arguments that are sent to the spectator function ["Initialize", [player, [], true, true, true, true, true, true, true, true]] call BIS_fnc_EGSpectator; // The custom array for Initialize function can contain: _this select 0 : The target player object _this select 1 : Whitelisted sides, empty means all _this select 2 : Whether AI can be viewed by the spectator _this select 3 : Whether Free camera mode is available _this select 4 : Whether 3th Person Perspective camera mode is available _this select 5 : Whether to show Focus Info stats widget _this select 6 : Whether or not to show camera buttons widget _this select 7 : Whether to show controls helper widget _this select 8 : Whether to show header widget _this select 9 : Whether to show entities / locations lists If the spectator mode is active and you would like to terminate it, run the following function: ["Terminate"] call BIS_fnc_EGSpectator; so maybe, if the player was east before (UNTESTED): ["Initialize", [player, [EAST], true, false, false, true, true, true, true, true]] call BIS_fnc_EGSpectator; -
To index? To get all the faces with their config name and their display name, I used: private _tmp = "true" configClasses (configfile >> "CfgFaces" >> "Man_A3") apply {[configName _x, getText (_x >> "displayName")]};
-
Just a code snippet to display continually updating map markers for all units and uav's on the player's side. A result of me messing about with the functionality of the select command. If a unit is in a vehicle, the vehicle's driver (or the first player in the vehicle) followed by the crew count will be shown. For example "HallyG + 3". First argument toggles whether or not marker should be displayed for AI. Default behaviour, only show AI markers in singleplayer. Marker colour changes according to the player's side; The side used is the player's starting. http://imgur.com/a/LTgbk /* Author: HallyG Displays map markers for all friendly units on the map. Argument(s): 0: Show AI: <BOOLEAN> (default: Show AI in singleplayer only) Returns: <NOTHING> Example: [true] spawn FUNCTIONNAME; [true] execVM SCRIPTLOCATION; __________________________________________________________________*/ if (isDedicated || missionNamespace getVariable ["HGF_unitMarkers_running", false]) exitWith {}; HGF_unitMarkers_running = true; params [ ["_showAI", !isMultiplayer, [false]] ]; private _fnc_updtMkr = { params ["_marker", "_pos", "_dir", "_type", "_name"]; _marker setMarkerPosLocal _pos; _marker setMarkerDirLocal _dir; _marker setMarkerTypeLocal _type; _marker setMarkerTextLocal _name; }; private _markers = []; private _units = [[],[]]; private _colour = [playerSide, true] call BIS_fnc_sideColor; while {true} do { allUnitsUav select { if (isUAVConnected _x) then { (_units select 1) pushBackUnique _x; true }; }; allUnits select { if (isPlayer _x || _showAI) then { if (side _x isEqualto playerSide) then { private _unit = _x; if (({{_x isEqualTo _unit} count crew _x > 0} count allUnitsUav) isEqualTo 0) then { (_units select 0) pushBackUnique _x; true }; }; }; }; if (visibleGPS || visibleMap) then { { private _marker = format ["Unit%1", _x]; private _veh = {isPlayer _x || _showAI} count crew vehicle _x; if !(_marker in _markers) then { _markers pushBack (createMarkerLocal [_marker, visiblePositionASL _x]); _marker setMarkerAlphaLocal 0.75; _marker setMarkerSizeLocal [0.8, 0.8]; _marker setMarkerColorLocal _colour; }; [ [ _marker, (visiblePositionASL _x), (getDirVisual _x), [ ["Empty", "b_motor_inf"] select ((((crew vehicle _x) select {isPlayer _x || _showAI}) select 0) isEqualTo _x), "mil_triangle" ] select (isNull objectParent _x || {(objectParent _x isKindOf "ParachuteBase")}), [ format ["%1: %2 %3", getText (configFile >> "cfgVehicles" >> typeOf vehicle _x >> "displayname"), name _x, format [["+%1",""] select (_veh < 2), _veh -1]], name _x ] select (isNull objectParent _x || {(objectParent _x isKindOf "ParachuteBase")}) ], [ _marker, (visiblePositionASL _x), 0, "Empty", name _x ] ] select !(alive _x) call _fnc_updtMkr; if !(alive _x) then { (_units select 0) set [_forEachIndex, objNull] }; } forEach ((_units select 0) select {!isNull _x}); { private _unit = (uavControl _x) select 0; if (isPlayer _unit || _showAI) then { if (side _unit isEqualto playerSide) then { private _marker = format ["Uav%1", _x]; if !(_marker in _markers) then { _markers pushBack (createMarkerLocal [_marker, visiblePositionASL _x]); _marker setMarkerAlphaLocal 0.75; _marker setMarkerSizeLocal [0.8, 0.8]; _marker setMarkerColorLocal _colour; }; [ [ _marker, (visiblePositionASL _x), (getDirVisual _x), "b_uav", format ["%1: %2", getText (configFile >> "cfgVehicles" >> typeOf vehicle _x >> "displayName"), name _unit] ], [ _marker, (visiblePositionASL _x), (getDirVisual _x), "Empty", //"KIA" format ["%1: %2", getText (configFile >> "cfgVehicles" >> typeOf vehicle _x >> "displayName"), name _unit] ] ] select !(alive _x) call _fnc_updtMkr; if !(alive _x) then { (_units select 1) set [_forEachIndex, objNull] }; }; }; } forEach ((_units select 1) select {!isNull _x}); } else { {deleteMarkerLocal _x; true} count _markers; _markers = []; }; uiSleep 0.025; }; I guess, to improve this further, I could use the map mission event handler instead of a looped if then statement.
-
[Code Snippet] Player Map Markers
HallyG replied to HallyG's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Evidently I misunderstood you, my bad :) -
"Camo_White_01" is the display name. You need the config name. Try: "CamoHead_White_01_F"
-
How to check if a vehicle has full ammo?
HallyG replied to theend3r's topic in ARMA 3 - MISSION EDITING & SCRIPTING
To return a magazine's maximum capacity: getNumber (configFile >> "CfgMagazines" >> MAGAZINE >> "count"); -
[Code Snippet] Player Map Markers
HallyG replied to HallyG's topic in ARMA 3 - MISSION EDITING & SCRIPTING
-
Finding nested array from value
HallyG replied to ShadowRanger24's topic in ARMA 3 - MISSION EDITING & SCRIPTING
_array = [ ["Key 1", [0, 0, 0], [0, 0, 0]], ["Key 2", [0, 0, 0], [0, 0, 0]], ["Key 3", [0, 0, 0], [0, 0, 0]] ]; _keyStr = "Key 1"; _key = _array select {(_x select 0) isEqualTo _keyStr} select 0; // Returns ["Key 1", [0, 0, 0], [0, 0, 0]] -
by hold do you mean having the text remain on the screen?
-
Skip briefing in MP Mission
HallyG replied to polishmartyr's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I think he means are you asking how to skip the briefing of a mission you have downloaded, or how to skip the briefing of a mission you have made. -
detect allowDamage state
HallyG replied to gordonbay's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I can't help but think of this -
allow camera / screenshot mode in multiplayer
HallyG replied to twistking's topic in ARMA 3 - MISSION EDITING & SCRIPTING
This will create the camera [] call bis_fnc_camera;- 1 reply
-
- 1
-
Restricting turret movement?
HallyG replied to wyattwic's topic in ARMA 3 - ADDONS - CONFIGS & SCRIPTING
These are some commands to help you get started: weaponDirection currentWeapon Elevation can be calculated by taking the arcosine (acos) of the z-axis component from the turret's weapon direction. -
Getting civilians and independents to turn on each other on dedicated server
HallyG replied to Incontinentia's topic in ARMA 3 - MISSION EDITING & SCRIPTING
player returns objNull on a dedicated server -
BIS respawn system, how to determine role after respawn?
HallyG replied to jwllorens's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Oh blast, I did get it the wrong way around. The wiki is the correct version. On my way home from work but I'll try to answer later -
BIS respawn system, how to determine role after respawn?
HallyG replied to jwllorens's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Sorry, the role list was an oversight on my behalf: _respawnCombo = uiNamespace getVariable (["BIS_RscRespawnControlsMap_ctrlRoleList", "BIS_RscRespawnControlsSpectate_ctrlRoleList"] select (uiNamespace getVariable ["BIS_RscRespawnControlsSpectate_shown", false])); _respawnTemplateDisplayName = _respawnCombo lbText (lbCurSel _respawnCombo); The first argument (old unit) in onPlayerRespawn will be objNull on mission start, so you need to change the params section to: params [ ["_oldUnit", objNull, [objNull]], ["_newUnit", objNull, [objNull]] ]; Otherwise you're assigning a variable to a null unit -
BIS respawn system, how to determine role after respawn?
HallyG replied to jwllorens's topic in ARMA 3 - MISSION EDITING & SCRIPTING
By looking through all the respawn functions, the particular function was BIS_fnc_respawnMenuInventory. Well as far as I can tell, the respawn menu is split into two - one set of controls for the spectator screen and another for the map screen. These controls have different idcs, which are stored in the variables "BIS_RscRespawnControlsSpectate_ctrlComboLoadout" or "BIS_RscRespawnControlsMap_ctrlComboLoadout" depending on the screen. These variables can then be used to access to the last/current selection of the listbox, in order to find the loadout selected by the player. The "BIS_RscRespawnControlsSpectate_shown" allows us to know which screen was shown last and so correctly chose the variable to use in order to return the player's selected loadout. Hopefully that makes sense, writing clear explanations isn't exactly my forte. -
Date/Timestamp in mission.
HallyG replied to target_practice's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I don't know if this is still what you're looking for but I rewrote some of the BIS showOSD function. Should work with any map and it allows you to change the grid positions (ie change the map size so it doesn't say you're in the NE area when in fact you're just in a vast never ending ocean) for a given map: h = [] spawn { comment "showOSD - original script Jiri Wainar, modified by HallyG"; MAPS = ["stratis", "altis", "tanoa"]; MAPSIZES = [[1302, 230, 6825, 7810], [1785, 4639, 28624, 26008], [330, 130, 15084, 15360]]; if (missionNamespace getVariable ["BIS_showOSD_running", false]) exitWith {}; BIS_showOSD_running = true; private _fn_getSector = { params ["_posX", "_posY"]; private _map = toLower worldName; private _width = worldSize/2; private _height = worldSize/2; private _centre = [_width, _height]; if (_map in MAPS) then { (MAPSIZES select (MAPS find _map)) params ["_bottomLX", "_bottomLY", "_topRX", "_topRY"]; _width = (_topRx - _bottomLX)/2; _height = (_topRY - _bottomLY)/2; _centre = [(_topRx + _bottomLX)/2, (_topRY + _bottomLY)/2]; }; if !([_posX, _posY] inArea [_centre, _width, _height, 0, true]) exitWith {0}; private _gridX = floor (_posX /(_width * 0.666)); private _gridY = floor (_posY /(_height * 0.666)); ((_gridY * 3) + _gridX + 1) }; params [ ["_position", getPos player, [[]]], ["_date", date, [[]], [5]] ]; private _sector = _position call _fn_getSector; private _tIntel = ""; _date = (_date call BIS_fnc_fixDate) apply {format [["%1", "0%1"] select (_x < 10), _x]}; { _tIntel = [_tIntel, _x] joinString ([["-", " "] select (_forEachIndex == 3), ":"] select (_forEachIndex > 3)); } forEach _date; private _output = [ [_tIntel select [1, 10], ""], [" " + (_tIntel select [12]), "font='PuristaMedium'"], ["", "<br/>"] ]; if (_sector > 0) then { private _locations = (nearestLocations [_position, ["NameCity", "NameCityCapital", "NameLocal", "NameMarine", "NameVillage"], 500]) select {!((text _x) isEqualTo "")}; if !(_locations isEqualTo []) then { private _loc = _locations select 0; _output append [ [toUpper ([format [localize "STR_A3_NearLocation", text _loc], text _loc] select ((getPos player) in _loc)), ""], ["", "<br/>"] ]; }; }; _template = [format ["Near %1", worldName], localize "STR_A3_SectorSouthWest", localize "STR_A3_SectorSouth", localize "STR_A3_SectorSouthEast", localize "STR_A3_SectorWest", localize "STR_A3_SectorCentral", localize "STR_A3_SectorEast", localize "STR_A3_SectorNorthWest", localize "STR_A3_SectorNorth", localize "STR_A3_SectorNorthEast"] select _sector; _output append [ [format [_template, getText (configfile >> "cfgWorlds" >> worldname >> "description")], ""], ["", "<br/>"] ]; private _handle = [_output, safezoneX - 0.01, safeZoneY + (1 - 0.125) * safeZoneH, true, "<t align='right' size='1.0' font='PuristaLight'>%1</t>"] spawn BIS_fnc_typeText2; waitUntil {scriptDone _handle;}; BIS_showOSD_running = false; }; -
BIS respawn system, how to determine role after respawn?
HallyG replied to jwllorens's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I think I found the solution to OP's question: After you respawn, this will return a string of the display name of the last loadout selected in the selection screen: _respawnCombo = uiNamespace getVariable (["BIS_RscRespawnControlsMap_ctrlComboLoadout", "BIS_RscRespawnControlsSpectate_ctrlComboLoadout"] select (uiNamespace getVariable ["BIS_RscRespawnControlsSpectate_shown", false])); _respawnTemplateDisplayName = _respawnCombo lbText (lbCurSel _respawnCombo); For example, if you had, and selected, the loadout: class WEST1 { displayName = "Light"; icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa"; role = "Test"; weapons[] = { "arifle_MXC_F", "Binocular" }; magazines[] = { "30Rnd_65x39_caseless_mag", "30Rnd_65x39_caseless_mag", "SmokeShell", "SmokeShell" }; items[] = { "FirstAidKit" }; linkedItems[] = { "V_Chestrig_khk", "H_Watchcap_blk", "optic_Aco", "acc_flashlight", "ItemMap", "ItemCompass", "ItemWatch", "ItemRadio" }; uniformClass = "U_B_CombatUniform_mcam_tshirt"; backpack = "B_AssaultPack_mcamo"; }; _respawnTemplateDisplayName would return "Light" -
BIS respawn system, how to determine role after respawn?
HallyG replied to jwllorens's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm not sure if you can but I know that if you setup your templates using the following (different vehicle for each template): class EXAMPLE { vehicle = "B_soldier_AR_F" }; You can then check what loadout was chosen corresponding to the change in unit type, from the typeOf command. -
Amplifying thunder and lightning help.
HallyG replied to aetherthedragon's topic in ARMA 3 - MISSION EDITING & SCRIPTING
This might be a starting point for you, I used part (edited other parts) of the BIS function to create lightning and then just added a loop essentially: h = [] spawn { private _fncLightning = { params [ ["_centre", position player, [[]]], ["_radius", 300, [0]], ["_dir", random 360, [0]] ]; private _pos = _centre getPos [_radius, _dir]; private _bolt = createVehicle ["LightningBolt", _pos, [], 0, "can collide"]; _bolt setPosATL _pos; _bolt setDamage 1; private _light = "#lightpoint" createVehiclelocal _pos; _light setPosATL (_pos vectorAdd [0,0,10]); _light setLightDayLight true; _light setLightBrightness 300; _light setLightAmbient [0.05, 0.05, 0.1]; _light setlightcolor [1, 1, 2]; sleep 0.1; _light setLightBrightness 0; sleep (random 0.1); private _lightning = (selectRandom ["lightning1_F","lightning2_F"]) createVehiclelocal [100,100,100]; _lightning setdir _dir; _lightning setpos _pos; for "_i" from 0 to (3 + random 1) do { private _time = time + 0.1; _light setLightBrightness (100 + random 100); waituntil { time > _time }; }; deletevehicle _lightning; deletevehicle _light; }; while {true} do { _intensity = 2 + floor (random 3); for "_i" from 0 to (_intensity -1) do { [position player, linearConversion [0, 1, random 1, 300, 800]] call _fncLightning; }; sleep 2 + (random 2); }; }; Put that in the debug console, I can add comments if you want me to. -
AI Bailing From Damaged Chopper/Vehicle To Their Doom
HallyG replied to Hybrid V's topic in ARMA 3 - MISSION EDITING & SCRIPTING
nvm misread that you had already tried it -
How to change array to single class name for using to find parent class?
HallyG replied to nebulazerz's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'll further this idea with a quote from Aristotle: “For the things we have to learn before we can do them, we learn by doing them.†-
JBOY Molotov Cocktail script [Beta release]
HallyG replied to johnnyboy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Known Issues:If bottle hits roof of building, fire is spawned a few meters above roof instead of at impact point. Needs to be debugged. To fix the house fire spawning, in JBOY_molotov.sqf, change: if ((_prevpos select 2) > _maxHeight) then { _logic setPos [_prevpos select 0, _prevpos select 1, _maxHeight]; }; }; _logic setPos _prevpos; to if ((_prevpos select 2) > _maxHeight) then { _logic setPosATL [_prevpos select 0, _prevpos select 1, _maxHeight]; }; }; _logic setPosATL _prevpos; Nice script all the same, reminds me of your script for Armed Assault way back when :) -
Friendly AI take no damage from players
HallyG replied to bazzaro135's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'll try my best to explain: params: Essentially you can "Parse input arguments into an array of private variables". If no argument is provided then _this is automatically used. In this case, _this is used and automatically creates and privates the variables as well as assigning a value to each. argument params [element1, element2,...elementN] //Example from wiki [1, 2, 3] call { private ["_one", "_two", "_three"]; _one = _this select 0; _two = _this select 1; _three = _this select 2; // ..... }; // Same as above, only using params [1, 2, 3] call { params ["_one", "_two", "_three"]; // ..... }; select: The syntax I'm using is relatively(?) new and follows: _newArray = _oldArray select expression The expression is code that will return true. The new array will only contain elements from the old array that satisfied the expression. For example, in the above case: allUnits select {!isPlayer _x} This will return an array of all units that are not players. Another example (from the wiki): _even = [1,2,3,4,5,6,7,8,9,0] select {_x%2 == 0}; // returns [2, 4, 6, 8, 0] So overall, the wiki is much better at explaining than I am (thank goodness I don't write handbooks for a living). Highly suggest giving it a read and playing around with the examples. Edit 1: I can't spell.