orcinus 121 Posted July 9, 2013 (edited) Hi Working on a little addon that displays (from an addAction entry in the player-commander's context menu) in a hint box: Unit # | magclass* | magcount *If a unit has no mags left, it displays weapon base class. Low mags (<3): text in orange. No mags: text in red. Vastly quicker than opening map->units->select units one by one->open gear menu (& watch it close instantly if unit is moving, bah... even if you don't get shot while farting about in the map page). Intended as a 'front end' for 2 other addons (one simplifying/speeding rearming, & one for mag-throwing) I think it might be useful as a stand-alone - feedback welcomed. Working alpha (SP atm) but there's an issue with units leaving/dying when the player can recruit new units, also might be an issue in MP (MP not tested yet).] The engine apparently changes the unit numbers in the internal array of units - if unit 3 dies/leaves, all subsequent unit numbers decrease by one. The numbers no longer agree with those on the icons. Attempting to address this by scripting, but it occurs to me that the easiest way might be to access whatever array holds the numbers displayed on the icons - if there is one. Does anyone know? TIA Orc Edited July 9, 2013 by Orcinus marking as solved Share this post Link to post Share on other sites
xxanimusxx 2 Posted July 9, 2013 I don't know in which order this command is returning the units, but what about trying out units? If i didn't know it any better, I'd bet the HUD is using this command as well to enumerate through your allies. _count = 1; { if (alive _x && _x != player) then { hintsilent format["Unit# %1:\n\tMagClass: ....\n\n", _count]; _count = _count + 1; }; } foreach units (group _yourGroup); Wrap this up in a loop and try out if the enumeration is matching the icons in your HUD. Share this post Link to post Share on other sites
orcinus 121 Posted July 9, 2013 Many thanks, will try this later tonight. Share this post Link to post Share on other sites
orcinus 121 Posted July 9, 2013 Hi Actually it occurred to me that a unit's vehicleVarName, e.g. B 1-1-A:10 has the required number at the end - in this example, "10". So using toArray (str vehicleVarname) gets an array that can have everything else stripped out, after reversing - for which the estimable Rydygier has a neat little function. Makes for a nicely small pair of scripts (currently ~3kB). There's a screen-shot here: http://img14.imageshack.us/img14/1443/4y2h.jpg Looks significantly better on-screen that in this low-resolution (88kb crop) image. Red text: no ammo. Orange text: < 3 mags. Where a unit has no mags the display shows the base class for the weapon - see entry for unit 13. Unit 14 is unarmed so there is no entry for a mag or rifle class. Cheers Orc Share this post Link to post Share on other sites
SavageCDN 231 Posted July 15, 2013 Replied to your PM Orcinus. This looks like a great idea! Share this post Link to post Share on other sites