I'm trying to make it so when a unit takes damage, its scaled smaller based on its health percentage. So if a marine gets attacked, it gets smaller. I'm trying to do this through the data editor and looked through the behaviors but I couldn't find a modification for scale. Is it possible to do this in the data editor, or do I have to resort to triggers? I've seen a map called ShadowTD which has a shrink ability/behavior, but I couldn't figure out how he did it.
Event:
Unit - Any unit takes any amount of damage
Action:
Unit - Set (triggering unit)'s Scale to (percentage of (triggering unit)'s health) of it's original size
In my TD I used attributes because there is an event for attribute changes. The reason for this is that I couldn't think of a better way to detect when the shrink buff wears off. So instead I created an attribute and made the behavior increase the attribute by 1 point for 30 seconds. That triggers the shrink, and then when the attribute goes down because of the behavior, the event fires and the trigger resets the scale.
Note that you can probably do this using the data editor only, I may try and switch to that format in the future.
Honestly it would be much easier to do it through trigger and less repetitive but I can tell you how to do it using data editor.
Step 1. Create number of dummy behaviors with HP checking validators
E.g. 100HP (BUFF) with validator (less than 100 HP)
75HP (BUFF) with validator (less than 75 HP)
50HP (BUFF) with validator (less than 50 HP)
25HP (BUFF) with validator (less than 25 HP)
Add all of these behaviors to the marine
Step 2.
Go to Marine Actor
Events
Add Event: 100HP(Buff).Behavior.On
Term: set scale 1
Blend time: Optional
Add Event: 75HP(Buff).Behavior.On
Term: set scale 0.75
Blend time: Optional
I'm trying to make it so when a unit takes damage, its scaled smaller based on its health percentage. So if a marine gets attacked, it gets smaller. I'm trying to do this through the data editor and looked through the behaviors but I couldn't find a modification for scale. Is it possible to do this in the data editor, or do I have to resort to triggers? I've seen a map called ShadowTD which has a shrink ability/behavior, but I couldn't figure out how he did it.
Event:
Unit - Any unit takes any amount of damage
Action:
Unit - Set (triggering unit)'s Scale to (percentage of (triggering unit)'s health) of it's original size
That works fine.
In my TD I used attributes because there is an event for attribute changes. The reason for this is that I couldn't think of a better way to detect when the shrink buff wears off. So instead I created an attribute and made the behavior increase the attribute by 1 point for 30 seconds. That triggers the shrink, and then when the attribute goes down because of the behavior, the event fires and the trigger resets the scale.
Note that you can probably do this using the data editor only, I may try and switch to that format in the future.
Honestly it would be much easier to do it through trigger and less repetitive but I can tell you how to do it using data editor.
Step 1. Create number of dummy behaviors with HP checking validators
E.g. 100HP (BUFF) with validator (less than 100 HP)
75HP (BUFF) with validator (less than 75 HP)
50HP (BUFF) with validator (less than 50 HP)
25HP (BUFF) with validator (less than 25 HP)
Add all of these behaviors to the marine
Step 2.
Go to Marine Actor
Events
Add Event: 100HP(Buff).Behavior.On
Term: set scale 1
Blend time: Optional
Add Event: 75HP(Buff).Behavior.On
Term: set scale 0.75
Blend time: Optional
and so on...