Перейти к содержимому
Korean Random

Рекомендуемые сообщения

It would be great if there would be somthing py:xvm.total_hp_ratio.ally/enemy and not just py:xvm.total_hp.ally/enemy.

Some nice bars could be made that way :)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Have you tried the math functions?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

It's a data, ration can be calculated from total_hp / current_hp but there is no total hp data (current total_hp is "total hp left" so the current hp of the team). So the ration is needed or both the starting value of the total_hp and the current value to calculate the percentage.

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
(изменено)

@ADIX 

 

Example scripts: hp_panel.py

Example panels: FragCorrelation

Изменено пользователем night_dragon_on

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
10 hours ago, ADIX said:

It's a data, ration can be calculated from total_hp / current_hp but there is no total hp data (current total_hp is "total hp left" so the current hp of the team). So the ration is needed or both the starting value of the total_hp and the current value to calculate the percentage.

 

{{py:xvm.total_hp.ally(100)}} gives the % of HP left on your team (i.e. current / total).

Yes there's no macro that gives you the initial HP, but maybe the above helps? Not sure what outcome you want to achieve.

(I can understand night_dragon_on's work but IDK how to use the .py file heh...)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
11 hours ago, scyorkie said:

{{py:xvm.total_hp.ally(100)}} gives the % of HP left on your team (i.e. current / total).

Yes there's no macro that gives you the initial HP, but maybe the above helps? Not sure what outcome you want to achieve.

(I can understand night_dragon_on's work but IDK how to use the .py file heh...)

 

I wanted to create a hp bar. Yes these macros helped me to do it :)

I'm extending the default xvm config, so using the macros in battleLabelsTemplates.xc in the def section:

 

"totalHP2": {
      "enabled": true,
      "updateEvent": "PY(ON_UPDATE_HP)",
      "x": "{{py:sub({{py:div({{py:sub(100,{{py:percent_hp(0)}})}},2)}},120)}}",
      "y": 35,  
   "width": "{{py:percent_hp(0)}}",
      "screenHAlign": "center",
      "align": "right",
   "height": 15,
   "bgColor": "#00ff00",
   "alpha": "50"
    },
    "totalHP2bg": {
      "enabled": true,
      "updateEvent": "PY(ON_UPDATE_HP)",
      "x": "-120",
      "y": 35,  
   "width": "100",
      "screenHAlign": "center",
      "align": "right",
   "height": 15,
   "bgColor": "#888888",
   "alpha": "50"
    },
    "totalHP3": {
      "enabled": true,
      "updateEvent": "PY(ON_UPDATE_HP)",
      "x": "{{py:sub(120,{{py:div({{py:sub(100,{{py:percent_hp(1)}})}},2)}})}}",
      "y": 35,  
   "width": "{{py:percent_hp(1)}}", 
      "screenHAlign": "center",
      "align": "right",
   "height": 15,
   "bgColor": "#ff0000",
   "alpha": "50"
    },
    "totalHP3bg": {
      "enabled": true,
      "updateEvent": "PY(ON_UPDATE_HP)",
      "x": "120",
      "y": 35,  
   "width": "100",
      "screenHAlign": "center",
      "align": "right",
   "height": 15,
   "bgColor": "#888888",
   "alpha": "50"
    },

 

And in the battleLabels.xc:


      ${ "battleLabelsTemplates.xc":"def.totalHP2" },
      ${ "battleLabelsTemplates.xc":"def.totalHP2bg" },
      ${ "battleLabelsTemplates.xc":"def.totalHP3" },
      ${ "battleLabelsTemplates.xc":"def.totalHP3bg" },

 

To use @night_dragon_on's macros download the latest zip from the site he linked and extract at least the configs\xvm\py_macro folder.

For the list of macros open the NDO_scripts.py file and look for the @xvm.export parts. Between the '...'  is the name of the macro.

As you can see from my config I used percent_hp.

 

Thanks once more @night_dragon_on :)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах
(изменено)

Thanks for the quick tutorial on how to use NDO's .py file. I followed the steps, added your code to my configs, and now understand what you wanted to achieve.

 

I note however that:

i. in your code "align": "right" doesn't work, probably because you used "screenHAlign": "center"

ii. the above means that "x" = the horizontal midpoint of all the bars, and the inner edges are 70 units away from the middle of the screen

iii. the background bars don't actually require an "updateEvent" (maybe that saves some processing power on weaker PCs?)

iv. the same overall effect can be achieved with the built-in macro I referred to previously, hence there is no need for additional .py files.

 

For point (iv) above, this is my version of your code for battleLabelsTemplates.xc:

    "hpGreen": {
      "enabled": true,
      "updateEvent": "PY(ON_UPDATE_HP)",
      "x": "{{py:sub({{py:xvm.screenHCenter}},70)}}", "y": 35,  
      "width": "-{{py:xvm.total_hp.ally(100)}}", "height": 15,
      "bgColor": "#00ff00", "alpha": "50"
    },
    "hpRed": {
      "$ref": { "path":"def.hpGreen" },
      "x": "{{py:add({{py:xvm.screenHCenter}},70)}}",
      "width": "{{py:xvm.total_hp.enemy(100)}}",
      "bgColor": "#ff0000"
    },
    "hpGreenBG": {
      "enabled": true,
      "x": "{{py:sub({{py:xvm.screenHCenter}},70)}}", "y": 35,

      "width": "-100", "height": 15,
      "bgColor": "#888888", "alpha": "50"
    },
    "hpRedBG": {
      "$ref": { "path":"def.hpGreenBG" },
      "x": "{{py:add({{py:xvm.screenHCenter}},70)}}",

      "width": "100"
    },

 

Note that:

a. using {{py:xvm.screenHCenter}}+single.math.macro instead of "screenHAlign"+multiple.math.macros makes the positioning clearer and easier to change later

b. using negative values for ally-bar widths and positive values for enemy-bar widths achieves the same effect as "align right" and "align left" respectively

Изменено пользователем scyorkie

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Thanks, OMG your code is much shorter...

I was sure I tried py:xvm.total_hp.ally(100) ...

 

And thanks for the sample. I didn't know you can add other things next to a $ref part... I'm using my own markers (markersAliveNormal/Extended). They only differ in color. Until now I had the whole damageText part copied to all 6 (per file) section and modified only the color... Now it's just

ally:

"damageText": {
      "$ref": { "path":"def.damageText" },
   "textFormat": {
  "$ref": { "path":"def.damageText.textFormat" },
  "color": "0x00ff00"
   }
    },
    "damageTextPlayer": {
      "$ref": { "path":"def.damageText" },
   "textFormat": {
  "$ref": { "path":"def.damageText.textFormat" },
  "color": "0x0080ff"
   }
    },
    "damageTextSquadman": {
      "$ref": { "path":"def.damageText" },
   "textFormat": {
  "$ref": { "path":"def.damageText.textFormat" },
  "color": "0x0080ff"
   }
    }

 

enemy:

"damageText": {
      "$ref": { "path":"def.damageText" },
   "textFormat": {
  "$ref": { "path":"def.damageText.textFormat" },
  "color": "0xcc0000"
   }
    },
    "damageTextPlayer": {
      "$ref": { "path":"def.damageText" },
   "textFormat": {
  "$ref": { "path":"def.damageText.textFormat" },
  "color": "0xD7A03C"
   }
    },
    "damageTextSquadman": {
      "$ref": { "path":"def.damageText" },
   "textFormat": {
  "$ref": { "path":"def.damageText.textFormat" },
  "color": "0xffff00"
   }
    }

 

insted of millions of lines... Thanks :D

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Создайте аккаунт или войдите в него для комментирования

Вы должны быть пользователем, чтобы оставить комментарий

Создать аккаунт

Зарегистрируйтесь для получения аккаунта. Это просто!

Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите здесь.

Войти сейчас


  • Сейчас на странице   0 пользователей

    Нет пользователей, просматривающих эту страницу.

×