I'm having a problem with creating a refund effect for an ability. The ability applies a friendly buff that lasts 40s. If the unit already has the buff, on refresh the cost of the ability should be refunded. I thought my best bet would be from the Effect: Refresh Effect on the buff using an Apply Behavior effect to target the caster using Effect: Unit but changing the targeting parameters to every option hasn't worked.
I've also tried using a trigger to apply the refund by checking to see if the unit being targeted by the ability has the buff already. The problem is since the ability applies the buff already, the condition always evaluates to true so the refund is always applied.
Right now, I'm thinking of two other solutions and would like to see if there was something I'm missing.
First is to make the ability a dummy and apply the buff through triggers. This way, when the ability is used, no buff is applied and the trigger condition should evaluate correctly.
Second is to have the ability also cast a dummy buff on the caster. When the buff is refreshed, it'll search an area within the casting range and apply the refund as a Modify Unit effect with a validator that the dummy buff must be present on the unit. The problem I can see with this approach is it doesn't account for more than one unit within the search area having the dummy buff, so the refund might be applied to a unit that didn't refresh the buffed unit.
Ideally, since our map is trigger heavy, I'd like an editor solution, but if there is no better design I will probably go with the first option.
Yes and I can confirm the buff does get refreshed. I initially had a Modify Unit effect, but changing the target unit didn't seem to be able to get it to affect the caster and it either applied to the target or not at all. Any tips on getting it to work?
edit: Okay! I got it to work properly! Turns out it was just stupidity on my end. Had two behaviors set up for a requirement/validator and was applying the wrong one. After checking everything, the Modify Unit effect with the Target: Impact Unit - Caster option worked!
So you want to adjust the caster cooldown when a buff on the target is refreshed? That would be set under the Modify Unit effect Target: Impact Unit - Value field. An alternative would be to have a validated Modify Unit effect using a Unit Compare Behaviour Count validator on a Set effect so if it applies the buff and if the target already has the buff it will be refreshing it.
Rollback Post to RevisionRollBack
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
Actually the cooldown remains unchanged, I just want to refund the energy cost. I got it working such that the energy is refunded properly, but it only works if the energy pool has spent more than 1 ability cost.
Example: the hero's pool is 205 energy. The energy cost is 40. One cast will take it to 165. If the energy pool is more than 165, say 180 or 175, the refund will restore it to 165 instead of to 180 or 175. If I have less than 165, it will restore properly.
No, the maximum energy is 205. I'm wondering if it is applying the modify unit effect before applying the ability cost. That would explain why if energy is more than 165 it would reset to 165.
Alright! Working as intended. I didn't create a persistent to act as a delay, but I took that concept and since I had a bunch of leftover parts from previous attempts, I ended up with:
Ability -> Apply Buff target, Apply Refund Buff on Caster validated on the target having the buff
Refund Buff -> 1s duration, expire effect Modify Unit
So I guess it was applying the refund before the ability cost. Thanks for all the help and ideas!
Hi again!
I'm having a problem with creating a refund effect for an ability. The ability applies a friendly buff that lasts 40s. If the unit already has the buff, on refresh the cost of the ability should be refunded. I thought my best bet would be from the Effect: Refresh Effect on the buff using an Apply Behavior effect to target the caster using Effect: Unit but changing the targeting parameters to every option hasn't worked.
I've also tried using a trigger to apply the refund by checking to see if the unit being targeted by the ability has the buff already. The problem is since the ability applies the buff already, the condition always evaluates to true so the refund is always applied.
Right now, I'm thinking of two other solutions and would like to see if there was something I'm missing.
First is to make the ability a dummy and apply the buff through triggers. This way, when the ability is used, no buff is applied and the trigger condition should evaluate correctly.
Second is to have the ability also cast a dummy buff on the caster. When the buff is refreshed, it'll search an area within the casting range and apply the refund as a Modify Unit effect with a validator that the dummy buff must be present on the unit. The problem I can see with this approach is it doesn't account for more than one unit within the search area having the dummy buff, so the refund might be applied to a unit that didn't refresh the buffed unit.
Ideally, since our map is trigger heavy, I'd like an editor solution, but if there is no better design I will probably go with the first option.
You use Modify Player/Unit effects to refund costs.
You got the Refresh Stack flag enabled under the buff?
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
Yes and I can confirm the buff does get refreshed. I initially had a Modify Unit effect, but changing the target unit didn't seem to be able to get it to affect the caster and it either applied to the target or not at all. Any tips on getting it to work?
edit: Okay! I got it to work properly! Turns out it was just stupidity on my end. Had two behaviors set up for a requirement/validator and was applying the wrong one. After checking everything, the Modify Unit effect with the Target: Impact Unit - Caster option worked!
So you want to adjust the caster cooldown when a buff on the target is refreshed? That would be set under the Modify Unit effect Target: Impact Unit - Value field. An alternative would be to have a validated Modify Unit effect using a Unit Compare Behaviour Count validator on a Set effect so if it applies the buff and if the target already has the buff it will be refreshing it.
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
Actually the cooldown remains unchanged, I just want to refund the energy cost. I got it working such that the energy is refunded properly, but it only works if the energy pool has spent more than 1 ability cost.
Example: the hero's pool is 205 energy. The energy cost is 40. One cast will take it to 165. If the energy pool is more than 165, say 180 or 175, the refund will restore it to 165 instead of to 180 or 175. If I have less than 165, it will restore properly.
The effect setup is currently:
Effect - Vitals: 40 energy
Target - Impact Unit: (None):Caster:Unknown
Any ideas?
As stated use a Set effect and a validated Modify Unit effect that checks if the target already has the buff.
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
Hm I'm still having the same problem. The set up now is:
Ability Effect: Buff Set
Buff Set: Buff Apply Behavior, Modify Unit
Modify Unit: Vitals - 40 Energy, Target - Impact Unit: (None):Caster:Unknown, Validators: Not Enemy, Count target behavior: buff = 1
And I get a refund if energy is less than 165, otherwise any time I cast the ability my energy is reset to 165.
Is 165 the maximum energy the unit has?
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
No, the maximum energy is 205. I'm wondering if it is applying the modify unit effect before applying the ability cost. That would explain why if energy is more than 165 it would reset to 165.
Add a create persistent to act as a small delay then?
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
Alright! Working as intended. I didn't create a persistent to act as a delay, but I took that concept and since I had a bunch of leftover parts from previous attempts, I ended up with:
Ability -> Apply Buff target, Apply Refund Buff on Caster validated on the target having the buff
Refund Buff -> 1s duration, expire effect Modify Unit
So I guess it was applying the refund before the ability cost. Thanks for all the help and ideas!
So solved?
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
Yes solved, thank you!