Jump to content

7erra

Member
  • Content Count

    653
  • Joined

  • Last visited

  • Medals

Everything posted by 7erra

  1. The issue might be because you are creating the debug console as a display on top of the 3den display. If you create another display on top of the 3den display all others will be closed. But since the display is still running scheduled code it crashes as it is not done yet.
  2. 7erra

    Arma III switchLight Coding

    Do the same as the foreach loop above: { _x switchLight "OFF"; } forEach nearestObjects [thisTrigger, [ /* list of classnames */ ], 10000];
  3. Hmm with a bit of work it should be possible. The shop is tied to the object which is saved as the variable TER_VASS_shopObject, see https://github.com/7erra/VASS-Virtual-Arsenal-Shop-System/blob/master/VASS/fnc/fn_addShop.sqf#L27 . So you could modify the function and replace this line with another object (eg. an invisible object) which holds the actual inventory added with https://github.com/7erra/VASS-Virtual-Arsenal-Shop-System/blob/master/VASS/fnc/fn_addShopCargo.sqf The TER_fnc_addShop is called to declare the object (this, variable from the Eden init line referring to the object) as a shop. The cargo is then added with the TER_fnc_addShopCargo with a special array which lists all items, prices and amounts. The VASS Eden Mod (not the core system! the scripted approach still works!) is currently broken and I can't really tell why it just suddenly stopped working...
  4. VASS - Virtual Arsenal Shop System Introduction VASS provides a simple to setup shop system and is the successor to the Arsenal Shop. The system provides several functions to handle traders and items. As of now it does not come bundled with an economy system but the implementation of an external one is easily possible. Setup Enable system: Download the GitHub repo: https://github.com/7erra/VASS-Virtual-Arsenal-Shop-System Place the VASS folder inside of your mission folder where the mission.sqm is located Copy the description.ext to the same directory or modify your own with the content of the provided one Add trader: Execute the addShop function: [this] call TER_fnc_addShop Add an inventory with the addShopCargo function: [this, ["itemclass0", 15, 5, ..., "itemClassN", price, amount]] call TER_fnc_addShopCargo For easier setup of this cost table I have created a mod that does this task with a user interface: https://steamcommunity.com/sharedfiles/filedetails/?id=1760193128. The settings can be changed by opening the object's attribute window and scrolling down to the "VASS" section. Handle money: Edit the TER_fnc_VASShandler in "VASS\fnc\fn_VASShandler.sqf" Change the getMoney and setMoney functions to match your economy system Documentation GitHub will have a wiki on all aspects of the system. In addition to that all relevant functions have a header at the beggining of the file to show you what arguments they expect and what they do. Further links GitHub: https://github.com/7erra/VASS-Virtual-Arsenal-Shop-System VASS 3den mod: https://steamcommunity.com/sharedfiles/filedetails/?id=1760193128 BI forums: https://forums.bohemia.net/forums/topic/219677-release-virtual-arsenal-shop-system/ Screenshots That's all for now and I hope that you find this useful! 7erra DISCLAIMER - This post was edited nearly a year after the original post. Don't expect comments from the previous discussion (up until page 5) to be applicable to the new system
  5. if you've never heard of it it might seem like that, but they are screen coordinates: https://community.bistudio.com/wiki/Arma_3:_GUI_Coordinates Not quite. safeZoneW is just the width of your screen in Arma's UI coordinates. So the maximum width a CONTROL can have before going offscreen. So, safeZoneW is the width of the screen in screen coordinates, getTextWidth returns the needed width of a control in screen coordinates to display the whole text. that control can also be wider than the screen. the cutText command also automatically breaks lines (it most likely uses a CT_STRUCTURED_TEXT control) so to predict how many lines there are going to be, you'd need to know the width of that control but as it is handled by the engine I am not sure how to find that out.
  6. Looking at the function you can also do this: ["Open", [false, _center]] call BIS_fnc_garage; where the second param is the center you currently set with "BIS_fnc_garage_center = vehicle player;" Also no need to set the global variables twice (global_var = value and missionNamespace setVariable ["global_var", value] are the same, capitalization doesn't matter) Have you tried using the example from the biki to see if it works?
  7. My idea would be to loop over the array of building positions, something like private _buildings = /* code to get all buildings in the vicinity */; private _buildingPositions = flatten (_buildings apply {_x call BIS_fnc_buildingPositions}); { _x moveTo (_buildinPositions select _forEachIndex); } forEach units group player; with the select command: _houses = [_xpos,_ypos] nearObjects ["House", 20]; _housesWithAtLeast2BuildingPositions = _houses select {count (_x buildingPos -1) > 1}; Another time where sqf could make use of OOP. Anyway, you could track the taken positions in a variable with taken positions (in addition to the first code): private _buildings = /* code to get all buildings in the vicinity */; private _buildingPositions = _buildings apply {_x call BIS_fnc_buildingPositions}; _buildingPositions = flatten _buildingPositions; // makes the array 1D but keeps the positions in order { private _pos = { if !(_x in TAG_takenPositions) exitWith { TAG_takenPositions pushBack _x; _x // assign this position to the _pos variable }; } forEach _buildingPositions; _x moveTo _pos; } forEach units group player; All this code is just from the top of my head and not tested. You would also have to accomodate for edge cases, like no nearby buildings or not enough building positions.
  8. two things I notice: 1) You are setting the data after the Garage is already open. try executing BIS_fnc_garage_data = ... before ["Open"] call BIS_fnc_garage 2) You are opening an unlimited Garage by passing the second parameter "true". Try ["Open"] call BIS_fnc_garage instead
  9. >>> STEAM WORKSHOP PAGE <<< Foreword I hereby present you my first mod which aims to make editing a bit easier. The main focus lies on the added debug console which will provide you with the most common debug options (at least the ones I use). It also contains a good deal of customizability. While all options are fully functional I may change some of them (see Ideas section below). The mod has been on the Steam Workshop for about a month now but now I feel like it is actually worth using. Features Pictures and videos can be found on the Steam Wokshop. Extended debug console: Adds way more features to the escape menu in the style of the vanilla A3 debug console. It contains the following options: Page 1 - Misc Live Debug: Evaluate expressions from the Watch fields of the vanilla debug console in real time Side Player: Switch sides with two clicks (Doesn't work when capitve) Enable Teleport: Go to the position under the cursor by pressing SHIFT+T Show Icons over units: Does what it says Draw Grids: First checkbox enables grids in the GUI Editor for better alignment and orientation, second one draws it on the mission display Change GUI Grid: Origin: Select where the controls should be oriented to. Important when using different UI sizes Set: The editboxed are editable and this button applies the changes to the grid variable loaded in the GUI Editor Export Grid: Copies the defines to the clipboard All settings are saved across sessions (profileNamespace) Clear Chat: Removes all previous messages Switch Unit: Move into the unit under your cursor Set Time: Got from day to night and vice versa or enjoy a nice sunset/-rise Page 2 - More Watch Fields Just like the watch fields from the vanilla debug console but unlimited in amount Create new controls with the "+" button Delete entry with the red X button Page 3 - Custom Commands A place to store your most used commands, like setDate, setPos etc Create new control with the "+" button Delete controls with the red X button Execute a command with the "EXEC" button MP only: Change where the command is executed Output of the commands can be seen in the output of the vanilla debug console Page 4 - Saved Watch Entries, Target Debugging, BIKI Links Saved Watch Entries: Save an expression from the vanilla debug's watch field by pressing CTRL+F The preferred input can be selected from the combo First empty goes from top to bottom and if no empty box is found, the first one is overwritten Same goes for "Last Empty" but from bottom to top Clear List will remove ALL entries and reset the profile variable Target Debugging: Check the checkbox to draw boxes at the position of units nearby with the commands set in the listbox "+" adds the command in the editbox, "-" removes currently selected entry (same as pressing DELETE) The variable _object is automatically added after the command if not specified BIKI Links Write out a command and add it to the structured text controls for fast access to the BIKI Remove a command by adding it again Remove all commands with #CLEAR Also supports links with http in them Page 5 - Unit Live Watch Select a unit from the tree control to attach a camera behind it The tree supports searches from the editbox By ticking the checkbox on the top right corner of the camera the feed will be kept open after closing the escape menu Page 6 - KK Debug Disclaimer: If you don't trust the debug_console_x64.dll then you are free to delete it. It is only mandatory for this page. KK Debug is a small extension to log info to a console window outside of the game and therefore is a cleaner option than the rpt file By using #include "\TER_Editing\debug_console.inc" you can use the macros in your script as well For more information go to KK's website BEEP will make the console window move into the foreground and give out a noise As it stands right now the console is not entierly functional. Here are some problems I encountered: Log to file doesn't create a file Beep moves the console away from it's original position Clear has the same problem Close doesn't do anything Log time will add a prefix with the system time to the output Log input creates an extra line before the output and contains the content of the input editbox The log button will output the result and, if selected, the input to a new window 3den Editor: Find Object Type on Map: Creates a map marker and a 3D marker on the position of every object with the same class name. Useful to find certain house types. Show Building Positions: Creates 3D markers on the positions of the building positions used with buildingPos[community.bistudio.com]. Structured Text Editor: Create structured texts with live preview. Font Picker: Preview all fonts available ingame (including mods). Color Picker: Find the correct color with multiple export options (RGBA, config, texture, HTML). attachTo finder: Instead of trial and error use this tool to find the perfect offset and direction. DIK Code Display: While open hit any key (except for ESCAPE) to get the corresponding ID, hex value and variable from "\a3\ui_f\hpp\definedikcodes.inc" Export Marker: Copies the marker in the format used by BIS_fnc_stringToMarker to the clipboard. Saves several lines of code. Misc: Export button for the CfgViewer: Export the currently selected config with a single click! Escape shortcuts: While in the escape menu you can press CTRL+R to restart the mission or CTRL+E to exit it. Functions: TER_fnc_controlInfo can show additional information about the controls of the selected displays. Really useful if you want to learn from BI. TER_fnc_convertNumber: Convert from and to hexadecimal, decimal and binary. Only meant for use during editing as it would create a dependency. If you know how to copy it then feel free to use it. TO DO: Integrate debug console into the vanilla one Fixes UNKNOWN BUG: When selecting the third page the index of the listbox jumps to the fifth (???). Steam Workshop page: https://steamcommunity.com/sharedfiles/filedetails/?id=1387934106 GitHub repository: https://github.com/7erra/-Terra-s-Editing-Extensions >>> STEAM WORKSHOP PAGE <<< Bye for now, 7erra
  10. Yes for debugging it is possible to use allowFunctionsRecompile in the description.ext: https://community.bistudio.com/wiki/Description.ext#allowFunctionsRecompile
  11. If you are using ctrlCreate you don't need to have base classes defined. Also instead of BIS_fnc_exportGUIBaseClasses use the new import directive. For simple UIs: Go for it. Keep in mind though that some control attributes are not editable via script, like the rows of a CT_TOOLBOX.
  12. Bohemia Interactive Community Wiki (BIKI) Tools https://github.com/7erra/BikiTools What is it? This tool should help with bringing sqf code to the BIKI. It automatically formats the input to be used in the Mediawiki syntax used by the BIKI. Normally this would be tedious work where you have to write you code, test it and then add formatting which in turn renders the formatted code unusable in the game. In case you would have to make changes to the code you would now have to remove the Mediawiki formatting, change your code and reformat it. With this tool you can just write your code and copy-paste it into the UI without making changes to the sqf script. The full list of features (currently rather short) can be found in the Readme on GitHub. Who is it for? It was created to help BIKI contributors and those that want to become one (wink wink nudge nudge 😉 ). How can I get it? You can download an installer from the GitHub Releases page. Where can I use it? This tool is a WPF project written in C#. This means that it is only available to Windows users. How do I use it? You copy-paste your code in the left window. The formatted code is displayed in the right window. You can choose which codehighlighting should be applied by making a selection in the bottom right corner. Now you can copy the output and paste it to the BIKI.
  13. Huh you are right. I changed the Biki entry.
  14. 7erra

    What exactly do savegames save?

    Why guess when you can debinarize the save file with https://community.bistudio.com/wiki/CfgConvert😉
  15. You can remove the default behavior by removing all events from the button and then making your own event: #include "\a3\ui_f\hpp\defineResincl.inc" [missionNamespace, "OnGameInterrupt", { params ["_display"]; private _btnSave = _display displayCtrl IDC_INT_SAVE; _btnSave ctrlRemoveAllEventHandlers "ButtonClick"; _btnSave ctrlAddEventHandler ["ButtonClick",{ params ["_btnSave"]; // Do stuff }]; }] call BIS_fnc_addScriptedEventHandler; IDC_INT_SAVE is 119 btw. I am not sure if it is possible to create manual save games though. According to the BIKI https://community.bistudio.com/wiki/saveGame saves are auto saves.
  16. EDIT: Just now noticed that it doesn't matter if it is manual or automatic, so you can use the OnSaveGame scripted EH https://community.bistudio.com/wiki/Arma_3:_Scripted_Event_Handlers Old answer (only detects manual saving): since the game is saved via a button click you could add an eventhandler to the button, so something like: #include "\a3\ui_f\hpp\defineResincl.inc" [missionNamespace, "OnGameInterrupt", { params ["_display"]; private _btnSave = _display displayCtrl IDC_INT_SAVE; _btnSave ctrlAddEventHandler ["ButtonClick",{ params ["_btnSave"]; // Do stuff }]; }] call BIS_fnc_addScriptedEventHandler;
  17. Can't confirm, works for me. Maybe you are not allowing suspension? Safest bet is to always spawn the function.
  18. 7erra

    Get Handle on Ctrl

    https://community.bistudio.com/wiki/GUI_Tutorial#UI_Scripts There it is
  19. 7erra

    Get Handle on Ctrl

    the first syntax is not entirely safe. if you have multiple dialogs open it might not change the text of the control you are aiming for. the other syntax with "_ctrl ctrlSetText "text"; " is the better option. yes. config and sqf are two very different worlds. unfortunately, getting control handles is tedious. the usual concept would be: Use _display = findDisplay IDD; to get the display (or use the params from the onLoad UIEH*) Then use _ctrl = _display displayCtrl IDC; to get your control Always use the syntax with _ctrl COMMAND rightArguments instead of relying on the idc *Using the onLoad UIEH and params is the most elegant way. i am going to add some info to https://community.bistudio.com/wiki/GUI_Tutorial on how BI structures their UI scripts.
  20. Interesting since you can't actually use it
  21. Looked throught the config.cpp of \a3\ui_f for a class containing the string "hint". I knew that the hint command only works with string and structured text so the control that displays the text can only be a RscStructuredText control. When I found some possible candidates I copied their config into a description.ext of a test mission and created the display to see what it looks like and the RscHint was the right one.
  22. The idd is 301. Though it seems weird that infistart is able to block that as it is not a display but rather a subclass of RscInGameUI which sqf has no control over...
  23. You can create your own respawn behavior by using onPlayerRespawn.sqf and onPlayerKilled.sqf. You can keep a player in the spectator mode by setting his respawn timer to a high value, 1e+6 (10^6) for example. If you want him to respawn you can set his respawn time to a lower value again, for example 0 for instant respawn. For example: description.ext respawn = 3; respawnDelay = 1e+6; respawnTemplates[] = { "Base" }; respawnOnStart = -1; onPlayerKilled.sqf sleep 5; ["Initialize", [ _unit, // spectator [west], // allowed sides false, // allow AI false, // allow free camera false, // allow 3rd person camera true, // show focus info false, // show camera buttons false, // show controls helper true, // show header true // show lists ]] call BIS_fnc_EGSpectator; onPlayerRespawn.sqf: params ["_player", "", "", "_delay"]; if (alive _player) then { //--- Player is not spectating, do nothing if !(["IsSpectating"] call BIS_fnc_EGSpectator) exitWith {false}; //--- Player can be respawned from spectator // You might want to move the player to a specified position here, eg // [_player, /*position*/, false] call BIS_fnc_moveToRespawnPosition; ["Terminate"] call BIS_fnc_EGSpectator; setPlayerRespawnTime _delay; true } else { //--- Player is dead // Do stuff here before player respawns //--- Respawn player setPlayerRespawnTime 3; false }; Not sure if this does work. I copied it from one of my missions and removed unnecessary bits,
  24. Yes it is possible to hide controls. The map is a bit special so instead of using the usual commands such as ctrlDelete or ctrlShow we have to rely on giving the control a zero width: _control ctrlSetPositionW 0; _control ctrlCommit 0; To get the the correct control we use findDisplay 12 displayCtrl _idc; The IDCs are defined in the config under configFile >> "RscDisplayMainMap" or if you have the data unpacked: \a3\ui_f\config.cpp (search for the class name). You can also open the map in the GUI Editor by pressing CTRL+I and enter configFile >> "RscDisplayMainMap" to import the map. You need to delete some overlaying controls to show the underlying controls. I moved my mouse near the edge of the screen and spammed the DEL key. Here is a script that hides the left listbox (containing stuff like Map, Briefing, Team...) and the top bar: #include "\a3\ui_f\hpp\defineResincl.inc" _displayMap = findDisplay 12; _fncHideControls = { _this apply { _c = _displayMap displayCtrl _x; _c ctrlSetPositionW 0; _c ctrlCommit 0; }; //--- Hide left hand diary list _idcsHide = [IDC_DIARY_TOPIC_LIST, IDC_DIARY_TOPIC_BACKGROUND]; _idcsHide call _fncHideControls; //--- Top bar #define IDC_DIARY_MAINBACKGROUND 1020 #define IDC_DIARY_MAINBACKGROUNDGRADIENT 1200 #define IDC_DIARY_TOPRIGHT 2302 _idcsHide = [IDC_DIARY_MAINBACKGROUND, IDC_DIARY_MAINBACKGROUNDGRADIENT, IDC_CANCEL, IDC_DIARY_TOPRIGHT, IDC_DIARY_MISSION_NAME]; _idcsHide call _fncHideControls; _ctrlMap = _displayMap displayCtrl 51; _ctrlMap ctrlSetPosition [safeZoneX, safeZoneY, safeZoneW, safeZoneH]; // resize map control to full screen _ctrlMap ctrlCommit 0;
×