Jump to content


  • Content Count

  • Joined

  • Last visited

  • Medals

Community Reputation

42 Excellent

About thy_

  • Rank

Profile Information

  • Gender
  • Location

Contact Methods

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Oi, @avibird 1 @avibird 1 , I hope your code can bring ideas or, at least, help those who are looking for a simpler solution. Yes, please.
  2. Just coming back to share the solution is present in my Vehicle Overhauling Script: Thanks, @pierremgi, and @Larrow for the ideas. Resuming the solution: Instead of looking for cables in the aircraft carrier asset, reading the Jets DLC functions, I realized that the USS Freedom asset is composed of 3 smaller assets. I've stored your asset classnames in a list, and as soon as a plane approaches any classname within the list, the plane gets the action to rearm, repair, and refuel. fn_VO_parameters.sqf: VO_assetsRangeChanger = ["Land_Carrier_01_hull_08_1_F","Land_Carrier_01_hull_07_1_F","Land_Carrier_01_hull_06_1_F"]; fn_VO_globalFunctions.sqf THY_fnc_VO_isStationRangeChanger = { // This function checks if the current station has the ability to change its service range to attemp planes only. If so, the range is increase where _servRng != _currentRng. // Returns the integer range _currentRng. params [["_stat", objNull], ["_veh", objNull], ["_hasRngChanger", false], ["_servRng", 20]]; private ["_rangeChanger", "_currentRng", "_statType"]; _rangeChanger = 80; _currentRng = _servRng; if ( !_hasRngChanger ) exitWith { _currentRng /* Returning. */ }; // Handling Errors: if (_stat isEqualTo objNull) exitWith {if (VO_debugMonitor) then {systemChat "VO > THY_fnc_VO_isStationRangeChanger error: needs a station as parameter."; sleep 15}}; if (_veh isEqualTo objNull) exitWith {if (VO_debugMonitor) then {systemChat "VO > THY_fnc_VO_isStationRangeChanger error: needs a vehicle as parameter."; sleep 15}}; _statType = typeOf _stat; // Range-Changer trigger to action: if ( _veh isKindOf "Plane" AND _statType in VO_assetsRangeChanger ) then { if ( _servRng < _rangeChanger ) then { _currentRng = _rangeChanger }; if ( VO_debugMonitor AND (_currentRng >= _rangeChanger) AND ((_veh distance _stat) <= _currentRng) ) then { systemChat format ["DEBUG: station %1 is a RANGE-CHANGER, its service range increase to %2m for Planes.", _statType, _currentRng]; sleep 3; }; }; _currentRng // returning. }; Cheers, thy SOLVED.
  3. To make it easier, I already updated the first message and the download file with some progress. Some advice or code lines would be awesome from you.
  4. Everyone, the script has been updated. The first message on this topic is already updated too: 😊 Changelog VO v2.1: NEW - Now Aircraft Carrier USS Freedom asset can provide all services exclusively for planes. Others vehicles from air and ground doctrine will need some specific assets on carrier's deck to access their available services; NEW - Amphibious vehicles even from Air or Ground doctrine are allowed to get services at stations of Nautical doctrine; NEW - When debug is true, the mission editor has now an expanded handling error messages and other alerts to help them to find out misconfiguration; FIXED - fixed the rearming issues around vehicle with different amount of magazines and turrets; FIXED - fixed the bug (remoteExec) in Dedicated Server with parking helper assets weren't doing correctly the plane manouver inside the hangars; FIXED - bug that made ground and nautical vehicles with complex weaponry don't rearm properly; FIXED - bug that, after a landing, helicopters were able to rearm if they take off but stay into the service range, even on air; PERFORMANCE IMPROVED - more functions, less repeatable code lines; PERFORMANCE IMPROVED - duplicated content inside asset arrays are automatically deleted; Documentation has been updated.
  5. Folks, I'm running around without a perfect solution to rearm vehicles with turrets and vehicles with pylons. Simplifying many things, here is an example of my solution so far (and definitely not good enough for players who want to see each magazine get its pylon in those cases). Issue 1) Conditional: How to know if only X% (50%, for example) of the vehicle's mag capacity is available? I wanna check it to decide if the vehicle needs to rearm; // I found it, but I don't got what exactly is happening: ({getNumber (configFile >> "CfgMagazines" >> _x select 0 >> "count") == _x select 1} count magazinesAmmo _veh) == 0) Issue 2) Rearmament Execution: I already coded a solution to check and change the magazines in a turret, but I'm in trouble around pylons in planes and helicopters. Current solution: // File: veh_rearming.sqf private ["_veh", "_vehType", "_vehMags", "_magsRemoved", "_mag"]; while {true} do { _veh = vehicle player; // I'm using "player" just to simplify the example. For multiplayer missions, it doesn't work well and you must check each player in mission. if ( (count weapons _veh > 0) AND (speed _veh == 0) AND (({getNumber (configFile >> "CfgMagazines" >> _x select 0 >> "count") == _x select 1} count magazinesAmmo _veh) == 0) ) then { _vehType = typeOf _veh; _vehMags = compatibleMagazines _vehType; // figuring out all mags types are default for the vehicle. if ( _veh isKindOf "Plane" OR _veh isKindOf "Helicopter" ) then { // Specific and lazy solution for vehicles with pylons (planes and helicopters) to simplify the rearming as they work differently to turrets: [_veh, 1] remoteExec ["setVehicleAmmo", _veh]; playSound3D ["a3\sounds_f\sfx\ui\vehicles\vehicle_rearm.wss", _veh]; sleep 3; format [">> The %1 has been REARMED!", typeOf (vehicle player)] remoteExec ["systemChat", player]; } else { _vehMags = magazinesAllTurrets _veh; // list of all magazines (include the empty ones) and its data as projectiles left, etc. _magsRemoved = []; for "_i" from 0 to ((count _vehMags) - 1) do // building the removing mag looping from the amout of vehicle magazine capacity. { _mag = (_vehMags select _i) select 0; // selecting only the magazine classname; _veh removeMagazines _mag; _magsRemoved pushBack _mag; }; { // forEach for add new mags based on those ones already removed: _veh addMagazine _x; format [">> Ammo %1 on board...", _x] remoteExec ["systemChat", player]; playSound3D ["a3\sounds_f\sfx\ui\vehicles\vehicle_rearm.wss", _veh]; sleep 3; } forEach _magsRemoved; // if something goes wrong with reloading, this will help to fix as vehicle smoke granades sometimes don't reload: [_veh, 1] remoteExec ["setVehicleAmmo", _veh]; format [">> The %1 has been REARMED!", typeOf (vehicle player)] remoteExec ["systemChat", player]; }; } else { sleep 3; }; }; Inconsistencies of the solution above: If the vehicle is configured by Editor to spawn with NO AMMO, if you try to rearm that vehicle, it will never have this original number of magazines loaded; Vehicles with pylons are no working as other vehicles with turrets that each ammo is loaded individually (on its pylon in planes and helicopters); P.S.: No worries regarding drone vehicles. The download of my problematic example: https://drive.google.com/file/d/14vjjl3HsImEDfhybzbt_0YkJptuNYJru/view?usp=sharing
  6. thy_

    Simple Rearm Script

    Hey @scottb613, a strategy I'm using in the new (and unpublished yet) version of the Vehicle Overhauling Script is to read with kind of ammo magazines the vehicles got, remove them with looping and, after that, add each new magazine again. _object = _this; _type = typeOf _object; _magazines = getArray(configFile >> "CfgVehicles" >> _type >> "magazines"); if (count _magazines > 0) then { _removed = []; { if (!(_x in _removed)) then { _object removeMagazines _x; _removed = _removed + [_x]; }; } forEach _magazines; { _object addMagazine _x; } forEach _magazines; }; _count = count (configFile >> "CfgVehicles" >> _type >> "Turrets"); if (_count > 0) then { for "_i" from 0 to (_count - 1) do { _config = (configFile >> "CfgVehicles" >> _type >> "Turrets") select _i; _magazines = getArray(_config >> "magazines"); _removed = []; { if (!(_x in _removed)) then { _object removeMagazines _x; _removed = _removed + [_x]; }; } forEach _magazines; { _object addMagazine _x; } forEach _magazines; _count_other = count (_config >> "Turrets"); if (_count_other > 0) then { for "_i" from 0 to (_count_other - 1) do { _config2 = (_config >> "Turrets") select _i; _magazines = getArray(_config2 >> "magazines"); _removed = []; { if (!(_x in _removed)) then { _object removeMagazines _x; _removed = _removed + [_x]; }; } forEach _magazines; { _object addMagazine _x; } forEach _magazines; }; }; }; }; _object setVehicleAmmo 1; // Reload turrets / drivers magazine Hope this piece of code brings ideas for you.
  7. Hey there, tudo bem com você? 😄 Just sharing with you all my configs for Visual Studio Code (VS Code), a simple and feasible coding tool for Arma 3, even in 2022 where, if you already tried to use some available extensions, may be frustrating. If you got some smart stuff to VS Code, please, be kind and share it here 😉 VS Code here on my end: VS Code > tool download (free): https://code.visualstudio.com/download (Win/Linux/Mac) VS Code > Essential extensions for Arma 3: SQF-VM Language Server by SQF-VM https://marketplace.visualstudio.com/items?itemName=SQF-VM.sqf-vm-language-server SQF Language Updated by blackfisch https://marketplace.visualstudio.com/items?itemName=blackfisch.sqf-language SQFLint by SkaceKachna https://marketplace.visualstudio.com/items?itemName=skacekachna.sqflint SQF Wiki by Eelis Lynne https://marketplace.visualstudio.com/items?itemName=EelisLynne.sqf-wiki VS Code > extensions recommended: Theme: Atom One Dark Theme https://marketplace.visualstudio.com/items?itemName=akamud.vscode-theme-onedark VS Code > My customs to help for ARMA: Ctrl+Shift+P; Type "settings.json" (no quotes) and select "Open USER settings (json)"; Adapt the code below for your like: { "sqf.enableCBA": true, "sqf.enableACE3": true, "workbench.iconTheme": null, "workbench.colorTheme": "Atom One Dark", "editor.minimap.enabled": false, "breadcrumbs.enabled": false, "editor.renderWhitespace": "all", "workbench.activityBar.visible": false, "zenMode.hideLineNumbers": false, "security.workspace.trust.untrustedFiles": "open", "editor.wordWrap": "on", "diffEditor.wordWrap": "on", "files.autoSaveDelay": 5000, "editor.tokenColorCustomizations": { "[Atom One Dark]": { "variables": "#eb54de", "functions": "#ff9b58", "numbers": "#49f5b3", "strings": "#70fa20", "keywords": "#fc6620", "comments": "#505050", "types": "#0004ff", "textMateRules": [ { "scope": ["constant.other"], "settings": { "foreground": "#1400c4" } }, { "scope": ["support.function"], "settings": { "foreground": "#fff5cb", "fontStyle": "italic" } }, { "scope": ["keyword.operator"], "settings": { "foreground": "#7ee9fc", "fontStyle": "bold" } }, { "scope": ["variable.language"], "settings": { "foreground": "#a13140" } }, { "scope": ["meta.function-call"], "settings": { "foreground": "#fc6620" } }, { "scope": ["punctuation.terminator"], "settings": { "foreground": "#ffffff" } }, ] } }, "editor.semanticHighlighting.enabled": true, "editor.semanticTokenColorCustomizations": { "[Atom One Dark]": { "enabled": true, "rules": { "*.declaration": { "bold": true } } } }, "files.associations": { "*.json": "jsonc" }, "C_Cpp.autocompleteAddParentheses": true, "sqflint.checkPaths": true } Share your thoughts and exp 😉
  8. Forget. 🤣 If the Trigger's array got one or more vanames and those triggers don't exist on Eden Editor, the "Error Undefined Variable" is shown up. Thanks.
  9. You right, @Harzach. I didn't notice, even though with the error below, that forEach works in my tries with no quotes. Some advice to avoid this error? It says the trigger var names are not defined. How can I define them since they're just triggers?
  10. Pretty sure I'm stepping through a basic question but, really, I've TRIED hard all this afternoon to find out on my own how to make the forEach understand the array content are trigger variable names already dropped in place via Eden Editor. myTriggersVarNames = [ "myTrg1", "myTrg2", "myTrg3" ]; while {true} do { // Doesn't work: { if (player inArea _x) then { systemChat "Player inside the trigger"; }; } forEach myTriggersVarNames; // Working fine: /* if (player inArea myTrg1) then { systemChat "Player inside the trigger" }; */ sleep 3; }