I meant in the code of the item not in the NPC
You don't indicate in the Item class what NPC drops it, you indicate in the NPC class if they drop that item.
I meant in the code of the item not in the NPC
But if the NPC is from the game?You don't indicate in the Item class what NPC drops it, you indicate in the NPC class if they drop that item.
But if the NPC is from the game?
would you kindly not spam? theres an edit button, use itwhen you'r makeing a bow how do you make it so it shoots any arrow?
sorry for spaming and i found everything i wannted well I still dont know hot to make trowing weapons but still thankswould you kindly not spam? theres an edit button, use it
not sure how to trow in this game, its probably not supported. and bows can shoot arrows by making it useAmmo = 1;
public override void PostAI()
{
if(npc.ai[1] % 360 ==0)
{
NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("StealthBomber"));
}
if(npc.ai[1] % 360 ==0)
{
NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("Apache"));
}
if(npc.ai[1] % 360 ==0)
{
NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("Abrams"));
}
npc.ai[1] += 1f;
}
Can someone please explain this to me. I have the mac GoG version, no hate please just prefer it over steam. I don't have the steam folder in my application support folder. Can anyone help me to install tmodloader into my game or can it not be done? Thanks in advance.
Yeah, I know that multiplayer can be an order of magnitude more difficult than singleplayer. I had a of a time with one of my items and multiplayer. I can't give you any specific help because my problem was completely different, but I can give you some general advice. You can use Main.NewText(/*stuff*/); to see what's happening on a client and Console.WriteLine(/*stuff*/); to see the same thing in the console window of your server.I've met with a horrible bug (maybe for me it's horrible) with my throwing knife's durability system in multiplayer... I dunno whether it is a exclusive bug for the multiplayer or whether it is fixable for now.
First I'd give a brief description of my throwing knife's durability system.
Every throwing knife is supposed to have 3 "items/parts":
Code:public class IchorKnife : ModItem { public int durability = 1000; public override void SetDefaults() { item.name = "Ichor Knife"; item.toolTip = "Decreases target's defense"; item.autoReuse = true; item.useStyle = 1; item.shootSpeed = 12f; item.damage = 29; item.width = 18; item.height = 20; item.useSound = 39; item.useAnimation = 16; item.useTime = 16; item.noUseGraphic = true; item.noMelee = true; item.value = Item.sellPrice(0, 20, 0, 0); item.knockBack = 2.75f; item.melee = true; item.rare = 8; item.shoot = mod.ProjectileType("IchorKnifeProjectile"); } public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { Main.spriteBatch.DrawString(Main.fontItemStack, durability.ToString(), new Vector2(position.X - 8f, position.Y + 11f), Color.White, 0f, default(Vector2), scale, SpriteEffects.None, 0f); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { durability--; return true; } public override bool CanUseItem(Player player) { return durability > 0; } public override void SaveCustomData(BinaryWriter writer) { writer.Write(durability); } public override void LoadCustomData(BinaryReader reader) { durability = reader.ReadInt32(); }
Code:public class IchorKnifeProjectile : ModProjectile { public override void SetDefaults() { projectile.name = "Ichor Knife"; projectile.alpha = 0; projectile.scale = 1f; projectile.width = 14; projectile.height = 28; projectile.aiStyle = 2; projectile.friendly = true; projectile.penetrate = 3; projectile.melee = true; //projectile.light = 0.2f; projectile.ignoreWater = true; //aiType = 48; } public override bool PreAI() { Lighting.AddLight((int)((projectile.position.X + (float)(projectile.width / 2)) / 16f), (int)((projectile.position.Y + (float)(projectile.height / 2)) / 16f), 1f, 1f, 0f); int d = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 169, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(2) == 0) { Main.dust[d].noGravity = true; Main.dust[d].scale *= 1.5f; } projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; projectile.ai[0] += 1f; if (projectile.ai[0] >= 35f) { projectile.velocity.Y = projectile.velocity.Y + 0.4f; projectile.velocity.X = projectile.velocity.X * 0.97f; } if (projectile.velocity.Y > 16f) { projectile.velocity.Y = 16f; } return false; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(69, 600, false); } public override bool OnTileCollide(Vector2 oldVelocity) { Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1); return true; }
Code:public class IchorKnifeOnPickup : ModItem { public override void SetDefaults() { item.name = "Ichor Knife"; item.consumable = true; item.maxStack = 1000; item.width = 18; item.height = 20; item.rare = 8; } public override bool OnPickup(Player player) { for (int i = 0; i < 51; i++) { Item item2 = player.inventory[i]; if (item2.stack > 0 && item2.type > 0 && item2.type == mod.ItemType("IchorKnife")) { if (((IchorKnife)item2.modItem).durability <= 999) { Main.PlaySound(7, (int)player.position.X, (int)player.position.Y, 0); ItemText.NewText(item, item.stack, false, false); ((IchorKnife)item2.modItem).durability += item.stack; break; } } if (i == 50) { int a = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, mod.ItemType("IchorKnifeOnPickup"), item.stack, false, 0, false, false); Main.item[a].noGrabDelay = 60; } } return false; }
However, this made-look-like-cannot-pickup function went dead when it comes to multiplayer. The player will pick up the "IchorKnifeOnPickup" regardless of their having the apt throwing knife facts. If a player possesses the throwing knife, yeah, the durability will get increased damn nice. But every player without the knife will swallow the "IchorKnifeOnPickup" as if they love to eat it...
- Every throwing knife will be crafted with a maximum durability 1000.
- The durability will be reduced upon using. (conduct by shoot hook)
- The throwing knife will act like the vanilla throwing weapons. It has its 50% chance to drop the ammo when killed.
- In this case, it won't drop the weapon itself, which is "IchorKnife". It will drop the exclusive item "IchorKnifeOnPickup" instead.
- When the "IchorKnifeOnPickup" was picked up by a player,
- if the player has the apt throwing knife and the durability was not full, he will pick it up, and increase the durability of the particular throwing knife, but the item won't appear in his inventory (the OnPickup hook returns false);
- if the player does not has the throwing knife, he will also pick it up, but meanwhile a new and totally identical item will be created on his face, which makes it look like that he cannot pick up the item (I swear, this is the best case I can think out after several days' rocking my head).
This is the first time that I ever found that something worked like a charm in single player will end up screwing up in the multiplayer. This is frustrating and I have totally totally no idea about what's going on, and I need help!!!
EDIT: @jopojelly I duuno whether you're online but your profit pic is green. If you see this, well, please give a quick look. Thx
Main.NewText("onPickup, Durability: " + ((IchorKnife)item2.modItem).durability);
Console.WriteLine("onPickup, Durability: " + ((IchorKnife)item2.modItem).durability);
Yeah, 0.8I heard somewhere there is a tmodloader update for mac regarding sounds and music
Missing mod: ThatMod/Items/Weapons/ExampleHammer
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.SetupContent()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
make sure you wrote the sprite name right in the code and if its in the right folderHow to fix this?:
Code:Missing mod: ThatMod/Items/Weapons/ExampleHammer at Terraria.ModLoader.ModLoader.GetTexture(String name) at Terraria.ModLoader.Mod.SetupContent() at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
(when building mod)