I'm using a Combatant HUD to display info (name, level, stats, etc.) when I click on a combatant in field and battle. In Combatant Settings of the HUDs menu, I select:
- Combatant Type: Group
- Start Index Offset: 0
- Limit List Length: Checked
- Maximum Length: 1
Displayed Groups: Player, Ally and Enemy.

Then, in code, I set a var named "combatant" to the combatant on which I clicked with a raycast and then I use:

combatantIndex = ORK.Game.Combatants.GetAll().FindIndex(x => x == combatant);
((CombatantHUDSetting)examineHUD.settings).groupStartOffset = combatantIndex;

It works perfectly when I click on members of the player group, but when I click on an enemy, it displays the info of a player combatant instead...

I can make it work when I uncheck "Displayed Groups: Ally". However, if all 3 are checked, it won't display enemies.

I think there is some kind of bug there...Right?
  • That's because the index from ORK.Game.Combatants.GetAll() doesn't match the index of combatants in the HUDs. GetAll will just return all registered combatant instances in whatever order they're added, while the HUD will first add the player group, next the allies and finally the enemies.

    It might be easier to work with the Status Requirements in the HUD's display conditions - you can use it to only display combatants that match a status requirement, e.g. adding a (hidden) status effect to the clicked combatant to mark it as displayed.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited September 2019
    Oh! Thanks for the tip! I tried your solution and it works.

    Now however, I have a problem with updating the HUDs information. For instance, if I hit an opponent and reduce his Hit Points, the Hit Points status is not updated in the HUD until I click another time on the combatant to "refresh" its HUD. Is there a way to make the HUD update itself as soon as a status that it displays is changed? In Menu Settings/HUD Settings, HUD Check Time is set to 1, but it never seems to change...
    Post edited by ArsMagika on
  • Hm, that's strange - combatant HUDs will automatically update when a value changes.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited September 2019
    I made some tests and I think I understand this issue a bit better... The problem comes from the fact that the Status Value I show is a combined value that comes from a formula. If I show a non-combined Status Value, it updates perfectly. However, if the value comes from a formula, it doesn't.

    Is there something I can do to automatically update the display of a combined Status Value obtained from a formula?
    Post edited by ArsMagika on
  • edited September 2019
    Found it! If you look carefully in the Help section of the formula setting of the Status Value panel, it is writen that it is recommended to use only "normal" type status values in formulae because otherwise they won't update automatically.

    It happens that my formula used "consumable" type status values... When I changed these values to normal, everything was fixed!

    I should have red the Help section more carefully! Nice job on your side for the Help text!
    Post edited by ArsMagika on
  • Yeah ... Combined status values are a bit tricky. If you really want to use them with a consumable, you need to recalculate them after a change to their used value. You can do this manually using the Reset Combatant Status node in the event system.

    The next update will probably make this easier, as you can use game events upon status value changes :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.