Hi I am trying to implement a ui at the end of a battle that displays some of the statistics. I turned on the Combatant Battle Statistics and made one called "DamageDealt" that is set to my Health Status Value (in the game it is called Garde) and the Decreases Given checkbox is selected. I then made a message pop up with the following text on a battle win event
"Otto lowered the performers garde by:#*custom0#"

after the battle the value that gets filled in for #*custom0# is always 0. even if I try the other options (decreases received, increases received, increases given) the value remains 0. the Abilities I use in the battle all have a target change for that Health Status Value. Is there something I have to do to make sure the statistic change is being recorded?
  • The statistic text codes are for something else (game statistics, e.g. created items, killed enemies, etc.).

    The combatant battle statistics don't have text codes to display them, their're mainly used for things like battle AI or formulas.
    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!
  • Oh ok. Is there any way to achieve what I was trying to do? Getting values into a battle end event's dialogue.
  • Hm, I think currently the only way would be to use a formula (use the Battle Statistic node to use a combatant's battle statistic value) via a Formula To Variable node to store the statistic into a float variable.

    That enables you to show the value via variable text codes.
    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!
  • Cool! I'll give that a try.

    Do I add the Battle Statistics node to my existing damage formulas? Will that effect the calculation at all? and then in the Battle End Event use the Formula to Variable node? If so I am a little confused on how to print the variable from the "Formula to Variable" Node. I added some screen grabs of my Formula and my Battle End Event.
    Some Info: "DamageDealt" Is the name of the custom Combatant Battle Statistic I set up in Battle Settings

    https://imgur.com/a/xSwA321
  • No, just set up individual formulas for each statistic value you want to display and use them before you want to display the values (e.g. in the battle end event). Adding them to your existing damage formulas would actually change the damage using the statistic values :)
    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!
  • OK, so when is the new battle statistic formula (called DamageStatistic) updated? Do I also need to set up a Battle Event that updates that formula and attach it to my abilities? I've attached a couple more images for reference.

    https://imgur.com/a/6jfMijC

    Image 1: Combatant Battle Statistics setup. Pretty sure everything here is correct. Your verification would be much appreciated

    Image 2: New DamageStatistic Formula with the Battle Statistic Node selected. I am unsure how this formula is being used.

    Image3: Battle End Event with the Formula to Variable Node selected. This is where I am creating the variable damageDealt. However, when I print this value in Image4 the value is always 0.

    Image 4: Battle End Event with the Dialogue Node selected. This is where I am printing the Game Variable I created in Image3.
  • No, you don't need to do that. Formulas just calculate values at the time they're used - they don't keep those values. I.e. you just use the formula to store the result into a variable whenever you want that variable updated, so usually before you display them.

    Your Formula To Variable setup is wrong - unless you want to pass the result of the formula as starting value to the formula, you should just set the Initival Value to the Value value type.
    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!
  • Great! Is there anything else that stands out as incorrect? I changed the Formula to Variable Initial Value to Value with a default value of 0. The value remains 0 when it gets printed though.
  • Ah, yeah - just saw the issue, in the Formula to Variable node, the variable key should use the Value value type as well. You're defining the key you want to store the value into, not a variable you want to use :)

    The Game Variable value type will use the value that's stored in the defined variable key, i.e. in this setup, it'll use the value of a variable as variable key.
    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!
  • Thank you for all your help! I am still consistently getting 0 after changing the Variable Key to Value type.
    I have the key in the Formula to Variable node set to "damageDealt" however, the battle statistic key is "DamageDealt". Should these be the same value?
    And then in the Dialogue node I am displaying the value using #varfloatdamageDealt#.
  • The variable key doesn't have to match the statistics key, since they're separate things.

    After checking your images again, I think it's due to using different variable origins - the Formula To Variable node is using Local origin, while the dialogue uses Global origin, so just change the dialogue's variable origin to Local for the text codes to use the local variable you stored the value into.
    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.