Skip to content
Discussion options

You must be logged in to vote

Hook to OnUpdate hook and set the buff normally (using addbuff) if your custom condition like the player being in a list being positive

I tried to do it like so, but my debuff aren't being applied.

    private void Player_Update(On.Terraria.Player.orig_Update orig, Player self, int i)
    {
        orig(self, i);
        if (self.GetCustomData().isAFK)
        {
            if (self.GetCustomData().afkDebuffCooldown <= 0)
            {
                self.AddBuff(BuffID.Webbed, 60, false);
                self.GetCustomData().afkDebuffCooldown = 60;
                TShock.Log.ConsoleInfo($"Trying to apply debuff");
            }
            self.GetCustomData().afkDebuffCooldown--;

Replies: 5 comments 30 replies

Comment options

You must be logged in to vote
3 replies
@ALEX2014-git
Comment options

@ACaiCat
Comment options

@zyrafaq
Comment options

Comment options

You must be logged in to vote
24 replies
@sgkoishi
Comment options

sgkoishi Aug 3, 2025
Collaborator

@ACaiCat
Comment options

@ALEX2014-git
Comment options

@sors89
Comment options

Answer selected by ALEX2014-git
@zyrafaq
Comment options

@ALEX2014-git
Comment options

@sors89
Comment options

Comment options

You must be logged in to vote
2 replies
@sgkoishi
Comment options

sgkoishi Aug 3, 2025
Collaborator

@zyrafaq
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@zyrafaq
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants