Hi!

Does anyone know how to trigger an event each time a member of the player's group receives a damage? My goal is to set a global bool game variable named "isAnyoneWoundedInParty" that will have a value of true if someone in the party is not at max HP and would be false otherwise...

Thanks!
  • I think you might want to approach that a little differently, for one because there could be various reasons a character is not at max HP. Anyway, not being entirely sure of what you're looking to achieve, my thought would be to attach an 'Event Interaction' script to your combatants' game object and attach an event to it that will check more specifically for whether an individual combatant has received damage. This could also change or create a Global Variable, but remember that you only have one such variable and likely multiple combatants, so at the very least you'll probably want to check the state of said variable before doing anything with it in your event.
  • Sorry, I feel that I should have given more details... My goal is simply to display a button that triggers a heal ability when someone in the party is not at full HP. What I did was to create a Shortcut-type HUD with only one cell that displays the heal ability of the leader combatant of the player group. I added a display requirement that check the variable "isAnyoneWoundedInParty" is true.

    The only thing I still need to figure out is how to set this variable to true each time someone is wounded and then, set it to false each time everyone is fully healed.

    I'll try your solution with the Event Interaction script and come back with some news. However, now that I gave you some more details about what I want to do, I'm curious to know if you think there's a better way to achieve my objective...
  • So, I added an Event Interaction component on all my party's combatants with Start Type Autostart, Repeat Event True, and Reenable After (s) 3 and it works very well!

    If I was to use Damage Zones and Damage Dealer, I guess I could also use the Game Event Settings which says "You can optionally start a game event upon damage"...
  • edited July 2019
    You could also use a Global Event (World > Global Events) that uses a Check Status node to check if anyone in the player's group (actor) has less than 100% HP, setting a variable as a condition for your HUD.

    Run the global event on Auto (e.g. every 3 seconds) and you'll have the same result, but only need one event without any setup on the combatants :)
    Post edited by gamingislove on
    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!
  • @gamingislove Thanks! I did just what you recommended and it works perfectly!
Sign In or Register to comment.