• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Buff effects - add X(value) over Y(duration), easy way?

poly

New member
Hey,

I'm trying to learn more about how buffs work in order to add a lot of new items to my mod - Alchemy.

I've been experimenting with different values but I can't figure out a simple way to execute what I'm trying to achieve.

Can somebody kindly explain how to achieve the following:

I'd like to create a buff which adds 1 health point over 5 seconds, to a max of 20 health points.
So after 100 seconds a player would have gained 20 health points.

I've had a look at the medicalFirstAidKit code in items.xml but I'm unable to decipher exactly where the part I need is written.
Conversely, in buffs.xml I've looked at buffCoffee with the idea of perhaps using part of that code to try to get an understanding of adding value over time, but I'm just not getting anywhere.

If somebody who knows a lot more than me about this could help I'd be greatly appreciative... I'd then be able to expand the potions of my mod! I've got so many new ideas for buffs but can't implement them because I'm stuck at this part!

 
Last edited by a moderator:
Few ways you can do this.. First being using the healthchange function.

From notes:
HealthChangeOT,    Alter hit points by this much every 1second

So if you're wanting 1 health every 5 seconds, your healthchangeot value would be .2.. Every second it would restore .2 health, hitting that 1 health on the 5th tick.

Another way would be to have the duration of the buff set to 100 seconds, then the update rate set to 5 seconds. OnSelfBuffUpdate, trigger a heal of 1.

Or you could have that update rate set to 1 second, and add .2 health like the healthchangeot would do.

I personally, so that I'd have more control of it, would use the onselfbuffupdate example with it healing 1 health every 5 seconds. It wouldnt be as smooth as the healthchangeot, but  thats how i'd do it.

<buff name="buffSpellHealHOT" hidden="true">
<stack_type value="ignore"/>
<duration value="6"/>
<update_rate value="2" />
<effect_group name="Attach">
<triggered_effect trigger="onSelfBuffStart" action="AddPart" part="SpellHealHOTParticle" prefab="#@modfolder:Resources/TelricsQuestWorld.unity3d?SpellHealHOTPrefab" localPos="-.15,.75,1.2" localRot="0,90,90" parentTransform="Camera"/>

<triggered_effect trigger="onSelfBuffFinish" action="RemovePart" part="SpellHealHOTParticle"/>
</effect_group>
<effect_group name="Heal">
<triggered_effect trigger="onSelfBuffUpdate" action="ModifyStats" stat="Health" operation="add" value="@SpellHealHOTAmount"/>
</effect_group>
</buff>




A little snip from my quest world mod with an example. This buff lasts 6 seconds, and heals for a cvar number (the @SpellhealHotAmount, which can be just a normal number) every 2 seconds. So 3 total heals will happen. Say that cvar was set to 5, that would be 15 health over the entire duration.

 
Few ways you can do this.. First being using the healthchange function.

From notes:
HealthChangeOT,    Alter hit points by this much every 1second

So if you're wanting 1 health every 5 seconds, your healthchangeot value would be .2.. Every second it would restore .2 health, hitting that 1 health on the 5th tick.

Another way would be to have the duration of the buff set to 100 seconds, then the update rate set to 5 seconds. OnSelfBuffUpdate, trigger a heal of 1.

Or you could have that update rate set to 1 second, and add .2 health like the healthchangeot would do.

I personally, so that I'd have more control of it, would use the onselfbuffupdate example with it healing 1 health every 5 seconds. It wouldnt be as smooth as the healthchangeot, but  thats how i'd do it.

<buff name="buffSpellHealHOT" hidden="true">
<stack_type value="ignore"/>
<duration value="6"/>
<update_rate value="2" />
<effect_group name="Attach">
<triggered_effect trigger="onSelfBuffStart" action="AddPart" part="SpellHealHOTParticle" prefab="#@modfolder:Resources/TelricsQuestWorld.unity3d?SpellHealHOTPrefab" localPos="-.15,.75,1.2" localRot="0,90,90" parentTransform="Camera"/>

<triggered_effect trigger="onSelfBuffFinish" action="RemovePart" part="SpellHealHOTParticle"/>
</effect_group>
<effect_group name="Heal">
<triggered_effect trigger="onSelfBuffUpdate" action="ModifyStats" stat="Health" operation="add" value="@SpellHealHOTAmount"/>
</effect_group>
</buff>




A little snip from my quest world mod with an example. This buff lasts 6 seconds, and heals for a cvar number (the @SpellhealHotAmount, which can be just a normal number) every 2 seconds. So 3 total heals will happen. Say that cvar was set to 5, that would be 15 health over the entire duration.
Thank you so much for taking the time to answer... I have tried it out and got it to work!!! 

 
Back
Top