Jump to content

Larrow

Member
  • Content count

    2262
  • Joined

  • Last visited

  • Medals

Community Reputation

769 Excellent

About Larrow

  • Rank
    Warrant Officer

Profile Information

  • Gender
    Male
  • Location
    LAR setpos (you getpos [-2,getdir you]);LAR say3d["BOO!"]
  1. Try having a look at this, look in the ui folder at the #_sizes.hpp, then open the #.gui ignore the macros at the top and scroll down to the main class. In there is a controls group that contains all the controls of the ui using the GRID defines from the #_sizes.hpp to set out their positions. Once you have worked yourself out a nice grid size and as all the controls are relative to the controls groups 0,0 everything after that is as easy as placing and sizing items to grid numbers (depends on how regimented your layout is, really cannot tell from your safezone values). Hope it helps.
  2. Instead of screen space percentages (safeZoneW/H), use the new pixelGrid system instead. This will split the display into grids based on screen height, allowing you to place your images as square and keep everything relative. Use... createDialog "RscTestGrids" ...from the debug console for a demonstration of how the different pixelGrid commands effect a ui element (white boxes) based on resolution, aspect ratio and ui size.
  3. Return value problem

    _year = 2018 + floor random 22; _month = ceil random 12; //Days in each month _monthDays = [ 31, [ 28, 29 ], 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]; //Select number of days in month _days = _monthDays select ( _month - 1 ); //If february if ( _month isEqualTo 2 ) then { //If year mod 4 is 0 then it is a leap year _isLeapYear = ( _year % 4 ) isEqualTo 0; //select number of days based of leap year _days = _days select _isLeapYear; }; //get random day _day = ceil random _days; _hour = floor random 24; _minute = floor random 60; setDate [_year, _month, _day, _hour, _minute];
  4. What do you mean by command? Make something happen when an item is selected? If so you need to use an eventHandler on the tree of "TreeSelChanged", "TreeLButtonDown" or "TreeDblClick" depending on the type of interaction you want, see this Biki link for available tree EH's. Little example to hint back the path of the item selected, just run from the debugConsole in mission preview. h = [] spawn { disableSerialization; _display = findDisplay 46 createDisplay "RscDisplayEmpty"; _tree = _display ctrlCreate [ "ctrlTree", 100 ]; _tree ctrlSetPosition[ 0, 0, 1, 1 ]; _tree ctrlCommit 0; tvClear _tree; { _tree tvAdd [ [], _x ]; } forEach ["PARENT 1","PARENT 2"]; { _tree tvAdd [ [0], _x ]; } forEach ["CHILD 1","CHILD 2"]; { _tree tvAdd [ [1], _x ]; } forEach ["CHILD 3","CHILD 4"]; _tree ctrlAddEventHandler [ "TreeSelChanged", { params[ "_tree", "_path" ]; _selected = ""; { _selected = format[ "%1 %2 %3", _selected, //Any previous text [ "", ">>" ]select( _forEachIndex > 0 ), //Add >> only after first path item ( _tree tvText ( _path select [ 0, _forEachIndex + 1 ] )) //tree items displayed text ]; }forEach _path; hint format[ "You Selected\n%1", _selected ]; //eg "PARENT 1 >> CHILD 2" }]; };
  5. As you mentioned that this is used as a teleport position, where the user can select a listed item and display it on the map via a marker and this marker keeps updating the items position. I just thought if the item no longer exists or is dead you may not want the user to be able to select it (this teleport position is out of order as the follow item is dead), so delete the listbox item and set the selection to nothing, making the user choose a new selection.
  6. Should work fine. I even tested on a dedicated before posting my previous reply and is what made me change the code to test the units locality rather than isServer. Are you sure your units are not changing locality, e.g being put in a players group or handed off to a headless client? The commands used in BIS_fnc_addWeapon (addWeapon/Magazine) and the trigger deactivation statement (removeWeapon/Magazine) are AL (Argument Local - argument is the unit the commands are being run on ). If the script is running on a different machine to where the unit is local then nothing will seem to happen.
  7. Just a simple example to get the idea across. TAG_loadouts = [ "loadout1", "loadout2", "loadout3" ]; TAG_loadoutVariants = [ //loadout1 [ [ "L1_V1", /*Some form of loadout, VA export or scriptname etc*/ ], [ "L1_V2", /*Some form of loadout, VA export or scriptname etc*/ ], [ "L1_V3", /*Some form of loadout, VA export or scriptname etc*/ ] ], //loadout2 [ [ "L2_V1", /*Some form of loadout, VA export or scriptname etc*/ ], [ "L2_V2", /*Some form of loadout, VA export or scriptname etc*/ ], [ "L2_V3", /*Some form of loadout, VA export or scriptname etc*/ ] ], //loadout3 [ [ "L3_V1", /*Some form of loadout, VA export or scriptname etc*/ ], [ "L3_V2", /*Some form of loadout, VA export or scriptname etc*/ ], [ "L3_V3", /*Some form of loadout, VA export or scriptname etc*/ ] ] ]; //Some function called from display onLoad EH TAG_fnc_initGUI = { params[ "_display" ]; //Get listboxs _listBox1 = _display displayCtrl #; //Replace with IDC _listBox2 = _display displayCtrl #; //Replace with IDC //Fill first with loadout names { _listBox1 lbAdd _x; }forEach TAG_loadouts; //Add EH for when a listbox1 selection is made _listBox1 ctrlAddEventHandler [ "LBSelChanged", { params[ "_ctrl", "_index" ]; //Get listbox2 _listBox2 = ctrlParent _ctrl displayCtrl #; //Replace with IDC //Clear listboxes current entries lbClear _listBox2; //Fill it with names based off of selected index used in listbox1 { _listBox2 lbAdd ( _x select 0 ); }forEach ( TAG_loadoutVariants select _index ); //Reset listbox2 selection to nothing _listBox2 lbSetCurSel -1; }]; //Automatically select listbox1 first item //This will cause the above event to fire filling listbox2 _listBox1 lbSetCurSel 0; //Add EH for when LOAD button is pressed _loadButton = _display displayCtrl #;//Replace with IDC _loadButton ctrlAddEventHandler [ "ButtonClick", { params[ "_ctrl" ]; //Get listboxs _listBox1 = ctrlParent _ctrl displayCtrl #; //Replace with IDC _listBox2 = ctrlParent _ctrl displayCtrl #; //Replace with IDC _inventory = TAG_loadoutVariants select ( lbCurSel _listBox1 ) select ( lbCurSel _listBox2 ) select 1; //Do something with inventory reference //Close the UI closeDialog 1; }]; //Disable LOAD button until a selection is made in listBox2 _loadButton ctrlEnable false; //When a selection in listbox2 is made _listBox2 ctrlAddEventHandler [ "LBSelChanged", { params[ "_ctrl", "_index" ]; //Get the LOAD button _loadButton = ctrlParent _ctrl displayCtrl #;//Replace with IDC //If we have a selection. Will be -1 when listbox2 is refreshed by listbox1 selection EH if ( _index > -1 ) then { //Enable button, we have a valid selection _loadButton ctrlEnable true; }else{ //Disable button, the listbox has loaded new variants _loadButton ctrlEnable false; }; }]; };
  8. Have you ever considered...?

     

     

    You help me a time ago.... i see you have multiple threads that you have helped in ... arent you interested on give some kind of lessons as a "scripting Arma" teacher? I mean, you could have some extra $$ for this in a virtual school/clasroom. 

     

    In fact i'm interested on having some lessons on it, i have advanced knowledge on scripting but not as a guru (as i see you are). ¿are you Interested? if yes, answer me please. And of course i dont forget i owe u a beer, so what else? 

  9. And then you would be stuck with the exact problem @MANTIA came here to resolve... ...having a global variable for each and every bad guy would make having a script that could be reusable for # bad guys problematic (or at least leave you having to upkeep an array of all possible units ). Plus its always a good idea to try and code with as few global variables as possible. Your right that will just cause the trigger to keep toggling. Hoping to throw a quick fix never works well Anyway separated it back out from a test init and added server only (changed to badGuy locality as removeWeapon/Magazine are AL, just incase) check. BADCIVI.sqf //BADCIVI.sqf params[ "_badGuy", "_distance", "_percentChance" ]; if !( local _badGuy ) exitWith {}; _percentChance = _percentChance / 100; removeAllWeapons _badGuy; { _badGuy removeMagazine _x }forEach magazines _badGuy; _badGuy allowFleeing 0; _trg = createTrigger[ "EmptyDetector", getPos _badGuy, false ]; _trg setTriggerArea[ _distance, _distance, 0, false, 100 ]; _trg setTriggerActivation [ "WEST", "PRESENT", true ]; _trg setTriggerStatements [ "this", format[ " _badGuy = '%1' call BIS_fnc_objectFromNetId; if ( !isnull _badGuy && { alive _badGuy && { random 1 < %2 }} ) then { [ _badGuy, 'hgun_Pistol_01_F', 1, '10Rnd_9x21_Mag' ] call BIS_fnc_addWeapon; }; ", _badguy call BIS_fnc_netId, _percentChance ], format[ " _badGuy = '%1' call BIS_fnc_objectFromNetId; if ( !isnull _badGuy && { alive _badGuy && { _badGuy hasWeapon 'hgun_Pistol_01_F' }} ) then { _badGuy removeWeapon 'hgun_Pistol_01_F'; _badGuy removeMagazine '10Rnd_9x21_Mag'; }; ", _badguy call BIS_fnc_netId ] ]; _trg attachTo [ _badGuy ]; Then in each units init that you want to be a possible badGuy //[ unit, detection distance, percent chance to pull weapon ] _nul = [ this, 5, 50 ] execVM "BADCIVI.sqf";
  10. Oops yes I may have inadvertently quoted @halex1316 from your quote @pierremgi. No there is not particularly, but that was not the overall topic of the thread. It was from the original question of 'Understanding References Made to ConfigFile' and is what I continued to show, what the original members provided referred to, where they came from and what further information you could attain from them. I never said CfgWeapons wouldn't be a better option but if @halex1316 wanted to make a list of CfgVehicle weapons that he could spawn, without having to worry about weapon holders and weapons separately and then from that list also attain a list of CfgWeapon configs that where spawned, then job done.
  11. Correct. I would not rely on the truncated name being correct. No. Look in the CfgVehicles class for "Weapon_srifle_EBR_F" you will see three sub classes called "TransportItems" "TransportWeapons" and "TransportMagazines" these will hold the item class names for any items, weapons and magazines the CfgVehicle class spawns. You will see under "Weapons_srifle_EBR_F" >> "TransportWeapons" the item "srifle_EBR_F" which is the "CfgWeapons" classname of the rifle, that you would use to add it to a crate, inventory etc. Ill leave you to figure out how to retrieve this from the knowledge you have gained in this thread. Always welcome to reply later if you are still struggling.
  12. BI's NetID functions are compatible with SP the command equivalents are not. Trigger statements are STRING. Formatting an OBJECT into a STRING does not work, so instead format in the NetID(which is a STRING) then inside the statement turn it back into an OBJECT. For testing it was good enough, but yes the code should be server only. Sure, just change the trigger condition to _trg setTriggerStatements [ "this && random 1 >= 0.5", so 50% of the time, for example.
  13. If you use safeZoneX and safeZoneY on every control then yes your making your positions offset from the screens top left, inside a ctrlGroup this will make your controls wildly offset. Instead use the pixel grid system where everything is relative to a grid size based off of UI size and screen resolution. You can easily adjust your controlGroup's ctrls sizes and positions based off of the controlsGroups dimensions by using ctrlPosition if you need to manipulate them. Maybe taking apart this could help, the main display is anchored to safezoneX/Y but everything else is inside a controlGroup using a grid system (specifically done that way so as it can be used displayed inside Eden's main display via a controlGroup). Maybe not the best but its the only thing I have released UI based since the new system and other projects are not yet ready.
  14. It makes little sense to do... params ["_show"]; switch (true) do { case _show : { ctrlShow [1231,true]; ctrlShow [1204,true]; ctrlShow [1205,true]; ctrlShow [1206,true]; ctrlShow [1207,true]; ctrlShow [1202,true]; }; case !_show : { ctrlShow [1231,false]; ctrlShow [1204,false]; ctrlShow [1205,false]; ctrlShow [1206,false]; ctrlShow [1207,false]; ctrlShow [1202,false]; }; }; If _show is true/false why switch on its value? Just use _show in the ctrlShow command. params ["_show"]; ctrlShow [1231,_show]; ctrlShow [1204,_show]; ctrlShow [1205,_show]; ctrlShow [1206,_show]; ctrlShow [1207,_show]; ctrlShow [1202,_show]; Which can be shortened to.. params ["_show"]; { ctrlShow [_x,_show]; }forEach [ 1231, 1204, 1205, 1206, 1207, 1202 ]; If you need to use the group in multiple places... #define MYGROUP [ 1231, 1204, 1205, 1206, 1207, 1202 ] params[ "_show" ]; { ctrlShow[ _x, _show ]; }forEach MYGROUP; Where you could store all your group defines in their own separate file to be included where necessary. I do not see what the problem is with RscControlsGroup's ctrls being positional relative to the controlGroup. For things like your modal windows I would of thought this would be a blessing as you could make them movable without having to worry about each child controls position. For instance THIS each command component I place in the design panel is a ctrlGroup consisting of multiple child controls and controlGroups, existing in the design panel which itself is a ctrlGroup in the main display, I can move them, scale them, hide them etc without much of a problem due to the fact all children are relevant to their parent ctrlGroup.
×