Jump to content

juleshuxley

Member
  • Content Count

    72
  • Joined

  • Last visited

  • Medals

Posts posted by juleshuxley


  1. Why is my RSC text not centered?

    Here's my RSC class:

    #define CT_STRUCTURED_TEXT 13
    #define ST_CENTER 0x02
    
    class MyRscStructuredText {
      idc = -1;
      type = CT_STRUCTURED_TEXT;  // defined constant
      style = ST_CENTER;          // defined constant
      x = 0.1;
      y = 0.1;
      w = 0.1;
      h = 0.1;
      size = 0.018;
      text = "";
      class Attributes {
        font = "TahomaB";
        color = "#000000";
        align = "center";
        valign = "middle";
        shadow = false;
        shadowColor = "#ff0000";
        size = "1";
      };
    };

    Here's the implementation:

    _item = _display ctrlCreate ["MyRscStructuredText", -1];
    _item ctrlSetPosition [0,0,0.0,0.0];
    _item ctrlSetText "X";
    _item ctrlSetBackgroundColor [1, 0, 0, 1];
    _item ctrlSetTextColor [1,1,1,1];

    Result:
    Lmao.jpg

    While it appears to be horizontally aligned, why is it not vertically aligned? Why is valign being ignored?

    I just want that white x to be in the dead center of the red box, I don't mind what type the RSC is. Setting it to Structured Text doesn't appear to be doing anything anyway


  2. Why is the A left aligned?
    whutt.jpg

    class MyTextControl : RscText {
      type = CT_HTML;
      w = 0.06;
      h = 0.05;
      font = "TahomaB";
      sizeEx = 0.04;
      colorBackground[] = {0,0.9,0,1.0};
      text = "A";
      shadow = 0;
      align = "CENTER";
      style = ST_CENTER;
      valign = "top";
    };

    I've tried setting align and style but it appears to be left aligned. How do I change  it so the text is in the center of the box?


     


  3. I'm having real difficulty with UI's as there isn't much documentation.
    I've been able to use ctrlCreate to create a RscText box and change it's position and color with commands such as ctrlSetPosition and ctrlSetBackgroundColor.

    My mission folder contains three folders:

    • config.cpp
    • init.sqf
    • mission.sqm
       

    config.cpp:

    class RscText {
      access = 0;
      type = CT_STATIC;
      idc = -1;
      style = ST_LEFT;
      w = 0.1; h = 0.05;
      //x and y are not part of a global class since each rsctext will be positioned 'somewhere'
      font = "TahomaB";
      sizeEx = 0.04;
      colorBackground[] = {0,0.9,0,0};
      colorText[] = {1,1,1,1};
      text = "HELLO WORLD";
      fixedWidth = 0;
      shadow = 0;
    };

     

    init.sqf

    "someLayer" cutRsc ["RscTitleDisplayEmpty", "PLAIN"];
    
    disableSerialization;
    _display = uiNamespace getVariable "RscTitleDisplayEmpty";
    
    _columnWidth = 0.015;
    _rowHeight = 0.02;
    
    _currentRow = uiNamespace getVariable ["currentRow",safeZoneY];
    
    _font = "EtelkaMonospacePro";
    //_text = "A";
    _item = _display ctrlCreate ["RscText", -1];
    
    _currentColumn = safeZoneX + (1 * _columnWidth);
    
    _item ctrlSetPosition [_currentColumn,_currentRow,_columnWidth,_rowHeight];
    _item ctrlSetFontHeight _rowHeight; 
    //_item ctrlSetBackgroundColor [0.0,0.0,0.0,1.0];
    //_item ctrlSetText _text;
    _item ctrlCommit 0;
    _item ctrlSetTextColor [1.0,1.0,1.0,1.0];

    So I'd expect this code to create a RscText on the screen, containing the text "HELLO WORLD" and with a green background. But no, nothing. It doesn't seem to pick up on my classes in config.cpp.

    Main question: So how should I create a custom RscText class?

    Side question: nothing is displayed if I don't have this line at the top of my code:

    "someLayer" cutRsc ["RscTitleDisplayEmpty", "PLAIN"];

    How does ctrlCreate know to attach my RscText to someLayer? Does it just look for an empty layer?

    And why is disableSerialization needed?

    Tanks a lot


  4. Man the closest I can get is this:

    ugv = vehicle player;
    
    ugv animateSource ["turret", 0];
    ugv animateSource ["mainTurret", rad 0, true];
    ugv animateSource ["mainGun", rad 0, true];
    ugv animateSource ["mainTurret", -rad 90, true];
    ugv addAction ["Show Turret", {ugv animateSource ["Turret", 0]}];
    ugv addAction ["Turret Left", {ugv animateSource ["mainTurret", rad 90]}];
    ugv addAction ["Turret Right", {ugv animateSource ["mainTurret", -rad 90]}];
    ugv addAction ["Turret Up", {ugv animateSource ["mainGun", rad 30]}];
    ugv addAction ["Turret Down", {ugv animateSource ["mainGun", -rad 20]}];

    Which is an example I got from the wiki https://community.bistudio.com/wiki/animateSource

    It's weird though. It sort of spawns in a turret than can then be moved. I tried with a RCWS stomper (that already has the turret) and it doesn't move it. Weird example IMHO


  5. I've confirmed that "mainTurret" is the correct name of the animation that rotates the turret with

    getText (_turretConfig >> "animationSourceBody");

    So this shoud insantly rotate the turret 90 degrees to the right, right?

    _tank = vehicle player;
    _tank animateSource ["mainTurret", rad 90, true];

    The player is in the commanding position, other crew positions are filled. The turret stays stubbornly immobile. As usual Arma 3 gives absolutely no error messages.

    I can workaround using doWatch and triggernometry, but I feel it would be better to use the animateSource, right?

    // untested pseudo code
    _deg = 50;
    _radius = 100;
    gunner _vehicle doWatch ([getPos _vehicle,[_radius * cos(_deg),_radius * sin(_deg),0]] call addToArray ); // makes the gunner watch 50 degrees when placed in an infinite while loop so as the vehicle moves the watch point moves.

     


  6. I'm creating a mod that shows what each ammo type is useful for. There is definitely some confusion regarding what ammo does what, many people think the ATGM (anti tank guided missile) is actually an Air to Ground Missile!

    Now my first thought is to simply manually add a description to each ammo config myself (definitely doable, would only take a few hours), but I'm wondering if it's possible to programatically determine if a ammo is anti-air/anti-infantary/anti-land from its config attributes?

    Attributes such as indirectHit, dangerRadiusHit, caliber maybe. Apologies if this is a bit of an open ended question.


  7. getNumber ( configfile >> "CfgAmmo" >> "M_120mm_cannon_ATGM" >> "laserLock" );

    I'm trying to detect when a missile uses a laser lock / ir lock/ any other types of lock Arma uses. Unfortunately the above code returns 0 for the ATGM, when it should return 1 as the ATGM definitely laser guided?

    something to do with the M_120mm_cannon-ATGM having the "class SensorTemplateLaser", maybe?


  8. Looking at the arifle_MX_GL_Black_F's config suggests to me it can only take 100Rnd_65x39_caseless_black_mag magazines. This is stated in the magazines array entry:

    magazines[] = {"100Rnd_65x39_caseless_black_mag"};

    However, in game I find the rifle can take the 6.5 mm 30 Rnd Sand Mag

    reload88.jpg
    reload99.png

    What gives? What's a surefire way I can find can get an array of magazine classes that a weapon will accept? I thought

    _weaponAcceptedMagazines = getArray (configfile >> "CfgWeapons" >> _weaponName >> "magazines");

    was getting my acceptedMagazines but apparently not.

    I believe this is a bug as this behaviour is present in vanilla:
    whut.jpg

    I'd be interested if a staff member could explain this bug, as I assumed all weapons got their accepted mags from their config and yet the arifle_MX_GL_Black_F seems to getting its accepted bags from somewhere else? Where? Spooky!


  9. On 11/9/2020 at 7:46 PM, reyhard said:

    There is no limit on drone AI units so there can be UAV with 10 turrets (each with its own AI) 


    That's a shame. Any idea how how to detect a AI turret vs a passenger turret? For example the Stomper RCWS has a Driver AI turret, a Gunner AI turret and a passenger turret that a normal player can get in. Is there a command I could run on the AI crew mate to see if it's a Drone AI rather than a normal unit that can leave the vehicle, thus proving its position is available to be controlled by a terminal?

    This is just a side question, but every drone I've come across has at most 1 driver and 1 gunner... And the UAV terminal displays only 1 driver and 1 gunner feed. So would a drone with more controllable turrets require a modded terminal? Also the UAVControl command (https://community.bistudio.com/wiki/UAVControl) only returns the roles DRIVER, GUNNER or "", which suggests that drones are hardcoded to have at most 1 driver and 1 gunner. As you say this isn't the case so can you explain this? Thanks. First question is the impostant!!


  10. I'm working a mod that shows all of the player's current vehicles' weapons systems on the HUD. I'm nearly there, however making it work with Drones is a little hacky as the player isn't inside the drone, rather he is controlling it. No worries, Bohemia itself is a little hacky, and drones in the game actually contain one to two crew mates jammed inside! There's even a guy stuffed inside the darter! Using the full crew command you even get their names the poor devils.

    Anyway, I can work with this hackiness to hack my HUD together, however I need to ask: Do all drones have, at most, 1 gunner and 1 driver slot? Are there mods that contain drones with 3 crew mates and more? I want my mod to work with everything that's thrown at it, and as long as drones have 1 driver and 1 gunner we're fune. Is it impossible for a modder to create a drone with 3+ slots?


  11. I can get an array of units onboard a vehicle:

    fullCrew _vehicle;

    How do I get the weapon each unit is controlling? I tried currentWeapon but that returns the unit's rifle that he's carrying.

    I tried currentMuzzle and that has more success. It does return the current muzzle of the vehicle weapon the unit is controlling! How do I turn that into the class name of the weapon, rather than the muzzle? Not sure if possible. You can get the muzzles a weapon can have from the config but I don't think you can get the weapon a muzzle belongs to.

    Grateful for any ideas, maybe I can get all the weapons of a vehicle, and then find out which unit is using what weapon? Can we do it that way round? Just want an array of all weapons aboard a vehicle and what unit is using what. Remember there can be more than one weapon per turret path!

    If anyone's interested I'm making a HUD mod that gives a better overview of what a vehicle's crewmates are doing. And what weapon is selected by who is very useful in the case of AI crewmates or beginner human crewmates.

    Thank you


  12. Ok so the reload time entry in the config file gives you the time it takes for a new round to enter the chamber, personally I think the name is confusing and should called chamberingTime or something. But anway this is how you get 'chambering time':

    configfile >> "CfgWeapons" >> "CUP_Vlmg_M240_M1Abrams_Coax" >> "reloadTime"

    But how do you get the reload time? I.e. the time taken for a new magazine to be inserted into the weapon? Or in the case of a vehicle, the time it takes to reload a different type of round? Reading through the entries with config viewer doesn't show me anything that's the new magazine reload time but maybe I've just missed it

×