Mods / EffectsHUD

Category: #Other
Author: KenigVovan
Side: Both
Created: Jun 18th at 12:59 PM
Last modified: Nov 13th at 2:21 PM
Downloads: 670
Follow Unfollow 6

Mod is WIP

Allow register effects(or use default ones) and show them on client in HUD.

Inspired and uses parts of goxmeor 's BuffStuff -


List of default effects - regeneration, miningslow, miningspeed, walkslow, walkspeed, weakmelee, strengthmelee, bleeding, thorns(damage the attacker), firedamageimmune, safefall, invisibility (hides armor and cloths as well now, idk yet how to leave armor/cloths render there), forgetting (instant effect which lets player to use .charsel 1 more time)

Set effect on player using command:

/ef effectName durationInMins tier nickname (just for debug)


If you want to apply effect on the player in the code:

create new Effect: MiningSlowEffect ef = new MiningSlowEffect();

set duration: ef.SetExpiryInRealMinutes(3);

apply effect on entity: effectshud.src.effectshud.ApplyEffectOnEntity(entity, efslow);

(or using AddEffect of EBEffectsAffected - player's EntityBehavior)

You can set it's tier or duration with (SetExpiryInTicks,SetExpiryInRealMinutes and others)


HUD with effect is shown by default for on/off use "L" button


To register you own effect in StartServerSide you need to call and provide typeId of effect and class

RegisterEntityEffect("myEffectTypeId", typeof(myEffectClass));

in StartClientSide: (typeId again and your icons for every tier of the effect)

RegisterClientEffectData("myEffectTypeId", new string[] { "mymoddomain:effects/tiericon1", "mymoddomain:effects/tiericon2", "mymoddomain:effects/tiericon3" });



TICK_EVERY_SECONDS - will change how long is tick in real seconds, for now it's 1 real second and for now can not be changed by config.




Version For Game version Downloads Release date Changelog Download
v1.0.7 62 Nov 13th at 2:21 PM Show
v1.0.6 192 Jul 11th at 2:04 PM Show
v1.0.4 113 Jul 1st at 7:43 PM Show
v1.0.5 43 Jul 10th at 9:59 AM Show
v1.0.3 56 Jun 25th at 1:37 PM Show
v1.0.2 47 Jun 25th at 9:50 AM Show
v1.0.1 68 Jun 19th at 10:53 AM Show
v1.0.0 66 Jun 18th at 1:00 PM Show

6 Comments (oldest first | newest first)

💬 KenigVovan, Jul 3rd at 6:44 PM

No problems with addons

If you mean to add OnEntityRevive, OnFallToGround, OnInteract, OnEntityReceiveDamage and others from EntityBehavior - i have it in a plan. To make a base for effects like vampirism, protections against(fire, fall, arrows, melee atacks), damage reflection etc.

I'll place source files on git in few days, but it's a mess now


💬 jakecool19, Jul 3rd at 3:50 PM

Would you be ok with mods that add on to this framework? For example adding more hooks to the base Buff class?

💬 KenigVovan, Jul 1st at 7:48 AM

The main point (at least for now) was to prepare effects handling for potions items.

Mod uses EntityBehavior so it might be expand on other entities, but Effects implementations could require some changes.
(because default Effects here use "Stats" of the player and i'm not 100% sure it's the same with other Entities)

💬 jakecool19, Jun 30th at 7:21 PM

Amazing work! I have been hoping we would get a proper status effect system for this game for quite awhile. What is the ultimate finished goal for this one? Will it just be for players, or will it work with all entities?

💬 KenigVovan, Jun 19th at 8:33 AM

It is WIP.
Mod for HUD on which effects (picture of buff/debuff) can be drawn. 
it uses player's WatchedAttributes to track updates.

You can register effect to show by:
RegisterEffect(string watchedBranch, string effectWatchedName, bool showTime, string effectDurationWatchedName, string [] domainAndPath, Vintagestory.API.Common.Func needToShow)

example of use for "miningSpeedMul" in stats:
effectshud.src.effectshud.RegisterEffect("stats", "miningSpeedMul", false, "", new string[] { "canmods:effects/slowmining1", "canmods:effects/slowmining2", "canmods:effects/slowmining3" }, checkminigSpeedMul);

checkminigSpeedMul here is function which is called on branch update and return number of picture which shoud be drawn, if -1 is return that means that effect is not active

public int checkminigSpeedMul()
      var t2 = capi.World.Player.Entity.Stats["miningSpeedMul"];
      var t = t2.GetBlended();
      if (t < 0.35)
          return 2;
      else if (t < 0.5)
          return 1;
      else if (t < 0.85)
          return 0;
      return -1;

Display of the time is not functinal yet, so choose false for showTime, if you want to try it.

Pictures size used is 64x64.

For HUD to show press "L"

💬 DemonBigj781, Jun 19th at 2:07 AM

whats this?

(edit comment delete)