I have a problem building my mod, It says the type or namespace name Example player could not be found, I don't know what that means, the error is inside the cs file for the buff for my oshawott pet mod, can you find the error in the file?
sing Terraria;
using Terraria.ModLoader;
namespace Oshawottmod.Buffs
{
public class ExamplePet : ModBuff
{
public override void SetDefaults()
{
Main.buffName[Type] = "Oshawott";
Main.buffTip[Type] = "\"Don't be sad little guy!\"";
Main.buffNoTimeDisplay[Type] = true;
Main.vanityPet[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
player.buffTime[buffIndex] = 18000;
player.GetModPlayer<ExamplePlayer>(mod).Oshawott = true;
bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("Oshawott")] <= 0;
if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
{
Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("Oshawott"), 0, 0f, player.whoAmI, 0f, 0f);
}
}
}
}
This a simple mod, it just adds a oshawott pet, it has 4 frames of animation, and copies Ai from the bunny pet, should I use other Ai for my pet?
--- Double Post Merged, Today at 8:57 PM, Original Post Date: Today at 8:54 PM --- forgot to mention, i used the Example mod's example pet as a template for this code, is their any problem with that too?
was wondering why i cant connec to my freinds worldwhen i have tmodloader installed and all mods are dissabled btw
NPCtoBanner gets the banner number from the npc. You still need to NPC.killCount[bannernumber] to ger the kill counts.i dont get this at all
so heres what i have
int BlueSlime = Item.NPCtoBanner(NPCID.BlueSlime);
int GreenSlime = Item.NPCtoBanner(NPCID.GreenSlime);
int PurpleSlime = Item.NPCtoBanner(NPCID.PurpleSlime);
int RedSlime = Item.NPCtoBanner(NPCID.RedSlime);
int YellowSlime = Item.NPCtoBanner(NPCID.YellowSlime);
int JungleSlime = Item.NPCtoBanner(NPCID.JungleSlime);
int Pinky = Item.NPCtoBanner(NPCID.Pinky);
this is what i have and it looks fine
but heres what it does
BlueSlime: 69
GreenSlime: 119
PurpleSlime: 155
RedSlime: 159
YellowSlime: 183
JungleSlime: 131
Pinky: 151
heres the real numbers of the world
BlueSlime: 1699
GreenSlime: 489
PurpleSlime: 141
RedSlime: 39
YellowSlime: 20
JungleSlime: 28
Pinky: 8
where does it get those top numbers from?
why does it not get the real banner numbers for the slimes not one was right only the purple was close
the wrong numbers seem to be fixed and does not change when killing more slimes
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.