Hello,
I am trying to define a buff with infinite duration. I would like your feedback and thoughts on the following options:
A) Re-add buff on finish
<buff name="AAA" remove_on_death="true">
<stack_type value="duration"/>
<duration value="10"/>
<update_rate value="9"/>
<effect_group name="AAA" tiered="false">
<triggered_effect trigger="onSelfBuffFinish" action="AddBuff" target="self" buff="AAA"/>
</effect_group>
</buff>
This seems to work partially only. After 9 renew (hitting the smallest common multiple of duration and update_rate), the renew fails.
B) Use a dedicated duration cvar
I think this is how the game proceeds for infinite buffs. Use a cvar buff_duration, and remove the buff when the cvar hits 0.
For performance, you probably want a local cvar and check for IsServer in the cvar check
With A and B, If you need both finite and infinite version of the buff, you end duplicating it in xml. C) tries to solve it by making the renew depends on a cvar
C) Renew optionnaly
<effect_group name="renewable">
<requirement name="RenewBuffRequirement, Mymod" target="self"/>
<triggered_effect trigger="onSelfBuffFinish" action="AddBuff" target="self" buff="AAA"/>
</effect_group>
RenewBuffRequirement receives the buff name as parameter (say it's "AAA"), and check for cvar "__isrenew__AAA" on target entity.
Benefits:
- Don't duplicate buffs.
- The cvars "__isrenew__{buff_name}" are most of the time left to their default value (better performance than B which requires a set cvar per target of the buff)
This fails : I can see the requirement called and return the proper value, but the buff still wears off. Moving the requirement in/out the <triggered> fails in both case.
I cannot understand why this does not work, while A works (almost identical xml). Do you have an explanation for this ?
How do you usually implement infinite buff ?
Thank you for your attention !
I am trying to define a buff with infinite duration. I would like your feedback and thoughts on the following options:
A) Re-add buff on finish
<buff name="AAA" remove_on_death="true">
<stack_type value="duration"/>
<duration value="10"/>
<update_rate value="9"/>
<effect_group name="AAA" tiered="false">
<triggered_effect trigger="onSelfBuffFinish" action="AddBuff" target="self" buff="AAA"/>
</effect_group>
</buff>
This seems to work partially only. After 9 renew (hitting the smallest common multiple of duration and update_rate), the renew fails.
B) Use a dedicated duration cvar
I think this is how the game proceeds for infinite buffs. Use a cvar buff_duration, and remove the buff when the cvar hits 0.
For performance, you probably want a local cvar and check for IsServer in the cvar check
With A and B, If you need both finite and infinite version of the buff, you end duplicating it in xml. C) tries to solve it by making the renew depends on a cvar
C) Renew optionnaly
<effect_group name="renewable">
<requirement name="RenewBuffRequirement, Mymod" target="self"/>
<triggered_effect trigger="onSelfBuffFinish" action="AddBuff" target="self" buff="AAA"/>
</effect_group>
RenewBuffRequirement receives the buff name as parameter (say it's "AAA"), and check for cvar "__isrenew__AAA" on target entity.
Benefits:
- Don't duplicate buffs.
- The cvars "__isrenew__{buff_name}" are most of the time left to their default value (better performance than B which requires a set cvar per target of the buff)
This fails : I can see the requirement called and return the proper value, but the buff still wears off. Moving the requirement in/out the <triggered> fails in both case.
I cannot understand why this does not work, while A works (almost identical xml). Do you have an explanation for this ?
How do you usually implement infinite buff ?
Thank you for your attention !