Mods / CAN Effects
Author: KenigVovan
Side: Both
Created: Jun 18th 2022 at 12:59 PM
Last modified: Jun 22nd at 3:39 PM
Downloads: 8580
Follow Unfollow 64
Latest file for v1.19.8:
effectshud_0.2.11.zip
1-click install
Allow register effects(or use default ones) and show them on client in HUD.
Inspired and uses parts of goxmeor 's BuffStuff - https://mods.vintagestory.at/show/mod/633
Available default effects:
- regeneration
- miningslow
- miningspeed
- walkslow
- walkspeed
- weakmelee
- strengthmelee
- bleeding
- thorns (damage the attacker)
- firedamageimmune
- safefall
- weight buff(for weight mod)
- cantemporalcharge(lowers speed of temporal stability drop and speed up restoration)
- 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)
- extendedmaxbreath
-----------------------------------------------------------------------------------------------------------------------
Set effect on player using command:
/ef effectName durationInMins tier nickname (just for debug, requres creative mode)
-----------------------------------------------------------------------------------------------------------------------
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)
-----------------------------------------------------------------------------------------------------------------------
To check if Entity has effect or get instance of applied effect you can use method below:
entity.EntityHasEffect(effectId); - to check if entity has active effect with provided id
entity.TryGetEntityEffect(effectId, out Effect); - try to get Effect with effectId
-----------------------------------------------------------------------------------------------------------------------
HUD with effect is shown by default for on/off use "L" button
use "L" + SHIFT to open GUI for easier effects application on players
-----------------------------------------------------------------------------------------------------------------------
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, true if effect is positive, true if it's icon should be rendered in HUD)
RegisterClientEffectData("myEffectTypeId", true, true); - effect is positive will have tierNp.png overlay added if tier is > 0, the second true set
that we want it to be drawn in HUD
RegisterClientEffectData("myEffectTypeId", true, false); - this one is positive, but won't be rendered
-----------------------------------------------------------------------------------------------------------------------
Config:
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.
-----------------------------------------------------------------------------------------------------------------------
Icons are from https://game-icons.net/
Version | For Game version | Downloads | Release date | Changelog | Download | 1-click mod install* |
---|---|---|---|---|---|---|
v0.2.11 | 454 | Jun 22nd at 3:39 PM | Show | effectshud_0.2.11.zip | Install now | |
v0.2.10 | 848 | Jan 14th at 1:42 PM | Show | effectshud_0.2.10.zip | Install now | |
v0.2.9 | 897 | Oct 23rd 2023 at 2:57 PM | Show | effectshud_0.2.9.zip | Install now | |
v0.2.8 | 178 | Oct 20th 2023 at 3:06 PM | Show | effectshud_0.2.8.zip | Install now | |
v0.2.7 | 137 | Oct 18th 2023 at 4:46 PM | Show | effectshud_0.2.7.zip | Install now | |
v0.2.6 | 124 | Oct 17th 2023 at 8:10 PM | Show | effectshud_0.2.6.zip | Install now | |
v0.2.5 | 816 | Jun 19th 2023 at 4:30 PM | Show | effectshud_v0.2.5.zip | Install now | |
v0.2.4 | 184 | Jun 18th 2023 at 9:42 AM | Show | effectshud_v0.2.4.zip | Install now | |
v0.2.3 | 462 | May 14th 2023 at 3:04 PM | Show | effectshud_v0.2.3.zip | Install now | |
v0.2.2 | 230 | May 10th 2023 at 3:42 PM | Show | effectshud_v0.2.2.zip | Install now | |
v0.2.1 | 777 | Apr 8th 2023 at 9:36 AM | Show | effectshud_v0.2.1.zip | Install now | |
v0.2.0 | 426 | Mar 1st 2023 at 7:30 PM | Show | effectshud_v0.2.0.zip | Install now | |
v1.0.10 | 170 | Apr 8th 2023 at 9:14 AM | Show | effectshud_v1.0.10.zip | Install now | |
v1.0.8 | 532 | Jan 31st 2023 at 5:43 PM | Show | effectshud_v1.0.8.zip | Install now | |
v1.0.7 | 470 | Nov 13th 2022 at 2:21 PM | Show | effectshud_v1.0.7.zip | Install now | |
v1.0.6 | 375 | Jul 11th 2022 at 2:04 PM | Show | effectshud_v1.0.6.zip | Install now | |
v1.0.4 | 284 | Jul 1st 2022 at 7:43 PM | Show | effectshud_v1.0.4.zip | Install now | |
v1.0.5 | 223 | Jul 10th 2022 at 9:59 AM | Show | effectshud_v1.0.5.zip | Install now | |
v1.0.3 | 231 | Jun 25th 2022 at 1:37 PM | Show | effectshud_v1.0.3.zip | Install now | |
v1.0.2 | 228 | Jun 25th 2022 at 9:50 AM | Show | effectshud_v1.0.2.zip | Install now | |
v1.0.1 | 252 | Jun 19th 2022 at 10:53 AM | Show | effectshud_v1.0.1.zip | Install now | |
v1.0.0 | 259 | Jun 18th 2022 at 1:00 PM | Show | effectshud_v1.0.0.zip | Install now |
Edel_Recke Yanazake
you both missed comment section for another mod or?
Why is the Crosshairs changed? That's really annoying; especially because of the percentage display (which I can't assign anything to anyway and have ignored so far)!
Can i change this?
Wait, does nickname works in mp and can it be set individually? It shows up indefinitely?
Yup, that fixed it. Thanks!
KenigVovan
Telemachus
try 0.2.9
Receiving this crash after updating from v0.2.5 to v0.2.8
I'll look at new effects later,
bool removedAfterDeath is added to Effect,
with font color/outline I'll take a look as well
Some suggestions for the mod.
New default effects
GlowEffect - Makes the player emit a light, could be this eerie blue/green light that you have for a short while after you died. Higher tier = stronger light effect. VERY handy since it allows you to equip e.g. a shield while still having light i dark caves.
SpelunkerEffect - Makes the player see outlines of ore blocks/chest/translocators through walls. Might be hard to accomplish, but would be very cool. Higher tier = longer "sight radius".
BlindnessEffect - Renders a black filter over the entire screen. Higher tier = more opacity.
JumpEffect - Allows the player to jump higher. Higher tier = increased jump height. (for quality of life this effect should also secure you from taking fall damage from jumping, something similar to safefall. safefallDistance = jumpHeight)
WarmthEffect - Keeps you warm during cold winter nights. Higher tier = incresed bonus to body temperature (or some sort of protection in degrees like clothing has)
New property
DeathPermeable - [type: boolean] if true makes the effect stay after death.
About the hud graphics - Maybe try and change the font color for the timer. It's very hard to see in dark areas when the color is black. I have to look up at the sky to read how much time left. And when the sky is dark at night that wont help either.
Perhaps use green color for positive effects, and red color for negative. Or if possible, keep black color but with white outline, or try inverted (white font with black outline), see whatever works best.
Excellent! Ty for quick fix
Frepo
fixed, tier change not in effect's constructor didn't update damagePerTick, so it had default value everytime here
Looks like setting a tier for the bleeding effect doesn't work correctly. The effect seems to always be tier 1 regardless if I try to set it to something else. Perhaps this is the same for other effects as well, that I don't know. I have only tested bleeding so far.
I've tested tier 1, 3 and 20, and you still take 0,05 damage/tick (at least according to the damage log, and what I can se by hovering over my health bar while bleeding).
The code
BleedingEffect effectBleed = new BleedingEffect();
effectBleed.SetExpiryInRealMinutes(1);
effectBleed.tier = 20;
effectshud.src.effectshud.ApplyEffectOnEntity(__instance, effectBleed);
// tier 20 should result in 1 hp damage/tick
Man, this mod sounds great! I've been longing for some "potion effects" for this game.
I've never used someone else's framework before. How do I get access to it in my source code? (visual studio 2022 community)
Do I have to unpack your mod? If so, must I place the unpacked stuff any place special? I figured I must reference your dll-file in my project. Is that enough or do I need to add your whole project to my solution?
Thanks in advance!
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
Would you be ok with mods that add on to this framework? For example adding more hooks to the base Buff class?
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)
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?
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"
whats this?