Can you show us your animation code?The projectile isn't animated.
Can you show us your animation code?The projectile isn't animated.
Projectile code?Can you show us your animation code?
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Tremor.Projectiles {
public class Pixinator : ModProjectile
{
public override void SetDefaults()
{
projectile.name = "Pixinator";
projectile.width = 24;
projectile.aiStyle = 1;
projectile.height = 32;
Main.projFrames[projectile.type] = 2;
projectile.friendly = true;
projectile.penetrate = -1;
projectile.timeLeft = 18000;
projectile.tileCollide = true;
projectile.ignoreWater = true;
}
}}
projectile.frameCounter++;
if (projectile.frameCounter > 16)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame > 1)
{
projectile.frame = 0;
}
Thanks now it's animated! Now I only need to find the Waspgun Wasp AI and also find out why the projectile isn't rotating when I'm changing direction of shooting...That's the attributes section, you're only telling it how many frames are available for use
For a basic animation, put in the AI() method for the projectile class:
Code:projectile.frameCounter++; if (projectile.frameCounter > 16) { projectile.frame++; projectile.frameCounter = 0; } if (projectile.frame > 1) { projectile.frame = 0; }
frameCounter upticks the counter for however many ticks you need before it can advance a frame. Here it takes 16 ticks before it can advance a frame, then resets the frame counter. When it advances a frame, it "animates".
The next bit is the index for the frames. You start with 0 here, then it advances to 1, then after the frame advances again, it goes back to 0, thus animating it. This part here is useful for when you have a animated projectile with several different animations that would be used for different scenarios, like the flying and walking animation of pets.
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace AeonsOfTerraria.Items.Armor {
public class AeonBrestplate : ModItem
{
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
equips.Add(EquipType.Body);
return true;
}
public override void SetDefaults()
{
item.name = "Aeon Breastplate";
item.width = 18;
item.height = 18;
AddTooltip("the ultimate brestplate.");
item.value = 999999;
item.rare = 10;
item.defense = 999999999;
}
public override void UpdateEquip(Player player)
{
player.buffImmune[BuffID.OnFire] = true;
player.statManaMax2 += 1000000;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "TrueCoreAes", 30);
recipe.AddIngredient(null, "TrueCoreCaelum", 30);
recipe.AddIngredient(null, "TrueCoreFerus", 30);
recipe.AddIngredient(null, "TrueCoreFortis", 30);
recipe.AddIngredient(null, "TrueCoreInfernum", 30);
recipe.AddIngredient(null, "TrueCoreLunar", 30);
recipe.AddIngredient(null, "TrueCoreMalum", 30);
recipe.AddIngredient(null, "TrueCoreRare", 30);
recipe.AddIngredient(null, "TrueCoreSanctus", 30);
recipe.AddTile(null, "AncientTransmuter");
recipe.SetResult(this);
recipe.AddRecipe();
}
}}
What doesn't work exactly? Do you get an error? Doesn't ithe recipe appear or doesn't the armor show up when you equip it?ummm how do I make a armor piece? I keep on using the layout of the example mod but it wont work
this is what I got
Code:using System; using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace AeonsOfTerraria.Items.Armor { public class AeonBrestplate : ModItem { public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips) { equips.Add(EquipType.Body); return true; } public override void SetDefaults() { item.name = "Aeon Breastplate"; item.width = 18; item.height = 18; AddTooltip("the ultimate brestplate."); item.value = 999999; item.rare = 10; item.defense = 999999999; } public override void UpdateEquip(Player player) { player.buffImmune[BuffID.OnFire] = true; player.statManaMax2 += 1000000; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "TrueCoreAes", 30); recipe.AddIngredient(null, "TrueCoreCaelum", 30); recipe.AddIngredient(null, "TrueCoreFerus", 30); recipe.AddIngredient(null, "TrueCoreFortis", 30); recipe.AddIngredient(null, "TrueCoreInfernum", 30); recipe.AddIngredient(null, "TrueCoreLunar", 30); recipe.AddIngredient(null, "TrueCoreMalum", 30); recipe.AddIngredient(null, "TrueCoreRare", 30); recipe.AddIngredient(null, "TrueCoreSanctus", 30); recipe.AddTile(null, "AncientTransmuter"); recipe.SetResult(this); recipe.AddRecipe(); } }}
Do you have both of the .png files for it? One is shown in game and you have to animate that and then there is the one that is shown in your inventory.ummm how do I make a armor piece? I keep on using the layout of the example mod but it wont work
this is what I got
Code:using System; using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace AeonsOfTerraria.Items.Armor { public class AeonBrestplate : ModItem { public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips) { equips.Add(EquipType.Body); return true; } public override void SetDefaults() { item.name = "Aeon Breastplate"; item.width = 18; item.height = 18; AddTooltip("the ultimate brestplate."); item.value = 999999; item.rare = 10; item.defense = 999999999; } public override void UpdateEquip(Player player) { player.buffImmune[BuffID.OnFire] = true; player.statManaMax2 += 1000000; } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(null, "TrueCoreAes", 30); recipe.AddIngredient(null, "TrueCoreCaelum", 30); recipe.AddIngredient(null, "TrueCoreFerus", 30); recipe.AddIngredient(null, "TrueCoreFortis", 30); recipe.AddIngredient(null, "TrueCoreInfernum", 30); recipe.AddIngredient(null, "TrueCoreLunar", 30); recipe.AddIngredient(null, "TrueCoreMalum", 30); recipe.AddIngredient(null, "TrueCoreRare", 30); recipe.AddIngredient(null, "TrueCoreSanctus", 30); recipe.AddTile(null, "AncientTransmuter"); recipe.SetResult(this); recipe.AddRecipe(); } }}
Do you want this effect on a custom projectile, or with a custom weapon?How do I get a projectile to fall from the sky?
private bool hasUpdated = false;
public override void AI()
{
if(!hasUpdated)
{
hasUpdated = true;
projectile.position.Y -= 100;
// Change the velocity parameter of the projectile here.
}
}
Items that shoot projectiles can't be used as tools.My axe I made can't cut wood for some reason. The auto block select goes toward the nearest tree but wont cut it. It does not make the cutting sound.
public override void SetDefaults()
{
item.name = "Lightning Waraxe";
item.damage = 15;
item.melee = true;
item.width = 50;
item.height = 50;
item.useTime = 10;
item.useAnimation = 10;
item.useStyle = 1;
item.knockBack = 5;
item.value = 10000;
item.rare = 2;
item.useSound = 1;
item.autoReuse = true;
item.shoot = mod.ProjectileType("Bolt");
item.shootSpeed = 15f;
item.axe = 30;
}
}}
Looking through the source code, it looks like I might have to add a hook for setting Player.altFunctionUse.how would i make something like the portal gun like when you right click it shoots something else?
how would i make something like the portal gun like when you right click it shoots something else?
if (Main.mouseRight && Main.mouseRightRelease)
{
// Create new projectile here
}
if(npc.type == 262)
{
bool flag3 = NPC.downedPlantBoss;
NPC.downedPlantBoss = true;
if (!flag3)
{
Main.NewText("Some text", 50, 255, 130);
}
else
{
Main.NewText(Some other text", 50, 255, 130);
}
}
Hi!
I got two questions.
1. I really like the singleplayer chat, it is really handy to be able to spawn npcs easily. But how do I make them spawn a little bit to the right of the player or spawn in groups of for example 10? When i look through the code for it in the example mod I see that it is possible but i just do not get it to work.
2. I want a text to appear when I defeat Plantera for the first time in a world. I am using this code in NPCLoot in GlobalNPC.
The else statement is only there for testing purposes. Every time I take down Plantera, it does not matter if it is the first time in a world or the tenth, it always shows "Some other text". Am i doing something wrong?Code:if(npc.type == 262) { bool flag3 = NPC.downedPlantBoss; NPC.downedPlantBoss = true; if (!flag3) { Main.NewText("Some text", 50, 255, 130); } else { Main.NewText(Some other text", 50, 255, 130); } }
What exactly are you trying to do? Show us some code to let us help you.Blue Magic, I'm attempting to add more mods/items to the example, how can i get passed this,
Terraria.ID.ItemID Does not contain a definition for "ModdedItem"
Please Help, How do i add Defintions for the Items to work ? I'm attempting to port from Tapi also, for custom mods.
//This is added to the Example Mod Script,
recipe = new ModRecipe(this);
recipe.AddIngredient(null, "ExampleItem");
recipe.SetResult(ItemID.Mega Blade);
recipe.AddRecipe();
//This will be in the items file, in the souces, and has a picture along with it named Mega Blade
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace ExampleMod.Items {
public class Face: ModItem
{
public override void SetDefaults()
{
item.name = "Mega Cyan Blade";
item.width = 20;
item.damage = 70;
item.melee = true;
item.useAnimation = 15;
item.useSound = 1;
item.autoReuse = true;
item.height = 20;
item.maxStack = 1;
item.tooltip = "Cutting The Vines.";
item.value = 500;
item.rare = 1;
item.hammer = 100;
item.axe = 100;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "ExampleItem");
recipe.SetResult(this);
recipe.AddRecipe();
}
}}
//After ill have an error when i try to build and reload saying Terraria.ID.ItemID Does not contain a defintion for "Mega Blade"