Re: HP circles on minimap explained

Published by kupjones on

#109889
kupjones
Member

XVM and minimap labels

This all started from a question:  How does one make those HP circles show up on the minimap?  I know one can as I had seen them before.  OverripeTomato (herein known as OT because that is too much to type) stepped in and offered to help.  What I am putting here are excerpts from a now defunct thread that was on RN Mods (as RN no longer supports XVM configs) thread that explains how OT coerced XVM to produce:

lae79otdsm4vzgn6g.jpg

8ibsym50i7d607a6g.jpg

This is how the new reworked minimap labels work:

 

First, in minimapLabelsTemplates.xc you need to make “defs” of what you want to show with your vehicle icons.  For example,

    “nickSpotted”: { <<< name of “def”, which will be included in minimapLabels.xc
      “$ref”: { “path”:”def.defaultItem” }, <<< just the standard characteristics (such as shadow) of the item defined in the “def”
      “flags”: [ “squadman”, “spotted”, “alive” ], <<< on which player you want the “def” to appear, could also be “enemy”, “ally”, “teamkiller”, “lost”, or “dead”
      “format”: “<font size=’8′ color='{{.minimap.labelsData.colors.txt.{{sys-color-key}}}}’><i>{{name%.7s~..}}</i></font>”, <<< this is what you want to appear.
      “x”: 2, <<<  x position of the “def” relative to the vehicle icon 
      “y”: -9 <<<  y position of the “def” relative to the vehicle icon 
    },

“format”: is limited only by your imagination, it can text or an image. The circles and hpbars are PNG image files. lol in my own zoomed minimap, I have tombstone crosses for dead allies and enemies, so the battlefield is like a cemetery towards the end of the battle. lol.

6znz1iodgeexml86g.jpg

In minimaplabels.xc, you insert the “defs”, below for example

    “formats”: [
      //${ “minimapLabelsTemplates.xc”:”def.vtypeSpotted” },
      ${ “minimapLabelsTemplates.xc”:”def.vehicleSpotted” },
      ${ “minimapLabelsTemplates.xc”:”def.hpBars” },
      ${ “minimapLabelsTemplates.xc”:”def.vehicleHP” },
      ${ “minimapLabelsTemplates.xc”:”def.nickSpotted” },
      ${ “minimapLabelsTemplates.xc”:”def.vtypeLost” },
      ${ “minimapLabelsTemplates.xc”:”def.vehicleLost” },
      ${ “minimapLabelsTemplates.xc”:”def.nickLost” },
      ${ “minimapLabelsTemplates.xc”:”def.vtypeDead” }

You can turn feature off by commenting them out with a //. So if you don’t want the hpBars for example, just add a // before the $ in that line, e.g.,

//${ “minimapLabelsTemplates.xc”:”def.hpBars” },

minimaplabelsAlt.xc is for the alt (zoomed) map. Sometimes you may want to add more info on the zoomed because it is larger, if at all you use the zoomed minimap when you play. I rarely use the zoomed minimap when I am still alive because I’m busy dodging shots (very hostile game this is lol), mostly only when I’m dead and watch how the battle progresses and ends.

minimaplabelsData.xc is for colors used in the “defs” above. Most modders use the default, but you can play around with them.

Recap: Define the labels you want in minimapLabelsTemplate.xc, and activate the labels in minimapLabels.xc. 

That’s about it I guess, :LOUCHE:

————————————————————————————————————————————————————————————–

What the …. ? But this is freaking magic — then I got a post to not forget about “Colors.xc”.  I am really not seeing how this bit of editing can make those circles and lines.  Well, read on:

————————————————————————————————————————————————————————————–

colors.xc, ok, yeah.

I introduced those “hp_ratio” in 10 graduations so that {{c:hp-ratio}},png will change in 10% hp-ratio increments this 10%, 20%, 30%, 40%, etc. The default hp-ratio colors had only 4 graduations, so only 25%, 50%, 75% 100%, not very iO-ish.

The hp bars (or circles as the case may be) are named using the color graduations, e.g., #00B4FF for 90%, or  #666666 for 10%, etc. 

See inside kupjones/img/hpbars

h8799ohv59hcz7w6g.jpg

Compare the names of the PNGs above to the color graduations in color.xc, they will jive. :TRUCDEOUF:

Well you can introduce more graduations, 25? 50? up to 100 max. but you have to have more PNG files. 

Nope, you will not see any color change on the minimap labels. It’s just once of the tricks to use {{c:hp-ratio}} to pull a PNG file. Don’t be distracted by {{c:hp-ratio}}. 

“hpBars”: {
            “$ref”: { “path”:”def.defaultItem” },
            “flags”: [ “ally”, “squadman”, “spotted”, “teamKiller”, “alive” ],
            “format”: “<img src=’cfg://default/kupjones/img/hpbars/{{c:hp-ratio}}.png‘ width=’24’ height=’2′>”, <<< e.g., #666666.png = 10% or  #00B4FF.png = 90%
            “x”: 2,
            “y”: -3
        },

I’m sure there are other ways of creating the hp-bars or hp-circles, and probably in a more efficient way without having to create PNGs. I have not found it yet. XVM has embedded the fonts below (that have 1% graduations) after demon2597’s lobbying.

Dynamic fonts  (See next post for dynamic fonts)

————————————————————————————————————————————————————————————–

Then Soulza pitched in:

————————————————————————————————————————————————————————————–

:) this is a common xvm trick , to use images for values , at first you may think wtf?

but consider if you had a folder with 10 ,png image files within, now you name these images , for the case above ,the values you want to represent like this,

gb3vctciocb0bqx6g.jpg

now i think a man with your knowhow will suddenly see a light go on somewhere ?:) like i said , this is an old trick you can use in xvm for any number of items.

————————————————————————————————————————————————————————————–

I’ve now been challenged — how can this technique be extended to other areas?  For that matter, how can we use the XVM embedded fonts to achieve something perhaps more FPS friendly? 

————————————————————————————————————————————————————————————–

Time goes by ……. and:

The answer to this question came from — Aslain!  Aslain’s modpack includes an XVM config and supports minimap circles using the dynamic font char map.  so looking at the code we see:

minimapLabelsTemplates.xc where the format line pretty much spells out the most obtuse embedded formatting:

—————————————————————————-

   “HealthPointsSpottedAlly”: {
      “$ref”: { “path”:”def.defaultItem” },
      “flags”: [ “ally”, “spotted”, “alive” ],      
      “format”: “<font face=’dynamic2′ size='{{vtype-key=HT?16|14}}’ color='{{.minimap.labelsData.colors.dot.{{sys-color-key}}}}’>{{hp-ratio%.335a}}</font>”,
      “align”: “center”,
      “valign”: “center”,
      “x”: 0.2,
      “y”: 0.8

———————————————————————————

Note that:

face= specifies the char map we are using

“color” renders the font the color of the ally or enemy

The workhorse is “{{hp-ratio%. —- and a series of numbers.  These numbers indicate (and this is pure guesswork) to the hp-ratio macro to ‘start’ at char location <blah> (in our case char 335 in char map ‘dynamic2’, add the integer result of hp-ratio to that starting map char, and return the new char that we now point to.  So, without params hp-ratio will return an integer from 0 – 100.  It so happens that the new dynamic fonts in XVM have HP chars that magically increment by 1, from a relative 0 (no health or dead) to 100 (full health).  The hp-ratio macro then provides a convenient dynamic indexer into that char map and returns the char that visually represents an Ally/enemy health status.

BTW, THIS IS ALL GUESSWORK.  There is no easily found documentation on this and Aslain was kind enough to say that the inner workings were a mystery to him as well.   So, how about some pictures?   Below is an exchange on just how the &$*# does this work:

Quote from Overripe:  “Though I still don’t understand the inner workings of why e.g., 335a for circular, or .436a for horizontal indicators”

My response based on a night of change one thing, replay, curse, change another “ONE” thing, reply, curse.

335a and 436a explanation is simple — those are the the decimal-equiv of the beginning char that designates DEAD or zero HP.

4bcwrua3ldsjz1z6g.jpg

hp-ratio returns an integer from 0-100.  A “new” tank has 100HP + 436 == 536 or ———-

2snpo5r2yzqu73h6g.jpg

Now, how does hp-ratio perform all of this magic???  the XVM guys aren’t documenting it so its a trial and error.  I spent last night doing multiple configs —   Its cool and weird at the same time.