Boxman1100
Terrarian
I would like to add an image to the game at the cursor while the player is holding an item. Like how chairs and tables do when you hold them. But the image will not be the same as the item. Any help would be apreciated.
On mac and linux, you can't build in game unfortunately. Someone wrote up a guide: https://forums.terraria.org/index.p...der-a-modding-api.23726/page-525#post-1001200Hi all, I'm interested in starting to make some mods, and when I used the skeleton mod and added it to the terraria mod source file, the game refused to build and reload it. Here is where the files are (I made two, just in case I screwed up the first one somehow), and this is my error code:
View attachment 205866 View attachment 205867
Thank you so much for any help you can give!
hastebin your code and go into the discord server and go into #help-with-codeHi all, I'm interested in starting to make some mods, and when I used the skeleton mod and added it to the terraria mod source file, the game refused to build and reload it. Here is where the files are (I made two, just in case I screwed up the first one somehow), and this is my error code:
View attachment 205866 View attachment 205867
Thank you so much for any help you can give!
What's the discord name?hastebin your code and go into the discord server and go into #help-with-code
There's ExampleAnimatedPierce in the main projectiles folder in ExampleModThanks, but where are the animated projectiles in ExampleMod?
Hey i need some help i cant change the hold offset on my moded gun can any one help
// Help, my gun isn't being held at the handle! Adjust these 2 numbers until it looks right.
/*public override Vector2? HoldoutOffset()
{
return new Vector2(10, 0);
}*/
That is odd, as I copied the code and had no problems. As for the range, check the size of your sprite, as this code works fine.Hello, I am trying to make a modded sword, and I'm running into two issues.
1. The sword's sprite doesn't show up when swinging.
2. No matter what I set the item.width and item.height values to, the sword always has a ridiculously long range (It can hit things offscreen)
Here is the code: (I've just started so there's not a lot)
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace NinjagoMod.Items
{
public class SwordOfFire : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Sword of Fire");
Tooltip.SetDefault("Forged with gold from the Golden Peaks");
}
public override void SetDefaults()
{
item.damage = 25;
item.melee = true;
item.width = 40;
item.height = 40;
item.useTime = 22;
item.useAnimation = 22;
item.useStyle = 1;
item.knockBack = 6;
item.value = 50000;
item.rare = 2;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.noUseGraphic = false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.GoldBar, 15);
recipe.AddIngredient(ItemID.Diamond, 1);
recipe.AddIngredient(ItemID.Ruby, 5);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.PlatinumBar, 15);
recipe.AddIngredient(ItemID.Diamond, 1);
recipe.AddIngredient(ItemID.Ruby, 5);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
{
target.AddBuff(BuffID.OnFire, 300);
}
}
}
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace NinjagoMod.Items
{
public class SwordOfFire : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Sword of Fire");
Tooltip.SetDefault("Forged with gold from the Golden Peaks");
}
public override void SetDefaults()
{
item.damage = 25;
item.melee = true;
item.width = 40;
item.height = 40;
item.useTime = 22;
item.useAnimation = 22;
item.useStyle = 1;
item.knockBack = 6;
item.value = 50000;
item.rare = 2;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.noUseGraphic = false;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.GoldBar, 15);
recipe.AddIngredient(ItemID.Diamond, 1);
recipe.AddIngredient(ItemID.Ruby, 5);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.PlatinumBar, 15);
recipe.AddIngredient(ItemID.Diamond, 1);
recipe.AddIngredient(ItemID.Ruby, 5);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this);
recipe.AddRecipe();
}
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
{
target.AddBuff(BuffID.OnFire, 300);
}
}
}
ThanksFound this in ExampleGun in ExampleMod. Hope it helpsCode:// Help, my gun isn't being held at the handle! Adjust these 2 numbers until it looks right. /*public override Vector2? HoldoutOffset() { return new Vector2(10, 0); }*/
![]()
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Microsoft.Xna.Framework;
using System.IO;
using ReLogic;
using System;
using System.Text.RegularExpressions;
using Microsoft.Xna.Framework.Graphics;
using Terraria.Localization;
namespace PurxyMod.NPCs
{
public class GoblinBush : ModNPC
{
const int COOLDOWN = 110;
int remaining_cooldown = 0;
Random rnd = new Random();
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Bush Goblin");
}
public override void SetDefaults()
{
npc.width = 18;
npc.height = 40;
npc.damage = 12;
npc.defense = 5;
npc.lifeMax = 500;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
npc.value = 100f;
npc.knockBackResist = 0.75f;
npc.aiStyle = 3;
Main.npcFrameCount[npc.type] = Main.npcFrameCount[NPCID.Zombie];
aiType = 3; // aiType = 3;
animationType = NPCID.Zombie;
}
public override void PostAI()
{
{
Vector2 target = Main.player[npc.target].position;
float dist = Vector2.Distance(npc.position, target);
{
if (dist < 500f)
{
if (remaining_cooldown == 0)
{
Vector2 speed = target - npc.position;
speed.Normalize();
speed *= 11f;
int proj = Projectile.NewProjectile(npc.position.X, npc.position.Y, speed.X, speed.Y, mod.ProjectileType("SeedProjectile"), npc.damage, 1f);
remaining_cooldown = COOLDOWN;
}
if (remaining_cooldown == COOLDOWN)
{
Main.PlaySound(SoundID.Item63, Convert.ToInt32(npc.position.X), Convert.ToInt32(npc.position.Y));
}
remaining_cooldown -= 1;
}
}
}
if (Main.rand.Next(1000) == 0)
{
Main.PlaySound(SoundID.ZombieMoan, Convert.ToInt32(npc.position.X), Convert.ToInt32(npc.position.Y));
}
}
public override void NPCLoot()
{
if (Main.rand.Next(11) == 0)
{
Item.NewItem(npc.getRect(), ItemID.Blowpipe);
}
Item.NewItem(npc.getRect(), ItemID.TatteredCloth, Main.rand.Next(4));
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
return 0.5f;
}
}
}
using Terraria;
using Microsoft.Xna.Framework;
using Terraria.ID;
using Terraria.ModLoader;
namespace SlimeMod.NPCs.Enemies
{
public class MeteorSlime : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Meteor Slime");
}
public override void SetDefaults()
{
npc.width = 32;
npc.height = 24;
npc.damage = 38;
npc.defense = 4;
npc.lifeMax = 45;
npc.HitSound = SoundID.NPCHit3;
npc.DeathSound = SoundID.NPCDeath3;
npc.value = 60f;
npc.knockBackResist = 1f;
npc.aiStyle = 1;
Main.npcFrameCount[npc.type] = 2;
animationType = 1;
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
return !Main.dayTime && spawnInfo.player.ZoneMeteor ? 1f : 0.5f;
}
public override void FindFrame(int frameHeight)
{
npc.frameCounter -= 0.9F;
npc.frameCounter %= Main.npcFrameCount[npc.type];
int frame = (int)npc.frameCounter;
npc.frame.Y = frame * frameHeight;
}
public override void OnHitPlayer(Player player, int damage, bool crit)
{
if (Main.rand.Next(2) == 0) // the chance
{
player.AddBuff(BuffID.OnFire, 480, true);
}
}
public override void NPCLoot()
{
Item.NewItem(npc.getRect(), ItemID.Gel, 1 + Main.rand.Next(3)); //1, 2, or 3
if (Main.rand.Next(3) < 1)
Item.NewItem(npc.getRect(), ItemID.Meteorite, 1);
}
}
}
using Terraria;
using Microsoft.Xna.Framework;
using Terraria.ID;
using Terraria.ModLoader;
namespace SlimeMod.NPCs.Enemies
{
public class CactusSlime : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Cactus Slime");
}
public override void SetDefaults()
{
npc.width = 40;
npc.height = 40;
npc.damage = 16;
npc.defense = 4;
npc.lifeMax = 45;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
npc.value = 60f;
npc.knockBackResist = 1f;
npc.aiStyle = 1;
Main.npcFrameCount[npc.type] = 2;
animationType = 1;
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
{
return Main.dayTime && spawnInfo.player.ZoneDesert ? 1f : 0.5f;
}
public override void FindFrame(int frameHeight)
{
npc.frameCounter -= 0.9F;
npc.frameCounter %= Main.npcFrameCount[npc.type];
int frame = (int)npc.frameCounter;
npc.frame.Y = frame * frameHeight;
}
public override void OnHitPlayer(Player player, int damage, bool crit)
{
if (Main.rand.Next(2) == 0) // the chance
{
player.AddBuff(BuffID.Poisoned, 300, true);
}
}
public override void NPCLoot()
{
Item.NewItem(npc.getRect(), ItemID.Gel, 1 + Main.rand.Next(3)); //1, 2, or 3
if (Main.rand.Next(10000) < 1)
Item.NewItem(npc.getRect(), ItemID.SlimeStaff, 1);
Item.NewItem(npc.getRect(), ItemID.Cactus, 4 + Main.rand.Next(7));
}
}
}
usingTerraria;
usingMicrosoft.Xna.Framework;
usingTerraria.ID;
usingTerraria.ModLoader;
namespaceSlimeMod.NPCs.Enemies
{
publicclassSpikedLavaSlime : ModNPC
{
publicoverridevoidSetStaticDefaults()
{
DisplayName.SetDefault("Spiked Lava Slime");
}
publicoverridevoidSetDefaults()
{
npc.width=40;
npc.height=40;
npc.damage=16;
npc.defense=4;
npc.lifeMax=45;
npc.HitSound=SoundID.NPCHit1;
npc.DeathSound=SoundID.NPCDeath1;
npc.value=60f;
npc.knockBackResist=1f;
npc.aiStyle=1;
Main.npcFrameCount[npc.type] =2;
animationType=1;
}
publicoverridefloatSpawnChance(NPCSpawnInfo spawnInfo)
{
returnspawnInfo.player.ZoneUnderworldHeight0.5f : 0.3f;
}
publicoverridevoidFindFrame(int frameHeight)
{
npc.frameCounter-=0.9F;
npc.frameCounter%=Main.npcFrameCount[npc.type];
int frame = (int)npc.frameCounter;
npc.frame.Y=frame * frameHeight;
}
publicoverridevoidOnHitPlayer(Player player, int damage, bool crit)
{
if (Main.rand.Next(2) ==0) // the chance
{
player.AddBuff(BuffID.Poisoned, 300, true);
}
}
}
}