tAPI [Discontinued] tAPI - A Mod To Make Mods

Status
Not open for further replies.
Do you know any hook that triggers only if you hit npc with projectile ?
public override void DealtNPC(NPC npc, Projectile projectile, int hitDir, int dmgDealt, float knockback, bool crit)
This thing doesn't work at all.
Are you trying to place this hook in a ModNPC class, a ModProjectile class, or a ModPlayer class? That hook you have there is only for a ModPlayer class.

If it's for a ModNPC class, then the correct hook is:
public override void DealtNPC(Projectile projectile, int hitDir, int dmgDealt, float knocback, bool crit)

If it's for a ModProjectile class, then the correct hook is:
public override void DealtNPC(NPC npc, int hitDir, int dmgDealt, float knockback, bool crit)
 
Are you trying to place this hook in a ModNPC class, a ModProjectile class, or a ModPlayer class? That hook you have there is only for a ModPlayer class.

If it's for a ModNPC class, then the correct hook is:
public override void DealtNPC(Projectile projectile, int hitDir, int dmgDealt, float knocback, bool crit)

If it's for a ModProjectile class, then the correct hook is:
public override void DealtNPC(NPC npc, int hitDir, int dmgDealt, float knockback, bool crit)
What if i have a buff, that checks if i hit enemy with projectile then doubles the damage and disapears, meele hit hook works fine, any hit hook too(but it lacks of usefull variables)
 
What if i have a buff, that checks if i hit enemy with projectile then doubles the damage and disapears, meele hit hook works fine, any hit hook too(but it lacks of usefull variables)
So you're actually trying to modify the damage that the projectile does? If you're using a ModBuff class, then you'll want to use this hook instead:
public override void DamageNPC(Projectile projectile, NPC npc, int hitDir, ref int damage, ref float knockback, ref bool crit, ref float critMult)

The "ref" in front of damage means that you'll be able to modify the damage just by setting it equal to something. To double the damage then make the projectile disappear, you would do something like this:
Code:
public override void DamageNPC(Projectile projectile, NPC npc, int hitDir, ref int damage, ref float knockback, ref bool crit, ref float critMult)
{
    damage *= 2;
    projectile.Kill();
}
 
I DO have one question, though. IS there a work around, in the meantime, for creating a new world? I can't. I realize this is a bug,but I'm hoping that there is a way around this- at least. HOPEFULLY I can get this question answered quickly. I've tried, hard, to find the answer to this.
I'm trying to actually get my question answered, and not buried. Thanks!!!
 
I'm trying to actually get my question answered, and not buried. Thanks!!!
To create a new world in tAPI, the only thing I can think of is to move your tAPI worlds to another folder, create your world, then move your worlds back.

For importing a world from vanilla, I would download Shockah's Fancy Cheat Menu to replace the items that get lost. It's pretty tedious, but I can't think of anything else at the moment. :(
 
To create a new world in tAPI, the only thing I can think of is to move your tAPI worlds to another folder, create your world, then move your worlds back.

For importing a world from vanilla, I would download Shockah's Fancy Cheat Menu to replace the items that get lost. It's pretty tedious, but I can't think of anything else at the moment. :(

Thank you. :). I also see an inventory editor as well, and one more I saw to re-stack them. I'll be moving my worlds tonight, as I heard that you can have 3 only at once to create a world. I'll move them all if I have to. This was extremely helpful.
 
I'm trying to make a line of code in my ModPlayer file that makes a projectile appear where the player was when he died, and nothing has worked thus far. Can I get some help on this?

Have you got this figured out yet? There's a ModPlayer hook that sounds like the right thing in this situation: public override bool? PreKill(double damage, int hitDirection, bool pvp, string deathText). You should be able to spawn the projectile at the player's position with this - might not work with PostKill since the player is already dead and probably doesn't have a position.
 
Have you got this figured out yet? There's a ModPlayer hook that sounds like the right thing in this situation: public override bool? PreKill(double damage, int hitDirection, bool pvp, string deathText). You should be able to spawn the projectile at the player's position with this - might not work with PostKill since the player is already dead and probably doesn't have a position.
Already figured that out
 
So you're actually trying to modify the damage that the projectile does? If you're using a ModBuff class, then you'll want to use this hook instead:
public override void DamageNPC(Projectile projectile, NPC npc, int hitDir, ref int damage, ref float knockback, ref bool crit, ref float critMult)

The "ref" in front of damage means that you'll be able to modify the damage just by setting it equal to something. To double the damage then make the projectile disappear, you would do something like this:
Code:
public override void DamageNPC(Projectile projectile, NPC npc, int hitDir, ref int damage, ref float knockback, ref bool crit, ref float critMult)
{
    damage *= 2;
    projectile.Kill();
}
Thank you that works exacly as needed.
 
So...every time I try to join my friend, it says "tAPI has stopped responding." I have tested it without mods, and I can join him. I don't know what to do. I have GRealm, BaseMod, Shockah's Base and all his mods except the FCM, Thorium, and Omnir'sNosPak. Could anyone help me please?
 
So...every time I try to join my friend, it says "tAPI has stopped responding." I have tested it without mods, and I can join him. I don't know what to do. I have GRealm, BaseMod, Shockah's Base and all his mods except the FCM, Thorium, and Omnir'sNosPak. Could anyone help me please?

Someone correct me if I'm wrong, but I'm pretty sure you need to have exactly the same mods running.

Edit: I am wrong.
 
Last edited:
Someone correct me if I'm wrong, but I'm pretty sure you need to have exactly the same mods running.
When you connect to a server, it automatically downloads the same mods that the server has, and enables / disables the correct mods.

So...every time I try to join my friend, it says "tAPI has stopped responding." I have tested it without mods, and I can join him. I don't know what to do. I have GRealm, BaseMod, Shockah's Base and all his mods except the FCM, Thorium, and Omnir'sNosPak. Could anyone help me please?
If it's working fine without mods, try telling your friend to disable them one by one. That way you can narrow down which one(s) are causing problems.
 
To create a new world in tAPI, the only thing I can think of is to move your tAPI worlds to another folder, create your world, then move your worlds back.

For importing a world from vanilla, I would download Shockah's Fancy Cheat Menu to replace the items that get lost. It's pretty tedious, but I can't think of anything else at the moment. :(


Thank you. I was going to downgrade, but my husband came in and moved all my worlds over, and said, Jen, for the love of God, just create your five worlds, or I'll have to do this AGAIN. He was concerned out the downgrade would break my mods, so he wasn't going to do it. So, lol, I didn't create just one world, I did five, and added back only two of my important worlds. I could have added them all back, but, I figured, why? Any way, it worked, so I wanted to personally come over and thank the people who suggested moving them over. I'll try the cheat menu so I can bring in builders workshop for building materials.
 
So umm. Guys. Any bugs we're missing here? http://tapi.axxim.net/bugs/view_all_bug_page.php
Please report any problems you find on the bugtracker, not here. Makes it easy for us to track all the stuff we still have to do, considering how this thread already reached 208 pages, and maybe 5% is actual stuff to report. Also no duplicate issues, please.
 
Is it possible to load a world created in tAPI in TEdit? If so I can't figure it out, it says it's corrupt if I try. Doing so and importing the world seems to cause bugs for me, so I don't want to import.
 
Is it possible to load a world created in tAPI in TEdit? If so I can't figure it out, it says it's corrupt if I try. Doing so and importing the world seems to cause bugs for me, so I don't want to import.
Nope, tAPI uses a different format. The only thing you could do is make a world in vanilla Terraria, edit it in TEdit and then import it into tAPI.
 
Nope, tAPI uses a different format. The only thing you could do is make a world in vanilla Terraria, edit it in TEdit and then import it into tAPI.

Doing so seems to cause a bug for me where underworld monsters spawn in the underground cavern. Can't do that. Oh well, suppose I'll have to play without. The inventory sorting mod is worth more than TEdit.
 
Status
Not open for further replies.
Back
Top Bottom