Jump to content
Korean Random
Sign in to follow this  
ger

total_hp_ratio

Recommended Posts

is there a way I can get a macro for the ratio of totlal_hp/totalhp_at_the_beginning ?  If no it would be nice to implement it, maybe in py macros

Share this post


Link to post

Short link
Share on other sites

Example:

 

'py_macro'

#####################################################################
# imports

import xvm_battle.python.fragCorrelationPanel as panel
import BigWorld

#####################################################################
# constants

max_hp_team = [0, 0]

@xvm.export('current_hp', deterministic=False)
def current_hp(current_team):
    return panel.teams_totalhp[current_team]

@xvm.export('percent_hp', deterministic=False)
def percent_hp(current_team):
    global actual_arenaUniqueID, max_hp_team
    arenaUniqueID = BigWorld.player().arenaUniqueID
    if actual_arenaUniqueID != arenaUniqueID:
      actual_arenaUniqueID = arenaUniqueID
      max_hp_team[0] = panel.teams_totalhp[0]
      max_hp_team[1] = panel.teams_totalhp[1]
    return round((100. * current_hp(current_team)) / max_hp_team[current_team], 0)

{{py:current_hp(0)}} - current hp ally team
{{py:current_hp(1)}} - current hp enemy team

Calculate the percentage of the current value of points of strength relative to the starting value

{{py:percent_hp(0)}} - current hp ally team, %
{{py:percent_hp(1)}} - current hp enemy team, %

More examples for understanding the principle of operation of the macro: account panel / панель счета
Edited by night_dragon_on

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...