I have an ability that adds a debuff if it did any damage. My thought was to do this in Target Changes:
1. Store the current health as an object variable 2. Deal damage 3. Conditionally add buff if current health is lower than 1.
However, this didn't work. I then tried to debug this by storing the current health in another variable in 3, which prints the health correctly (difference in before/after). I changed that to a boolean variable, which also printed true.
I then changed the condition in 3 to read the boolean variable I just added, but it seemed that it couldn't find the object variable.
I then changed the variables to be global. Still didn't work.
I then added the global variable to the _Makinom object directly at the start of the game. Still didn't work.
Is there something specific about how Status Effect is calculated such that it's not looking at the variables?
Can you give me some details on where you do this and the setup you use for the variable changes and checks?
Generally, you could do this with Change Schematics on status values, e.g. adding a (hidden) status effect to a combatant whenever health was decreased. The change schematics can also be limited to only execute from abilities or items, only for negative changes, etc. The status value could have a very low duration (e.g. 1 second) and you can use it in checks directly after the damage to determine if a damage happened.
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!
Hmm, after some more testing I somehow got it working, and I can't repro it anymore.
I think it might be because of an incorrect setup - I first tried using local variables, which didn't work, then I switched to object variables. In hindsight I might have mixed up User and Target (since for variable condition, there's an additional target object which I chose "target", so I should have chosen "user" for the source of the object variable, which I mixed up). I'm not sure why it didn't work when I changed those to global variables though. It should have (and it did, after a few more tries).
It's working as intended now, though :)
So directly in the ability:
1. Change Object Variable to store current health 2. Deal damage 3. Conditionally add debuff if current health is now lower.
Generally, you could do this with Change Schematics on status values, e.g. adding a (hidden) status effect to a combatant whenever health was decreased.
The change schematics can also be limited to only execute from abilities or items, only for negative changes, etc.
The status value could have a very low duration (e.g. 1 second) and you can use it in checks directly after the damage to determine if a damage happened.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I think it might be because of an incorrect setup - I first tried using local variables, which didn't work, then I switched to object variables. In hindsight I might have mixed up User and Target (since for variable condition, there's an additional target object which I chose "target", so I should have chosen "user" for the source of the object variable, which I mixed up). I'm not sure why it didn't work when I changed those to global variables though. It should have (and it did, after a few more tries).
It's working as intended now, though :)
So directly in the ability:
1. Change Object Variable to store current health
2. Deal damage
3. Conditionally add debuff if current health is now lower.