using Terraria;
using System;
using Terraria.ID;
using System.Diagnostics;
using Microsoft.Xna.Framework;
using Terraria.ModLoader;
namespace SacredTools.Items.Weapons
{
public class PandolarRepeater : ModItem
{
public override void SetDefaults()
{
item.name = "Pandolar Repeater";
item.damage = 55;
item.noMelee = true;
item.ranged = true;
item.width = 69;
item.height = 40;
item.toolTip = "death to the enemies!";
item.toolTip2 = "Pandolar FTW!";
item.useTime = 18;
item.useAnimation = 30;
item.useStyle = 5;
item.shoot = 3;
item.useAmmo = 1;
item.knockBack = 1;
item.value = Item.sellPrice(0, 30, 0, 0);
item.rare = 5;
item.useSound = 5;
item.autoReuse = true;
item.shootSpeed = 20f;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.FrostburnArrow, damage, knockBack, player.whoAmI, 0f, 0f); //This is spawning a projectile of type FrostburnArrow using the original stats
return false; //Makes sure to not fire the original projectile
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.SnowBlock, 100);
recipe.AddIngredient(null, "OblivionBar", 20);
recipe.AddIngredient(null, "PandolarBow", 1);
recipe.AddTile(TileID.MythrilAnvil); //at work bench
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
ooooohhhh.... so basically he disappeared becus he got 100 times the knockback... WELL
[doublepost=1468146708,1468146296][/doublepost]and i have another question:
how do i make my crossbow shoot FASTER??
if i change the usetime it will shoot 2 or more arrows after each other and also consume them, pls halp
heres the code:
[doublepost=1468146827][/doublepost]and how do i spawn more dust on an debuffed NPC/Player and make em not move away from the entity (for some reason my dust moves away from the debuffed enemy)Code:using Terraria; using System; using Terraria.ID; using System.Diagnostics; using Microsoft.Xna.Framework; using Terraria.ModLoader; namespace SacredTools.Items.Weapons { public class PandolarRepeater : ModItem { public override void SetDefaults() { item.name = "Pandolar Repeater"; item.damage = 55; item.noMelee = true; item.ranged = true; item.width = 69; item.height = 40; item.toolTip = "death to the enemies!"; item.toolTip2 = "Pandolar FTW!"; item.useTime = 18; item.useAnimation = 30; item.useStyle = 5; item.shoot = 3; item.useAmmo = 1; item.knockBack = 1; item.value = Item.sellPrice(0, 30, 0, 0); item.rare = 5; item.useSound = 5; item.autoReuse = true; item.shootSpeed = 20f; } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.FrostburnArrow, damage, knockBack, player.whoAmI, 0f, 0f); //This is spawning a projectile of type FrostburnArrow using the original stats return false; //Makes sure to not fire the original projectile } public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ItemID.SnowBlock, 100); recipe.AddIngredient(null, "OblivionBar", 20); recipe.AddIngredient(null, "PandolarBow", 1); recipe.AddTile(TileID.MythrilAnvil); //at work bench recipe.SetResult(this); recipe.AddRecipe(); } } }
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace SacredTools.Dusts
{
public class PandolarDust : ModDust
{
public override void OnSpawn(Dust dust)
{
dust.color = new Color(103, 208, 208);
dust.alpha = 1;
dust.scale = 1.13f;
dust.velocity *= 1.4f;
dust.noGravity = true;
dust.noLight = false;
}
public override bool Update(Dust dust)
{
dust.position += dust.velocity;
dust.rotation += dust.velocity.X * 0.15f;
dust.scale *= 0.99f;
float light = 0.35f * dust.scale;
Lighting.AddLight(dust.position, light, light, light);
if (dust.scale < 0.5f)
{
dust.active = false;
}
return false;
}
}
}
If lag, you have maybe add too many dust. After, maybe than put a dust to zero (Maybe put just dust.velocity = Vector2.Zero) can have problem. (but this is not that, because, no reason ^^)halp something went wrong, i tried to add minions to my boss, it didnt work so i removed them again, then i wanted to make the dust have no velocity, AND NOW I CANT PLAY! IT ALWAYS SAYS FAILED TO LOAD NO BACKUP FOUND ;-;
i hope i didnt loose my world....
public override void SetDefaults()
{
Main.tileFrameImportant[Type] = true;
Main.tileNoAttach[Type] = true;
Main.tileLavaDeath[Type] = true;
TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3);
TileObjectData.newTile.StyleHorizontal = true;
TileObjectData.newTile.StyleWrapLimit = 36;
TileObjectData.newTile.Direction = Terraria.Enums.TileObjectDirection.PlaceRight;
TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight;
animationFrameHeight = 54;
TileObjectData.newAlternate.CopyFrom(TileObjectData.Style3x3);
TileObjectData.newAlternate.StyleHorizontal = true;
TileObjectData.addAlternate(1);
Main.tileContainer[Type] = true;
TileObjectData.addTile(Type);
dustType = 7;
disableSmartCursor = true;
AddMapEntry(new Color(120, 85, 60), "Turret");
}
public override void KillMultiTile(int i, int j, int frameX, int frameY)
{
Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("MyItem"));
}
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace SacredTools.Dusts
{
public class ShadowDust : ModDust
{
public override void OnSpawn(Dust dust)
{
dust.color = new Color(103, 24, 122);
dust.alpha = 1;
dust.scale = 1.13f;
dust.velocity *= 1.4f;
dust.noGravity = true;
dust.noLight = false;
}
public override bool Update(Dust dust)
{
dust.position += dust.velocity;
dust.rotation += dust.velocity.X * 0.15f;
dust.scale *= 0.99f;
float light = 0.35f * dust.scale;
Lighting.AddLight(dust.position, light, light, light);
if (dust.scale < 0.5f)
{
dust.active = false;
}
return false;
}
}
}
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace SacredTools.NPCs
{
public class PandolarTrader : ModNPC
{
public override bool Autoload(ref string name, ref string texture)
{
name = "PandolarTrader";
return mod.Properties.Autoload;
}
public override void SetDefaults()
{
npc.name = "PandolarTrader";
npc.displayName = "Pandolar Trader";
npc.townNPC = true;
npc.friendly = true;
npc.width = 18;
npc.height = 40;
npc.aiStyle = 7;
npc.damage = 30;
npc.defense = 50;
npc.lifeMax = 500;
npc.soundHit = 1;
npc.soundKilled = 1;
npc.knockBackResist = 0.5f;
Main.npcFrameCount[npc.type] = 25;
animationType = NPCID.Guide;
}
public override bool CanTownNPCSpawn(int numTownNPCs, int money)
{
return false;// this make that he will spawn when a house is available
}
public override string TownNPCName()
{ //NPC names
switch (WorldGen.genRand.Next(4))
{
case 0:
return "Mural";
case 1:
return "Reggie";
case 2:
return "Waglington";
default:
return "Tucker";
}
}
public override string GetChat()
{ //npc chat
switch (Main.rand.Next(10))
{
case 0:
return "its a beautiful day outside...";
case 1:
return "all hail Pandolar.";
case 2:
return "you got some spare ice blocks maybe?? its really hot right now.";
case 3:
return "my old home looked way better than this";
case 4:
return "sometimes i think about licking ice cubes...";
case 5:
return "you wanna buy something??";
case 6:
return "you want something??";
case 7:
return "my race was very powerful a long time ago, but now we are almost extinct";
case 8:
return "Eseduh ohuht edahyay emecuh elyay eruhahl ah es et";
default:
return "sup scrub";
}
}
public override void SetChatButtons(ref string button, ref string button2)
{
button = Lang.inter[28];
}
public override void OnChatButtonClicked(bool firstButton, ref bool shop)
{
if (firstButton)
{
shop = true;
}
}
public override void SetupShop(Chest shop, ref int nextSlot)
{
shop.item[nextSlot].SetDefaults(mod.ItemType("PandolarBow")); //items that he sells
nextSlot++;
shop.item[nextSlot].SetDefaults(mod.ItemType("Pandolance"));
nextSlot++;
shop.item[nextSlot].SetDefaults (ItemID.Snowball);
nextSlot++;
}
public override void TownNPCAttackStrength(ref int damage, ref float knockback)
{
damage = 20;
knockback = 4f;
}
public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown)
{
cooldown = 30;
randExtraCooldown = 30;
}
public override void TownNPCAttackProj(ref int projType, ref int attackDelay)
{
projType = mod.ProjectileType("FrostBeamProjectile");
attackDelay = 1;
}
public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset)
{
multiplier = 12f;
randomOffset = 2f;
}
}
}
oh, ok, srry that im a big noob at C# ^-^
[doublepost=1468179309,1468179049][/doublepost]the only thing now i need help at is this:
Code:using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace SacredTools.NPCs { public class PandolarTrader : ModNPC { public override bool Autoload(ref string name, ref string texture) { name = "PandolarTrader"; return mod.Properties.Autoload; } public override void SetDefaults() { npc.name = "PandolarTrader"; npc.displayName = "Pandolar Trader"; npc.townNPC = true; npc.friendly = true; npc.width = 18; npc.height = 40; npc.aiStyle = 7; npc.damage = 30; npc.defense = 50; npc.lifeMax = 500; npc.soundHit = 1; npc.soundKilled = 1; npc.knockBackResist = 0.5f; Main.npcFrameCount[npc.type] = 25; animationType = NPCID.Guide; } public override bool CanTownNPCSpawn(int numTownNPCs, int money) { return false;// this make that he will spawn when a house is available } public override string TownNPCName() { //NPC names switch (WorldGen.genRand.Next(4)) { case 0: return "Mural"; case 1: return "Reggie"; case 2: return "Waglington"; default: return "Tucker"; } } public override string GetChat() { //npc chat switch (Main.rand.Next(10)) { case 0: return "its a beautiful day outside..."; case 1: return "all hail Pandolar."; case 2: return "you got some spare ice blocks maybe?? its really hot right now."; case 3: return "my old home looked way better than this"; case 4: return "sometimes i think about licking ice cubes..."; case 5: return "you wanna buy something??"; case 6: return "you want something??"; case 7: return "my race was very powerful a long time ago, but now we are almost extinct"; case 8: return "Eseduh ohuht edahyay emecuh elyay eruhahl ah es et"; default: return "sup scrub"; } } public override void SetChatButtons(ref string button, ref string button2) { button = Lang.inter[28]; } public override void OnChatButtonClicked(bool firstButton, ref bool shop) { if (firstButton) { shop = true; } } public override void SetupShop(Chest shop, ref int nextSlot) { shop.item[nextSlot].SetDefaults(mod.ItemType("PandolarBow")); //items that he sells nextSlot++; shop.item[nextSlot].SetDefaults(mod.ItemType("Pandolance")); nextSlot++; shop.item[nextSlot].SetDefaults (ItemID.Snowball); nextSlot++; } public override void TownNPCAttackStrength(ref int damage, ref float knockback) { damage = 20; knockback = 4f; } public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) { cooldown = 30; randExtraCooldown = 30; } public override void TownNPCAttackProj(ref int projType, ref int attackDelay) { projType = mod.ProjectileType("FrostBeamProjectile"); attackDelay = 1; } public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) { multiplier = 12f; randomOffset = 2f; } } }
i coded him to use the FrostBeamProjectile when an enemy is near, but the only thing he does is run away, pls help me find the issue
[doublepost=1468179716][/doublepost]and 3 extra things i forgot:
-How to play a dust on an NPC (no buff)
-How to display a Sprite above a buffed NPC/Player
-How to make a Beam Projectile (like the Shadowbeamstaff but without the ricochet)
1)argh, forgot another two:
-How do i make my debuff drain more HP (only does 1, no matter how much negative life regen i put)
-How do i make an Accessory give more maxhealth
public override float CanSpawn(NPCSpawnInfo spawnInfo)
{
Player player = spawnInfo.player;
int x = spawnInfo.spawnTileX;
int y = spawnInfo.spawnTileY;
int tile = (int)Main.tile[x, y].type;
return (Main.hardMode && !spawnInfo.playerSafe && (y > Main.maxTilesY - 190) ) ? 1f : 0f;
}