• For issues you find with the Switch and Console releases, please follow this link and give as much detail as possible. This is the speediest way to get info to Pipeworks and get a hotfix in the works.
  • For issues you find with the Mobile 1.3 update, please follow this link and give as much detail as possible. This is the speediest way to get info to DR Studios to look at your issue. Also, some troubleshooting hints here.

tModLoader Paladin's Shield Effect

RS_Mind

Spazmatism
I've been trying for quite a while now to add the Paladin's Shield effect to a custom accessory. My issue is that I don't know how to port the effect from the vanilla code to mod code. The main obstacle is that the code affects other players as well as the player that equips the item.

I found this code that applies the Paladin's Shield effect, but I don't know which override to place it in or how to define i.
Code:
Main.player[i] = new Player(true);
                    if (i != Main.myPlayer && player.miscCounter % 10 == 0)
                    {
                        int myPlayer = Main.myPlayer;
                        if (Main.player[myPlayer].team == player.team && player.team != 0)
                        {
                            float num = base.position.X - Main.player[myPlayer].position.X;
                            float num2 = base.position.Y - Main.player[myPlayer].position.Y;
                            float num3 = (float)Math.Sqrt((double)(num * num + num2 * num2));
                            if (num3 < 800f)
                            {
                                Main.player[myPlayer].AddBuff(43, 20, true);
                            }
                        }
                    }
 
If you don't care of ussing the Vanilla stats for the shield's effect just use
Code:
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.hasPaladinShield = true;          
        }
 
Top Bottom