hypa!【=◈︿◈=】
Empress of Light
I still don't like how tAPI is a completely different .exe....
Note that i do mean for it to shoot from below me.Code:using System; using System.Diagnostics; using Microsoft.Xna.Framework; using TAPI; using Terraria; namespace TUnleashed.Items { public class DeathFromTheDepths : ModItem { public override bool PreShoot(Player player, Vector2 ShootPos, Vector2 ShootVelocity, int projType, int Damage, float knockback) { int ShotAmt = 3; // Amount of shots fired int spread = 5; // Shot spread float spreadMult = 0.05f; // Spread multiplier for (int i = 0; i < ShotAmt; i++) { float vX = ShootVelocity.X + (float)Main.rand.Next(-spread, spread + 1) * spreadMult; float vY = ShootVelocity.Y + (float)Main.rand.Next(-spread, spread + 1) * spreadMult; Projectile.NewProjectile(ShootPos.X, ShootPos.Y + 768, vX, vY, "TUnleashed:DeathFromTheDepthsPro", Damage, knockback, Main.myPlayer); } return false; } } }
using System;
using Microsoft.Xna.Framework;
using TAPI;
using Terraria;
namespace TUnleashed.Items
{
public class MagicGod : ModNPC
{
public override void HitEffect(int hitDirection, double damage, bool isDead)
{
if (isDead)
{
Main.NewText("The Magic God has been defeated!");
//Gore.NewGore(npc.position, npc.velocity, Defs.gores["TemplateMod:ExampleMobNPCHead"], 1f);
//Gore.NewGore(npc.position, npc.velocity, Defs.gores["TemplateMod:ExampleMobNPCBody"], 1f);
//Gore.NewGore(npc.position, npc.velocity, Defs.gores["TemplateMod:ExampleMobNPCLeg"], 1f);
//Gore.NewGore(npc.position, npc.velocity, Defs.gores["TemplateMod:ExampleMobNPCLeg"], 1f);
}
}
int RandAI = 0 + Main.rand.Next(0, 10);
public override void AI()
{
this.npc.TargetClosest(true);
if (Main.player[this.npc.target].dead)
{
Main.NewText("The Magic God has sent another soul to the mines!");
NPC.NewNPC(new Vector2(Main.player[this.npc.target].position.X, Main.player[this.npc.target].position.Y), "TUnleashed:Corpse");
this.npc.active = false;
}
//if (this.RandAI == 0)
this.npc.directionY = 1;
}
}
}
On the preshoot issue...So anyone know whats wrong?
And i have another issue. I tried to make a custom AI for a boss but it doesn't work any idea why?
Code:
Code:using System; using Microsoft.Xna.Framework; using TAPI; using Terraria; namespace TUnleashed.Items { public class MagicGod : ModNPC { public override void HitEffect(int hitDirection, double damage, bool isDead) { if (isDead) { Main.NewText("The Magic God has been defeated!"); //Gore.NewGore(npc.position, npc.velocity, Defs.gores["TemplateMod:ExampleMobNPCHead"], 1f); //Gore.NewGore(npc.position, npc.velocity, Defs.gores["TemplateMod:ExampleMobNPCBody"], 1f); //Gore.NewGore(npc.position, npc.velocity, Defs.gores["TemplateMod:ExampleMobNPCLeg"], 1f); //Gore.NewGore(npc.position, npc.velocity, Defs.gores["TemplateMod:ExampleMobNPCLeg"], 1f); } } int RandAI = 0 + Main.rand.Next(0, 10); public override void AI() { this.npc.TargetClosest(true); if (Main.player[this.npc.target].dead) { Main.NewText("The Magic God has sent another soul to the mines!"); NPC.NewNPC(new Vector2(Main.player[this.npc.target].position.X, Main.player[this.npc.target].position.Y), "TUnleashed:Corpse"); this.npc.active = false; } //if (this.RandAI == 0) this.npc.directionY = 1; } } }
Do i need another file to make this work?
ShootPos.Y += 768; //why such a weird number anyways?
float speed = ShootVelocity.Length();
ShootVelocity = Vector2.Normalize(Main.mouseWorld - ShootPos) * speed;
if(ShootVelocity.HasNaNs()) ShootVelocity = -Vector2.UnitY * speed;
LOL im a derp thanks. And for the number i believe i choose that because its a multiple of 16(i like 16 )On the preshoot issue...
The hook initially provides you with the player's center as ShootPos in most cases, and ShootVelocity as the direction towards the mouse.
You might have changed the position but you did not change the velocity, so if your projectiles aimed towards your player's left they'd still do it but from below you.
(You can solve this by some code like...)
Code:ShootPos.Y += 768; //why such a weird number anyways? float speed = ShootVelocity.Length(); ShootVelocity = Vector2.Normalize(Main.mouseWorld - ShootPos) * speed; if(ShootVelocity.HasNaNs()) ShootVelocity = -Vector2.UnitY * speed;
As for the npc issue...
Your namespace for the ModNPC class is TUnleashed.Items rather than TUnleashed.NPCs , lol
In other news, tAPI r13 is now available under the 'latest' link, I'll update the thread shortly.
sadly no one helped my problem Q-Q
attach your .tapi file, i'll take a look at itsadly no one helped my problem Q-Q
sadly no one helped my problem Q-Q
Heres the tapi file.attach your .tapi file, i'll take a look at it
I made the ammo and followed a guide for it and the ammo has a sprite, a .json and a Proj.json.Unless your spoiler names aren't your .json names, you are trying to shoot ammo that doesn't exist. Make sure you are being consistent with names.
XD
i'd suggest a change of your internalName in your ModInfo.json to something like "ProjectSwift" and change the "shoot" lines in the Weapon and Bullet json accordingly, the part in front of ":" has to match the internalName ("shoot": "ProjectSwift:CorruptedBulletProj",)Heres the tapi file.
I made the ammo and followed a guide for it and the ammo has a sprite, a .json and a Proj.json.
XD
thank you!i'd suggest a change of your internalName in your ModInfo.json to something like "ProjectSwift" and change the "shoot" lines in the Weapon and Bullet json accordingly, the part in front of ":" has to match the internalName ("shoot": "ProjectSwift:CorruptedBulletProj",)
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Terraria.Player.SmartCursorLookup()
at Terraria.Player.UpdatePlayer(Int32 i)
at Terraria.Main.UpdateReal(GameTime gameTime)
Already fixed in our repo, but you'll have to wait until I come back home from work for the r13a release.Hi chaps. Sorry if this isn't being posted in the right place, but I get this error in tAPI v13:
Code:System.IndexOutOfRangeException: Index was outside the bounds of the array. at Terraria.Player.SmartCursorLookup() at Terraria.Player.UpdatePlayer(Int32 i) at Terraria.Main.UpdateReal(GameTime gameTime)
This is when I press 'ctrl' to toggle on Smart Cursor, with the Deathbringer Pickaxe equipped in slot 2 and selected, facing and touching a solid wall of blocks but otherwise stationary.
I am also running Shokah's mods, but the item in question is not affected by any extra prefix/suffixes other than the Godly prefix that the item was kind enough to generate with.
If you need any more info, please let me know.
[Edit] It's repeatable, as any attempt to restart with the affected .plr file prompts an immediate crash with the same stack trace.
Thank you, that's super fast response given you're doing this for free.Already fixed in our repo, but you'll have to wait until I come back home from work for the r13a release.
To change distance change shootspeedHow I can create a Light Disc like item? I created an item and projectile but... I can throw it even when he did not return my "hands". And how I can change the fly distance of my Disc?
{
"size": [32,32],
"aiStyle": 3,
"penetrate": -1,
"timeLeft": 600,
"friendly": true,
"tileCollide": true,
"melee": false,
"hide": false
}
{
"displayName": "Cobalt Disc",
"size": [32,32],
"maxStack": 1,
"value": [0, 1, 0, 0],
"rare": 7,
"tooltip": "",
"useStyle": 1,
"useAnimation": 15,
"useTime": 15,
"damage": 16,
"knockback": 12,
"useSound": 1,
"autoReuse": false,
"useTurn": false,
"melee": true,
"noUseGraphic": true,
"shoot": "Z2:Cobalt Disc",
"shootSpeed": 10
}
0_o can you try deleting your tAPI folder in Documents/My Games/Terraria (or rename it to something else so you can keep it) and then try to launch it?Hi,
Now that i have updated to r13a it no longer works(i dont mean a mod i mean tAPI) it starts up for half a second then closes without giving an error? Can anyone help me?