What I'm trying to do is make an ability/behavior that makes a unit regenerate hp if it has <100hp, degenerate hp if it has >100hp, and do nothing if it has =100hp. I could make this work with a complex trigger but I'm wondering if it's possible to do this with the data editor.
Yes. The answer is validators which are basically the same as conditions in triggers. I'd give a more detailed explanation but you'd learn more by playing around with the system yourself.
Units come with their own inherent CUnit_LifeRegenRate so there are at least two ways to do it.
Solution A
1.) Create two Validators, one to check if the unit is over 100 life, one to check if the unit is under 100 life
2.) Create two Behaviors, one to regen life, one to degen life
Solution B (clunky)
1.) Create the unit with its own regen
2.) Create one Validator to check if the unit is over 100 life
3.) Create one Behavior to degen life that will, in essence, cancel out the unit's regen
Validators
This Validator returns true when the unit has less than 100 life
name: Under100Life
type: CValidatorUnitCompareVital (used to compare/check things like life, shields, and energy)
- CValidatorUnitCompare_Compare: e_valueCompareLT (this is the logic gate, less than)
- CValidatorUnitCompareVital_Type: e_vitalTypeCurrent (the number we are checking, current life when the Validator is run)
- CValidatorUnitCompareVital_Value: 100 (this the number we are checking against, 100)
- CValidatorUnitCompareVital_Vital: e_unitVitalLife (this is the vital field we are checking, life)
This Validator returns true when the unit has greater than 100 life
this Behavior sets the unit's life regen to +10/sec while it is under 100 life
Behavior: UpTo100
Type: CBehaviorBuff
Duration: -1 (so it goes forever)
CBehaviorBuff_Modification_VitalRegenArray (used to set the regen/degen of life, shields, and energy)
- Life: 10 (+10life/sec)
CBehaviorBuff_DisableValidatorArray (runs this Validator(s) every tick, if they return false the Behavior is turned off)
- Under100Life
this Behavior sets the unit's life regen to -10/sec while it is over 100 life
What I'm trying to do is make an ability/behavior that makes a unit regenerate hp if it has <100hp, degenerate hp if it has >100hp, and do nothing if it has =100hp. I could make this work with a complex trigger but I'm wondering if it's possible to do this with the data editor.
Yes. The answer is validators which are basically the same as conditions in triggers. I'd give a more detailed explanation but you'd learn more by playing around with the system yourself.
@dubo863: Go
Units come with their own inherent CUnit_LifeRegenRate so there are at least two ways to do it.
Solution A
1.) Create two Validators, one to check if the unit is over 100 life, one to check if the unit is under 100 life
2.) Create two Behaviors, one to regen life, one to degen life
Solution B (clunky)
1.) Create the unit with its own regen
2.) Create one Validator to check if the unit is over 100 life
3.) Create one Behavior to degen life that will, in essence, cancel out the unit's regen
Validators
name: Under100Life
type: CValidatorUnitCompareVital (used to compare/check things like life, shields, and energy)
- CValidatorUnitCompare_Compare: e_valueCompareLT (this is the logic gate, less than)
- CValidatorUnitCompareVital_Type: e_vitalTypeCurrent (the number we are checking, current life when the Validator is run)
- CValidatorUnitCompareVital_Value: 100 (this the number we are checking against, 100)
- CValidatorUnitCompareVital_Vital: e_unitVitalLife (this is the vital field we are checking, life)
name:Over100Life
type: CValidatorUnitCompareVital
- CValidatorUnitCompare_Compare: e_valueCompareGT
- CValidatorUnitCompareVital_Type: e_vitalTypeCurrent
- CValidatorUnitCompareVital_Value: 100
- CValidatorUnitCompareVital_Vital: e_unitVitalLife
Behaviors
Behavior: UpTo100
Type: CBehaviorBuff Duration: -1 (so it goes forever) CBehaviorBuff_Modification_VitalRegenArray (used to set the regen/degen of life, shields, and energy)
- Life: 10 (+10life/sec)
CBehaviorBuff_DisableValidatorArray (runs this Validator(s) every tick, if they return false the Behavior is turned off)
- Under100Life
Behavior: DownTo100
Type: CBehaviorBuff
Duration: -1
CBehaviorBuff_Modification_VitalRegenArray
- Life: -10
CBehaviorBuff_DisableValidatorArray
- Over100Life
Find your Unit's Behavior array and add both of these Behaviors to it.
@NoPancakeMix: Go
Woah, thank you for that tutorial.
Could always use the ingame Unit Compare Vital validators used for setting the buildings on fire when under a certain hp.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg