dinidini4000
Skeletron Prime
NPCtoBanner gets the banner number from the npc. You still need to NPC.killCount[bannernumber] to ger the kill counts.
how do i turn that into a score i can use
like where or how do i use that code u told me to use
NPCtoBanner gets the banner number from the npc. You still need to NPC.killCount[bannernumber] to ger the kill counts.
H'ok... The Solarius item wasn't working because item.useAnimation was 1. I don't know how small it can be, but vanilla uses 25 there. Also, in the projectile, you've got 'projectile.type = ProjectileID.Arkhalis;' which will make the item a cosmetic clone of Arkhalis. If you want to use your own sprite, you'll need 'aiType = ProjectileID.Arkhalis;' instead.Still no projectile shows up
projectile
Code:public class SolarisP : ModProjectile { public override void SetDefaults() { projectile.name = "Solarius"; projectile.width = 68; projectile.height = 64; projectile.friendly = true; projectile.penetrate = -1; projectile.aiStyle = 75; projectile.type = ProjectileID.Arkhalis; Main.projFrames[projectile.type] = 28; projectile.ownerHitCheck = true; projectile.melee = true; projectile.tileCollide = false; projectile.light = 2f; }
weapon
Code:public override void SetDefaults() { item.name = "Solarius"; item.damage = 200; item.melee = true; item.width = 48; item.height = 48; item.useTime = 15; item.useAnimation = 1; item.useStyle = 5; item.noMelee = true; item.knockBack = 4f; item.noUseGraphic = true; item.channel = true; item.value = 100000; item.rare = 9; item.useSound = 1; item.autoReuse = false; item.shoot = mod.ProjectileType("SolarisP"); item.shootSpeed = 15f; }
where's the fail at?
I'm thinking in the weapon, but... I have no idea
also, remember all my questions about homing and boomerangs? well, now I want a homing boomerang... It's half working. I want it to work like the possessed hatchet, but It doesn't. It tries to home on things through blocks, and homes on on thing and keeps returning till it's dead then goes to another. I want it to only hit 1 thing once then return to the player. also, if I try to shoot it left, for example, and there is a target on the right, it will go right with out going left at all. I want it to curve, not go abruptly.
the code
Code:public NPC FindNearest(Vector2 pos) { NPC nearest = null; float oldDist = 1001; float newDist = 1000; for (int i = 0; i < Terraria.Main.npc.Length - 1; i++) { if (!Collision.CanHit(pos, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height)) continue; if (!Terraria.Main.npc[i].CanBeChasedBy(projectile)) continue; if (nearest == null) nearest = Terraria.Main.npc[i]; else { oldDist = Vector2.Distance(pos, nearest.position); newDist = Vector2.Distance(pos, Terraria.Main.npc[i].position); if (newDist < oldDist) nearest = Terraria.Main.npc[i]; } } return nearest; } int maxSpeed = 16; public override void AI() { NPC nearest = this.FindNearest(projectile.Center); Vector2 acceleration; if (nearest != null) // extremely important { acceleration = (nearest.position - projectile.position); } else { acceleration = Vector2.Zero; // maintain speed -- or whatever else you want to do here } projectile.velocity += acceleration * 1.5f; projectile.velocity *= 0.95f; if (projectile.velocity.Length() > maxSpeed) { projectile.velocity.Normalize(); projectile.velocity *= maxSpeed; } } public override void PostAI() { if (projectile.ai[0] == 1) { Player myOwner = Main.player[projectile.owner]; //find the owner of this projectile Vector2 toMe = Vector2.Normalize(myOwner.Center - projectile.Center); //find the distance from this projectile to it's owner and convert to a unit vector. projectile.velocity += toMe * 1f; //add the above vector to this projectile's velocity -- change 1f to change the return speed } }
also, can anyone help me with the boss ai?
pls help me
There is a workaround available. It is described in the related git issue, here: https://github.com/bluemagic123/tModLoader/issues/28I've found a lot more sounds that are bugged.
Seriously, is there no way to fix this?
- All desert creature noises
- Mana/heart crystal use sounds
- Bomb explosions
- Any zombie cries
- Basically a lot of NPC sounds
They have to be whole numbers. It doesn't make sense to have a fraction of a frame. As for using UpdateInventory to do it, it runs every tick, so eventually it gets to 0 pretty quick. I'm actually not sure the best approach, but maybe in the canuse hook to modify the useTimes. You still need to figure out how to change it temporarily.Just a little question, but is it possible to increase the usetime/useanimation of items and weapons through Global Item with formulas? I had tried
public override void UpdateInventory(Item item, Player player) with a requirement of a ModPlayer bool and the formula item.useAnimation = (int)(item.useAnimation * .15); but the results weren't in my favor... Setting the useTime and useAnimation to whole numbers worked fine, but unfortunately, that's not my intention.
Any help would be much appreciated!
if (Main.time % #ofticksperday = 0)
{ do stuff }
Probably ModWorld.PostUpdate is best for this type of thing.Hello, I have a small modding question. I'm trying to make a script that will activate an event once per day. Something like this:
Code:if (Main.time % #ofticksperday = 0) { do stuff }
but I'm not sure where I need to put this snippet to have it run continuously, like I want. Where does this need to go?
Probably ModWorld.PostUpdate is best for this type of thing.
Hi you peepz, can you at least tell me the code for a new drill or pick please. I cannot code with json files![]()
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace NameofYourMod.Items
{
public class NameOfYourPickaxeOrDrill : ModItem
{
public override void SetDefaults()
{
item.CloneDefaults(ItemID.SomeVanillaPickOrDrill);
item.name = "My Pickaxe";
item.damage = 10;
item.useTime = 5;
item.useAnimation = 5;
item.pick = 100;
item.knockBack = 6;
item.value = 10000;
item.rare = 2;
}
}
}
Because several network messages have changed to facilitate mods, and we don't want people joining vanilla servers and wrecking havoc. Just run the vanilla exe. The installer should have saved a copy for youWhy can I not get on public servers when this is installed?
This is the vanilla approach. I'm checking for null, so it doesn't matter. This same pattern is used for projectiles and NPC operations. I see no reason for the code to fail.Thanks, I'll try that. Follow up: in a previous reply, you talked about looping through chests at world gen and adding items. (Basically, I'm trying to do this once per day for certain chests). http://forums.terraria.org/index.php?threads/1-3-tmodloader-a-modding-api.23726/page-372#post-921068 Some of the replies expressed concern at using a fixed number for the upper bound of chestindex. Do you know what the actual ramifications are for attempting to access more chests than exist in the world are? And is there a better way to find the number of chests in the world? Thanks again for your help.
This is the vanilla approach. I'm checking for null, so it doesn't matter. This same pattern is used for projectiles and NPC operations. I see no reason for the code to fail.