tAPI [Discontinued] tAPI - A Mod To Make Mods

Status
Not open for further replies.
Excuse me, could someone tell me if you can change the position of an object when you're using? For example: vanilla weapons in the game, when the player uses the mini-Shark has his hand on the "trigger" but when I use my weapon, the player uses from the lower part to the left and looks weird.

Sorry for my bad english. :)
 
I have tAPI with Necro, Thorium mods. When i launched it it said a error. All i seen is something about framework. When i launched next time no error is appearing. I have seen in task manager that WerFault.exe launches and closes tAPI. LIST WHAT DID I DO: Reinstalled tAPI. Deleted players, mods, worlds. I even reinstalled Terraria! Still the same. HELP!
 
Excuse me, could someone tell me if you can change the position of an object when you're using? For example: vanilla weapons in the game, when the player uses the mini-Shark has his hand on the "trigger" but when I use my weapon, the player uses from the lower part to the left and looks weird.

Sorry for my bad english. :)
In case you haven't found out yet you could add this in the json.
Code:
    "holdoutOffset": [-1, 0],
You can change the numbers to your liking too.
 
I have tAPI with Necro, Thorium mods. When i launched it it said a error. All i seen is something about framework. When i launched next time no error is appearing. I have seen in task manager that WerFault.exe launches and closes tAPI. LIST WHAT DID I DO: Reinstalled tAPI. Deleted players, mods, worlds. I even reinstalled Terraria! Still the same. HELP!
I also get no message that game crashed on startup.
 
For anyone interested, here's some info on Minions in tAPI r15...

From looking at the code it looks like the cause might be in the Projectile.cs file, in the Damage() function
Code:
public void Damage() {
    
    if (Main.projPet[this.type] && !VanillaMinion) { // Vanilla Minion Summarizes a lot of '&& this.type != VanillaMinionProjectileType
        return;
    }

}
In ModJsonHandler.cs when tAPI reads a projectiles JSON file,
Main.projPet[projectile.type] = (flag || projectile.minion);

So all Minions are considered pets, and no pets can do damage.

It looks like that 'if' statement I commented above is just missing an additional - && !this.minion - check.

Seems simple, I'm sure they'll have it fixed for the next version.

In the mean time here's a work-around (May or may not work for Multi-Player) -

In the MBase.cs file in PreGameUpdate() (May work in OnLoad() as well, haven't tested) use
Code:
Main.projPet[ProjDef.byName["InternalModName:ProjectileName"].type] = false; // Makes it not be a pet, so it can do damage

Then in the CS file for the item that spawns the minion use
Code:
public override void PreItemCheck(Player player) {    
    Main.projPet[ProjDef.byName["InternalModName:ProjectileName"].type] = true; // Sets projPet to true in order to summon it
}

// And

public override void PostItemCheck(Player player) {
    Main.projPet[ProjDef.byName["InternalModName:ProjectileName"].type] = false; // Returns projPet to false in order for it to cause damage
}

I've tested this with two different mods and was able to get their minions to do damage again.
 
For anyone interested, here's some info on Minions in tAPI r15...

From looking at the code it looks like the cause might be in the Projectile.cs file, in the Damage() function
Code:
public void Damage() {
  
    if (Main.projPet[this.type] && !VanillaMinion) { // Vanilla Minion Summarizes a lot of '&& this.type != VanillaMinionProjectileType
        return;
    }

}
In ModJsonHandler.cs when tAPI reads a projectiles JSON file,
Main.projPet[projectile.type] = (flag || projectile.minion);

So all Minions are considered pets, and no pets can do damage.

It looks like that 'if' statement I commented above is just missing an additional - && !this.minion - check.

Seems simple, I'm sure they'll have it fixed for the next version.

In the mean time here's a work-around (May or may not work for Multi-Player) -

In the MBase.cs file in PreGameUpdate() (May work in OnLoad() as well, haven't tested) use
Code:
Main.projPet[ProjDef.byName["InternalModName:ProjectileName"].type] = false; // Makes it not be a pet, so it can do damage

Then in the CS file for the item that spawns the minion use
Code:
public override void PreItemCheck(Player player) {  
    Main.projPet[ProjDef.byName["InternalModName:ProjectileName"].type] = true; // Sets projPet to true in order to summon it
}

// And

public override void PostItemCheck(Player player) {
    Main.projPet[ProjDef.byName["InternalModName:ProjectileName"].type] = false; // Returns projPet to false in order for it to cause damage
}

I've tested this with two different mods and was able to get their minions to do damage again.
No. the cause is that "projectile.friendly" gets deactivated. in my code it sets projectile.friendly to true only if it's attacking and to false if it's just following the player. that way it won't accidentally cut grass/pots/whatever
I have tAPI with Necro, Thorium mods. When i launched it it said a error. All i seen is something about framework. When i launched next time no error is appearing. I have seen in task manager that WerFault.exe launches and closes tAPI. LIST WHAT DID I DO: Reinstalled tAPI. Deleted players, mods, worlds. I even reinstalled Terraria! Still the same. HELP!
WerFault.exe? try scanning your PC with an antivirus
 
Last edited:
No. the cause is that "projectile.friendly" gets deactivated. in my code it sets projectile.friendly to true only if it's attacking and to false if it's just following the player. that way it won't accidentally cut grass/pots/whatever
Did you try my solution? I successfully resolved the issue in two different mods. Perhaps Main.projPet also effects projectile.friendly. Either way the work-around seems to work. And my logic seems valid. It's clear that no damage is caused by anything declared as a projPet, since the Damage() function returns immediately if projPet is true. And all minions have projPet set to true. So no damage actually occurs. As soon as minions have projPet set to false, they do damage again. Further, it seems validated by the fact that the 'if' statement that returns if projPet is true, checks for the special case where the projectile is a vanilla minion. Which is why Vanilla minions still work, but not modded ones.
 
For anyone interested, here's some info on Minions in tAPI r15...

From looking at the code it looks like the cause might be in the Projectile.cs file, in the Damage() function
Code:
public void Damage() {
 
    if (Main.projPet[this.type] && !VanillaMinion) { // Vanilla Minion Summarizes a lot of '&& this.type != VanillaMinionProjectileType
        return;
    }

}
In ModJsonHandler.cs when tAPI reads a projectiles JSON file,
Main.projPet[projectile.type] = (flag || projectile.minion);

So all Minions are considered pets, and no pets can do damage.

It looks like that 'if' statement I commented above is just missing an additional - && !this.minion - check.

Seems simple, I'm sure they'll have it fixed for the next version.

In the mean time here's a work-around (May or may not work for Multi-Player) -

In the MBase.cs file in PreGameUpdate() (May work in OnLoad() as well, haven't tested) use
Code:
Main.projPet[ProjDef.byName["InternalModName:ProjectileName"].type] = false; // Makes it not be a pet, so it can do damage

Then in the CS file for the item that spawns the minion use
Code:
public override void PreItemCheck(Player player) { 
    Main.projPet[ProjDef.byName["InternalModName:ProjectileName"].type] = true; // Sets projPet to true in order to summon it
}

// And

public override void PostItemCheck(Player player) {
    Main.projPet[ProjDef.byName["InternalModName:ProjectileName"].type] = false; // Returns projPet to false in order for it to cause damage
}

I've tested this with two different mods and was able to get their minions to do damage again.
I need to try this; ever since r14a I've been just copying over the entire Damage() code (minus the part that stops it from working) to a general Minion class and recommending the same thing in my tutorial. What you have is so much easier :)
Although,they didn't fix it in between r14a and r15. And also unfortunately issues on the bug tracker haven't really been looked at recently :/

No. the cause is that "projectile.friendly" gets deactivated. in my code it sets projectile.friendly to true only if it's attacking and to false if it's just following the player. that way it won't accidentally cut grass/pots/whatever
That's not the problem; if you're using an aiStyle, then it knows when to set projectile.friendly to true or not.
 
Did you try my solution? I successfully resolved the issue in two different mods. Perhaps Main.projPet also effects projectile.friendly. Either way the work-around seems to work. And my logic seems valid. It's clear that no damage is caused by anything declared as a projPet, since the Damage() function returns immediately if projPet is true. And all minions have projPet set to true. So no damage actually occurs. As soon as minions have projPet set to false, they do damage again. Further, it seems validated by the fact that the 'if' statement that returns if projPet is true, checks for the special case where the projectile is a vanilla minion. Which is why Vanilla minions still work, but not modded ones.
I'm using r15 and my minion isn't broken AT ALL. it works perfectly fine and i didn't change any code since r14a.
 
I'm using r15 and my minion isn't broken AT ALL. it works perfectly fine and i didn't change any code since r14a.
Your minion does damage by firing a projectile, and that minion's projectile is causing damage. So your minion would not be affected by this bug. This particular bug prevents minions from causing damage when coming in contact with an enemy.
 
Is there anything I could do, so the server AUTO Saves all 30sec ?
I could rage because the server crashes and i do not save it all time while playing
 
Status
Not open for further replies.
Back
Top Bottom