reboot404iw
Terrarian
I am very new to modding, and I was wondering if anyone could tell me how I could make an accessory that changes the damage type of weapons to a different one?
Make a class inheriting a GlobalItem, override the SetDefaults method, make a conditional checking if the item's type is the same as the item you want to modify, then set the item's actual damage bool to false and set the other one to true.I am very new to modding, and I was wondering if anyone could tell me how I could make an accessory that changes the damage type of weapons to a different one?
public class Example : GlobalItem {
public override void SetDefaults(Item item) {
if (item.type == ItemID.IronPickaxe) {
item.melee = false;
item.ranged = true;
}
}
}
That looks like I would have to change the damage type of every item individually. I am trying to make something that automatically changes all items' damage types to just one.
public class Example : GlobalItem {
public override void SetDefaults(Item item) {
item.melee = true;
item.ranged = false;
item.magic = false;
item.thrown = false;
item.summon = false;
}
}
You'd have to loop through the player's inventory and manually change variables in some update hook.Would it be possible to change using a buff that is applied by an accessory?
It is entirely possible, Dire just gave the most basic answer (seeing as there's no direct hook for item variable modification based on something like a buff or accessory).