hi, does anyone know an open source mod with different weapons
I can't find up-to-date guides for creating various projectiles
most mod authors block access and it is very difficult to find a good reference
I'm having an issue with my code for armor more so with the line that says that when you equip it you gain stat bonuses
this is my code
public override void UpdateEquip(Player player) {
player.buffImmune[BuffID.Bleeding] = true;
player.thrownDamage += 2f;
}
and when I start to build my mod in the mod sources section it states that my mod failed to build with the term of 'Player" not being able to be found
any help at all would be nice
I'm having an issue with my code for armor more so with the line that says that when you equip it you gain stat bonuses
this is my code
public override void UpdateEquip(Player player) {
player.buffImmune[BuffID.Bleeding] = true;
player.thrownDamage += 2f;
}
and when I start to build my mod in the mod sources section it states that my mod failed to build with the term of 'Player" not being able to be found
any help at all would be nice
public override void SetStaticDefaults() { |
I realised it was because I forgot to put using Terraria at the topuse this
Tooltip.SetDefault(" adds throwing damage ");
public override void SetStaticDefaults() {
you can change what it says. i dont know how to make it only show up when you have all the armor set equipted. so it will show up on the piece you put the code on
I realised it was because I forgot to put using Terraria at the top
i'm trying to make a consumable waffle item that gives you the well fed buff, please provide me with the holy waffle code
I'm not certain, but I think you would need to update item.useStyle directly. The SetDefault hook is only called once, so changing swing has no impact during gameplay.How would I go about increasing the swing style by 1 with every swing, then resetting it after the style = 3? This is the code I have so far, with no luck, any help would be greatly appreciated
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace testMod.Items
{
public class whyNot : ModItem
{
public int swing;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("chonkSword"); // By default, capitalization in classnames will add spaces to the display name. You can customize the display name here by uncommenting this line.
Tooltip.SetDefault("This is a 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 = swing + 1;
if (swing > 3)
{
swing = 0;
}
return true;
}
}
}
So how would I go about that? I'd assume I would want to change that using the UseItem bool, but I can't figure out how I'd go about doing thisI'm not certain, but I think you would need to update item.useStyle directly. The SetDefault hook is only called once, so changing swing has no impact during gameplay.
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
}
}
}
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
}
}
}