Jump to content

7erra

Member
  • Content Count

    753
  • Joined

  • Last visited

  • Medals

Everything posted by 7erra

  1. You should use the GUI_GRID for this (or pixelGrid but meh): #include "\a3\ui_f\hpp\definecommongrids.inc" Task1 = [ "<img align=''right'' img size='8' image='images\task1.paa' shadow='0'/>", GUI_GRID_TOPLEFT_X + 1 * GUI_GRID_TOPLEFT_W, GUI_GRID_TOPLEFT_Y + 1 * GUI_GRID_TOPLEFT_H, 50, 1, 0, 222 ] spawn bis_fnc_dynamicText; GUI_GRID_TOPLEFT_X is the same as safeZoneX, GUI_GRID_TOPLEFT_Y is safeZoneY. The important ones are GUI_GRID_TOPLEFT_W and _H. You can try around with the 1* multiplier to find a suitable location for the text.
  2. 7erra

    Button with icon

    No need for controlsgroups or more than one control. RscButtonMenu supports images by default: class RscButtonMenuPicture: RscButtonMenu { idc = -1; text = "Text"; x = 8.5 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X; y = 22 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y; w = 10.5 * GUI_GRID_CENTER_W; h = 2 * GUI_GRID_CENTER_H; textureNoShortcut = "path\to\image.paa"; // This is the image to be displayed // Position of the text: class TextPos { // Positions in ui coordinates are relative to the button left = 2 * GUI_GRID_W; top = 0.5 * GUI_GRID_H; right = 0.005; bottom = 0; }; // Position of the image: class ShortcutPos { left = 0; top = 0; w = 2 * GUI_GRID_W; h = 2 * GUI_GRID_H; }; };
  3. 7erra

    Question about GUI

    Well it can be done in a similar way, so a dialog with an object with controls on it: class RscTestObjectUI { idd=-1; class objects { class TestObject: RscObject { type=82; idc=-1; scale=0.2; model="\A3\Misc_F\Helpers\UserTexture1m.p3d"; position[]={0,0,0.2}; positionBack[]={0,0,0.2}; inBack=0; enableZoom=1; zoomDuration=0.5; direction[]={1,0.25,1}; up[]={0.25,1,0}; class Areas { class Usertexture { selection="usertexture"; class controls { class Test: RscText { text="Schnobble"; sizeEx=0.30000001; colorText[]={0,1,0,1}; colorBackground[]={0,1,0,1}; x=0; y=0; w=1; h=0.5; shadow=0; }; class Picture: RscPicture { text="a3\Ui_f\data\Logos\bi_white_ca.paa"; x=0; y=0.5; w=0.5; h=0.5; }; }; }; }; }; }; }; This is from the a3\ui_f\config.cpp, also @killzone_kid did something like this: http://killzonekid.com/arma-scripting-tutorials-gui-part-6/ Also this post by @HazJ:
  4. Or if you want to avoid global variables: Option 1) Use BIS_fnc_netID and then BIS_fnc_objectFromNetID Option 2) Save the variable to the display: _display setVariable ["UAVArray", _uavArray]; // To access it: _display getVariable ["UAVArray", []];
  5. Looks like your charachter is playing an animation. You can terminate that with player switchMove "";
  6. At the end of a KeyDown UIEH always return false: _display displayAddEventhandler ["KeyDown",{ /* code */ false }; Otherwise you are overwriting the default behaviour of that key, or in other words, intercept any following input.
  7. 7erra

    Lock camera from menu

    Two things: 1) The display config, either look at it in the config browser or setup the P drive and export the game files 2) These two files contain most IDCs: "a3\ui_f\hpp\defineresincldesign.inc" "a3\ui_f\hpp\defineresincl.inc"
  8. 7erra

    Lock camera from menu

    I am 99% sure that there is no error in that line. My guess is that you are trying to execute the code in an unscheduled environment and it is throwing an error because of the waitUntil statement. Anyway, I would recommend to use @Larrow's code since it is way smarter. Why do you not want to make a description.ext? It is really only that one line that @Larrow posted that you have to add to the description.ext.
  9. _this call { params ["_bim", "_player", "_fa"]; }; _this is (usually) an array, see https://community.bistudio.com/wiki/Category:Data_Types and https://community.bistudio.com/wiki/Magic_Variables#this . The params command is essentially only assigning variables to the elements of that array: private _element1 = _this select 0; // SAME AS: params ["_element1"]; Also, all opening brackets ( "(, [, {" ) must be closed again. Pay attention to the syntax of the commands you use: https://community.bistudio.com/wiki/SQF_syntax.
  10. There is so much wrong with this script. Please read the BIKI more carefully.
  11. 7erra

    Lock camera from menu

    if (!hasInterface) exitWith {}; waitUntil {!isNull findDisplay 46}; findDisplay 46 displayAddEventHandler ["KeyDown",{ if (inputAction "ingamePause" > 0) then { [] spawn { waitUntil {!isNull findDisplay 49}; [13287, 13288] apply { (findDisplay 49 displayCtrl _x) ctrlEnable false; }; }; }; }]; Should work. Not tested but the IDCs should be correct.
  12. 7erra

    Lock camera from menu

    Put this in the initPlayerLocal.sqf: if (!hasInterface) exitWith {}; waitUntil {!isNull findDisplay 46}; findDisplay 46 displayAddEventHandler ["KeyDown",{ if (inputAction "ingamePause" > 0) then { [] spawn { waitUntil {!isNull findDisplay 49}; (findDisplay 49 displayCtrl 13288) ctrlEnable false; }; }; }];
  13. @Larrow True. I used the way that BI does it in the script which I mentioned above. But inputAction seems to have quite a few problems of its own according to the BIKI notes?
  14. #include "\a3\ui_f\hpp\definedikcodes.inc" _curatorDisplay = findDisplay 312; ([] call BIS_fnc_GUIGrid) params ["", "", "_GUI_GRID_W", "_GUI_GRID_H"]; _GUI_GRID_W = _GUI_GRID_W / 40; _GUI_GRID_H = _GUI_GRID_H / 25; _btn = _curatorDisplay ctrlCreate ["RscButton", 2020]; _btn ctrlSetPosition [ safezoneX + safezoneW - 23.6 * _GUI_GRID_W, safeZoneY + 1.6 * _GUI_GRID_H, 11 * _GUI_GRID_W, 1 * _GUI_GRID_H ]; _btn ctrlSetText "ACTION"; _btn ctrlCommit 0; _curatorDisplay displayAddEventHandler ["KeyDown",{ params ["_curatorDisplay", "_key"]; if (_key in actionkeys 'curatorToggleInterface') then { _screenshotMode = uiNamespace getVariable ["RscDisplayCurator_screenshotMode", false]; _btn = _curatorDisplay displayCtrl 2020; _btn ctrlEnable _screenshotMode; _fade = [0,1] select !_screenshotMode; _btn ctrlSetFade _fade; _btn ctrlCommit 0.1; }; }]; Adjusted the script so it fits the style of zeus interface. Your UI coordinates will not work on other UI settings (UI scale, aspect ratio, ...) so I switched them to the grid used by the Zeus interface. Also the base class "ctrlStaticPicture" is not interactable with. The hiding and showing of the button can be detected by a keyDown UIEH. The variable I used I got from the script that is executed when the Zeus display is opened (\a3\ui_f_curator\ui\displays\rscdisplaycurator.sqf).
  15. The mission display (Display #46) is not present during mission init. Creating a control ontop of a non-existent dialog won't work.
  16. That was acutally intentional 😉. I can easily remove it though.
  17. Or for no math: getPos _cam + screenToWorld + lineIntersectsObjs
  18. Yeah no concern there. Unless the engine uses another datatype for EHs. Bonus: Quick maths: Assuming an onEachFrame EH adds a new EH and engine limitations are the same you could run the script for 3.4028235e+38 / 60 (1/s) / 60 (1/min) / 24 (1/h) / 365 (1/d) = 1.7983804e+29 years = 179,838,040,000,000,000,000,000,000,000 years ACUTUAL ENGINE LIMITATION (int32): 2,147,483,647 / 60 (1/s) / 60 (1/min) / 24 (1/h) / 365 (1/d) = 68 years So basically a decent A3 weekend. If you still fell uncomfortable with large numbers, why not check in the eh itself if a condition is met and exit if not instead of adding and removing the eh? My guess for the origin of the bug is that with a consecutive counting style it is less probable to overwrite any exisiting ehs and also less resource intensive bc the engine does not have to check for unsused numbers.
  19. Easiest way would be to use CBA since it supports class eventhandlers: https://github.com/CBATeam/CBA_A3/wiki/Extended-Event-Handlers-(new). This way it will also include newly spawned units. Other option without mods woul be to run a loop like this: allUnits apply { if (_x is kindOf "Class") then { // code }; }; Depending on your mission you'd have to run this resource intensive code in a loop to make sure that every unit has the EH.
  20. Ah yeah you'll have to add that code to the newly created dialog: class ALERT_EmptyDialog { idd = -1; onLoad = "_this execVM ""ui_init.sqf"";"; class controls { }; }; And the ui_init.sqf: params ["_display"]; _display displayAddEventHandler ["MouseButtonUP", { if (_this select 1 == 0) then { playSound "ShotGunSound"; if (cursorObject isKindOf "Man") then { cursorObject setdammage 1; //some codes }; false }]; (Also a little bit of better if then statements). I just noticed that cursorObject is not gonna work. The cursorObject will always return what is in the center of the screen, not where the mouse cursor actually is. To maintain a static camera view you'd probalby do some more math with lineintersectsObjs or some command of that sort 🤔
  21. The dialog can be empty too. So put the following in the description.ext: class ALERT_EmptyDialog { idd = -1; class controls { }; }; Now you can create it with createDialog "ALERT_EmptyDialog";
  22. Ah okay that should be easy. You could create a dialog and also move your ui elements to that dialog. The mouse should now be moveable
  23. Is the screen static when shooting targets or is it the normal 3D movement with turning etc?
  24. You could do a loop what executes every frame: while {!isNull _display} do { _ctrl ctrlSetPosition getMousePosition; _ctrl ctrlCommit 0; _frame = diag_frameNo; waitUntil {_frame != diag_frameNo}; };
  25. The "HitPart" EH fires for these kind of objects.
×