Look at ExampleMod.cs for some helper functions for NoZone you might like.Ok, I need help with a few things...
- Does anyone know how to make a town NPC be like the 'Cobbler' from Thorium, as in there is an option to give the player a buff?
- How do I make my custom NPC spawn only on a grass block/dirt block.
Or how do I make my NPC spawn in the Forest biome, and ZonePurity isn't there.
- When I talk to my custom NPC, it mostly doesn't say anything, not even the text box comes up, here is the code, I think it has to do with the 'cases' https://hastebin.com/urovigutoy.cs
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace AncientSecrets.Items.Weapons
{
public class BerserkerAxe : ModItem
{
public override void SetDefaults()
{
item.name = "Berserker's Throwing Axe";
item.damage = 50;
item.noMelee = true;
item.width = 34;
item.height = 30;
//item.toolTip = "Attack speed increases as health decreases, up to a maximum of 200%";
item.useTime = 48;
item.useAnimation = 17;
item.useStyle = 1;
item.knockBack = 1;
item.value = 25000;
item.rare = 7;
item.autoReuse = true;
item.shoot = mod.ProjectileType("BerserkerAxeP");
item.shootSpeed = 8f;
item.useTurn = true;
item.noUseGraphic = true;
projOnSwing = true;
}
//public override bool UseItem(Player player)
//{
// float hpPerc =((float)player.statLife / (float)player.statLifeMax2) * 100;
// item.useTime = 16 + ((int)(hpPerc * 32));
// return true;
//}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
// Fix the speedX and Y to point them horizontally.
//speedX = new Vector2(speedX, speedY).Length() * (speedX > 0 ? 1 : -1);
//speedY = 0;
// Add random Rotation
Vector2 speed = new Vector2(speedX, speedY);
speed = speed.RotatedByRandom(MathHelper.ToRadians(30));
return true;
}
}
}
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace AncientSecrets.Projectiles
{
public class BerserkerAxeP : ModProjectile
{
public override void SetDefaults()
{
projectile.name = "Berserker Axe";
projectile.width = 34;
projectile.melee = true;
projectile.height = 30;
projectile.aiStyle = 2;
projectile.friendly = true;
projectile.penetrate = 0;
projectile.tileCollide = true;
projectile.timeLeft = 600;
projectile.alpha = 255;
projectile.extraUpdates = 1;
aiType = ProjectileID.ThrowingKnife;
}
}
}
I know it's possible to change an item's reuse delay dynamically, so changing the shoot speed should also work. It's just a matter of where you change the shoot speed. I'd suggest you try the HoldItem hook, which is called each frame while being held. I'd expect that the following should work and let you see what's going on, though I havn't tested it.I cannot get my custom throwing weapon to work. I have the projectile in ModDictionary/Projectiles
Code:using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace AncientSecrets.Items.Weapons { public class BerserkerAxe : ModItem { public override void SetDefaults() { item.name = "Berserker's Throwing Axe"; item.damage = 50; item.noMelee = true; item.width = 34; item.height = 30; //item.toolTip = "Attack speed increases as health decreases, up to a maximum of 200%"; item.useTime = 48; item.useAnimation = 17; item.useStyle = 1; item.knockBack = 1; item.value = 25000; item.rare = 7; item.autoReuse = true; item.shoot = mod.ProjectileType("BerserkerAxeP"); item.shootSpeed = 8f; item.useTurn = true; item.noUseGraphic = true; projOnSwing = true; } //public override bool UseItem(Player player) //{ // float hpPerc =((float)player.statLife / (float)player.statLifeMax2) * 100; // item.useTime = 16 + ((int)(hpPerc * 32)); // return true; //} public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { // Fix the speedX and Y to point them horizontally. //speedX = new Vector2(speedX, speedY).Length() * (speedX > 0 ? 1 : -1); //speedY = 0; // Add random Rotation Vector2 speed = new Vector2(speedX, speedY); speed = speed.RotatedByRandom(MathHelper.ToRadians(30)); return true; } } }
Code:using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace AncientSecrets.Projectiles { public class BerserkerAxeP : ModProjectile { public override void SetDefaults() { projectile.name = "Berserker Axe"; projectile.width = 34; projectile.melee = true; projectile.height = 30; projectile.aiStyle = 2; projectile.friendly = true; projectile.penetrate = 0; projectile.tileCollide = true; projectile.timeLeft = 600; projectile.alpha = 255; projectile.extraUpdates = 1; aiType = ProjectileID.ThrowingKnife; } } }
Also is it possible to dynamically change a items use speed when it's in the middle of use?
public override void HoldItem(Player player)
{
float hpPerc =((float)player.statLife / (float)player.statLifeMax2);
item.useTime = 16 + ((int)(hpPerc * 3200));
Main.NewText("useTime: " + item.useTime); //outputs the useTime to chat
}
How do I make a shield that gives you +2 defence if the players health is a quarter of its full health? I've already done the shield part, I just need the 'if (player.MaxLife something)'
if (((float)player.statLife / (float)player.statLifeMax2) < 0.25) {
//defence code
}
This functionally works fine, however the players arm doesn't change speed, so the projectile is being created out of sync with the player's arm movementsI know it's possible to change an item's reuse delay dynamically, so changing the shoot speed should also work. It's just a matter of where you change the shoot speed. I'd suggest you try the HoldItem hook, which is called each frame while being held. I'd expect that the following should work and let you see what's going on, though I havn't tested it.
Code:public override void HoldItem(Player player) { float hpPerc =((float)player.statLife / (float)player.statLifeMax2); item.useTime = 16 + ((int)(hpPerc * 3200)); Main.NewText("useTime: " + item.useTime); //outputs the useTime to chat }
You download the new release and run the installer or do it manually.How do you update tModLoader?
are you sure you are launching tmodloaderserver.exe?I have a problem setting up my server. My worlds folder is C:\Users\windows7\Documents\My Games\Terraria\ModLoader\Worlds. but the server console serches the worlds in the C:\Users\windows7\Documents\My Games\Terraria\Worlds. How do I change the pathway that the connsole is looking for, because I don't want to copy the world file to the normal folder because than, terraria will look for the worlds still, in C:\Users\windows7\Documents\My Games\Terraria\Worlds and the updated world wont be there. :/
pls help ;-;
ok, well, that's fine, but that bat file references serverconfig.txt, so make sure you don't have a world path set in that file, or make your own config file.A tutorial on youtube told me to use start-tModLoaderServer :/
keep it in the install directory.Oh, Thank you!
[doublepost=1489350270,1489350208][/doublepost]wait, should I open the bat file in the terraria folder, or in another folder?