Jump to content

Migo

Vintarian
  • Posts

    15
  • Joined

  • Last visited

Posts posted by Migo

  1. On 10/18/2025 at 6:48 AM, Dirty_Wizard said:

    This is actually a great idea, the loss could be increased the more food you stockpile, as when you hit a certain amount the game becomes kind of too easy. Punish the player for stockpiling too much. Would need to place traps and poison to mitigate it. Maybe a cat mob or something. 

    I think if you implement that you would definitely need a counter to them, such as cats or traps or poison (Can be made from the poisonous mushrooms)

  2. 17 hours ago, Teh Pizza Lady said:

    @BMiBudzYT

    Let me ask you this. If you had paid $30 for Minecraft as it is now without any mods, would you feel cheated? (BTW, around here, we call it The Other Block Game or TOBG for short. It's a little bit like He Who Shall Not Be Named.)

    I wanted to just put my food for thought on this line as someone who bought TOBG when it was not even alpha (now called TOBG Classic) I can say Vintage Story has far more content than TOBG Alpha ever did and we who bought TOBG at that stage during that time were completely fine with it, so I wouldn't even compare these two as if you did VS has way more content than when TOBG was in alpha, comparing a complete game to one in alpha is not a fair comparison.

    To OP I think you've had a very frustrating first experience and that's fine, it reminds me of when I first played and couldn't find anything and was dying to wolves, bears, drifters and hunger. RE: World Gen, I think it probably doesn't help when you see other YTer's video's who have these insane world gen's. I would highlight most of these YTer's have mod's which alter the world generation, and do customise their world settings to get what they want. Stick with it, once you learn the habits the game becomes a little bit easier, what I love about this game is things aren't just given to you, you earn them.

    • Like 1
  3. I managed to figure it out on my own.

    If anyone else is interested here is the code:

    private ICoreClientAPI coreClientAPI;
    
    public override void Start(ICoreAPI api)
    {
        Mod.Logger.Notification("Hello from template mod: " + api.Side);
    }
    
    public override void StartServerSide(ICoreServerAPI api)
    {
        api.Network.RegisterChannel("migodamage")
            .RegisterMessageType(typeof(DamagePlayerPacket));
    
        api.Network.RegisterChannel("migoheal")
            .RegisterMessageType(typeof(DamagePlayerPacket));
    
        api.Network.GetChannel("migodamage").SetMessageHandler<DamagePlayerPacket>(OnDamagePlayerPacket);
        api.Network.GetChannel("migoheal").SetMessageHandler<DamagePlayerPacket>(OnHealPlayerPacket);
    }
    
    public override void StartClientSide(ICoreClientAPI api)
    {
        coreClientAPI = api;
    
        coreClientAPI.Network.RegisterChannel("migodamage")
            .RegisterMessageType(typeof(DamagePlayerPacket));
    
        coreClientAPI.Network.RegisterChannel("migoheal")
            .RegisterMessageType(typeof(DamagePlayerPacket));
    
        api.Event.KeyDown += Event_HealSelf;
    }
    
    private void Event_HealSelf(KeyEvent e)
    {
        if (e.CtrlPressed)
        {
            var packet = new DamagePlayerPacket { DamageAmount = 4 };
            coreClientAPI.Network.GetChannel("migodamage").SendPacket(packet);
            Mod.Logger.Notification("Damage packet sent to server.");
        }
        else if (e.ShiftPressed)
        {
            var packet = new DamagePlayerPacket { DamageAmount = 4 };
            coreClientAPI.Network.GetChannel("migoheal").SendPacket(packet);
            Mod.Logger.Notification("Heal packet sent to server.");
        }
    }
    
    private void OnDamagePlayerPacket(IServerPlayer fromPlayer, DamagePlayerPacket packet)
    {
        var entity = fromPlayer.Entity;
    
        var damageSource = new DamageSource
        {
            Source = EnumDamageSource.Internal,
            Type = EnumDamageType.Injury
        };
    
        entity.ReceiveDamage(damageSource, packet.DamageAmount);
        entity.OnHurt(damageSource, packet.DamageAmount);
    
        float currentHealth = entity.WatchedAttributes.GetOrAddTreeAttribute("health").GetFloat("currenthealth");
    
        Mod.Logger.Notification($"Damaged player {fromPlayer.PlayerName} for {packet.DamageAmount} HP. Health: {currentHealth}");
    }
    
    private void OnHealPlayerPacket(IServerPlayer fromPlayer, DamagePlayerPacket packet)
    {
        var entity = fromPlayer.Entity;
    
        var damageSource = new DamageSource
        {
            Source = EnumDamageSource.Internal,
            Type = EnumDamageType.Heal
        };
    
        entity.ReceiveDamage(damageSource, packet.DamageAmount);
        entity.OnHurt(damageSource, packet.DamageAmount);
    
        float currentHealth = entity.WatchedAttributes.GetOrAddTreeAttribute("health").GetFloat("currenthealth");
    
        Mod.Logger.Notification($"Healed player {fromPlayer.PlayerName} for {packet.DamageAmount} HP. Health: {currentHealth}");
    }
    
    [ProtoContract]
    public class DamagePlayerPacket
    {
        [ProtoMember(1)]
        public int DamageAmount;
    }

     

  4. Only thing I can see now from the logs is:

    - PackYourShovels

    4.9.2025 17:31:11 [Error] [packyourshovel] Exception: Could not load file or assembly 'configlib, Version=1.3.13.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
       at PackYourShovel.ConfigLibIntegration..ctor(ICoreClientAPI api, ModConfig shovelConfig, Boolean isSinglePlayer)
       at PackYourShovel.PackYourShovelModSystem.StartClientSide(ICoreClientAPI api) in C:\Users\shia\source\repos\VS-packyourshovel\PackYourShovels\PackYourShovelModSystem.cs:line 259
       at Vintagestory.Common.ModLoader.TryRunModPhase(Mod mod, ModSystem system, ICoreAPI api, ModRunPhase phase) in VintagestoryLib\Common\API\ModLoader.cs:line 675

    I know you got told to turn off ConfigLib, I would turn it back on to fix this one.

  5. Hi All,

    I am a little new to modding with Vintage Story but I am currently just trying to get it so that client side when the player presses CTRL they take just 1 damage. It's just so that I can explore how this all works.

    I currently have all the key press working but when I call into `OnHurt` or `ReceiveDamage` animations and such happens but the health bar is not updated to reflect anything. Looking into these methods it doesn't look like it would do that, but the problem is I have no idea where this happens.

    Is anyone able to help me out?

    Regards,

    Migo

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.