Peepachu
Terrarian
IDK if be real, but here is the first way:
And the second way:C#:using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace testMod.Items { public class whyNot : ModItem { public int swing = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("chonkSword"); Tooltip.SetDefault("This is not basic modded sword."); } public override void SetDefaults() { item.damage = 2140; item.melee = true; item.width = 40; item.height = 40; item.useTime = 30; item.useAnimation = 20; item.useStyle = swing; item.knockBack = 90; item.value = 10000; item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item1; item.autoReuse = true; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.DirtBlock, 10); recipe.AddTile(TileID.WorkBenches); recipe.SetResult(this); recipe.AddRecipe(); } public override bool UseItem(Player player) { swing += 1; if (swing > 3) swing = 0; return true; //using weapon after setting } } }
Quote this post if you will have compile (send screen of error, but try to fix it yourself if possible) / in-game error (describe it and send video if possible).C#:using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace testMod.Items { public class whyNot : ModItem { public int swing = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("chonkSword"); Tooltip.SetDefault("This is not basic modded sword."); } public override void SetDefaults() { item.damage = 2140; item.melee = true; item.width = 40; item.height = 40; item.useTime = 30; item.useAnimation = 20; item.useStyle = 0; //that's standard swing (on start) item.knockBack = 90; item.value = 10000; item.rare = ItemRarityID.Cyan; item.UseSound = SoundID.Item1; item.autoReuse = true; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.DirtBlock, 10); recipe.AddTile(TileID.WorkBenches); recipe.SetResult(this); recipe.AddRecipe(); } public override bool UseItem(Player player) { swing += 1; if (swing > 3) swing = 0; item.useStyle = swing; //changing swing right from there return true; //using weapon } } }
I ended up getting it to work partially how I wanted, and two things.
1. Using 0 as the standard swing style didn't work, 1 was the original swing instead
2. The sprite and using of the item is glitchy, as I don't think any item was meant to be used in more than 1 style