Please help make me a Flask (Im desperate :l)

You know he's asking how to code one, not craft one in game, right?

You can have the flask add the buff to the player on use, and the buff itself would enable a bool on your ModPlayer class. Then, in the OnHitNPC method, just check if the bool is true, apply the specific debuff to the target.
 
You know he's asking how to code one, not craft one in game, right?

You can have the flask add the buff to the player on use, and the buff itself would enable a bool on your ModPlayer class. Then, in the OnHitNPC method, just check if the bool is true, apply the specific debuff to the target.
I tried experimenting with it a bit (like 30 minutes) But i still cant do it, can you maybe like make a example? Im sorry if im asking for too much lol, im still kinda new and coding is kinda confusing, aswell that there are no tutorials about it online : (
 
So the exact thing you're asking for isn't in ExampleMod, but it has the necessary code in different places. For example

Example crate buff - shows how to set a bool on your ModPlayer class when the buff is active
So just create the bool itself in your ModPlayer class, then set it to true in the buff like above.
Then, in the ModPlayer class, you do the logic for what happens when you hit an NPC after using the flask.

For example, if you are setting them on fire, do this (This is 1.4.4 code btw)
C#:
        public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
        {
            if (customBuff)
                target.AddBuff(BuffID.OnFire, 3600);
        }
 
You know he's asking how to code one, not craft one in game, right?

You can have the flask add the buff to the player on use, and the buff itself would enable a bool on your ModPlayer class. Then, in the OnHitNPC method, just check if the bool is true, apply the specific debuff to the target.
0h I'm an idiot
 
So the exact thing you're asking for isn't in ExampleMod, but it has the necessary code in different places. For example

Example crate buff - shows how to set a bool on your ModPlayer class when the buff is active
So just create the bool itself in your ModPlayer class, then set it to true in the buff like above.
Then, in the ModPlayer class, you do the logic for what happens when you hit an NPC after using the flask.

For example, if you are setting them on fire, do this (This is 1.4.4 code btw)
C#:
        public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
        {
            if (customBuff)
                target.AddBuff(BuffID.OnFire, 3600);
        }
Experimented a bit more and still cant do it :(
 
Back
Top Bottom