1. Encountering issues with the Localization/Translations with 1.3.5? Please report them via the section linked below so that we can account for all of them and have them addressed. Thanks! Localization Bugs & Issues Section

tAPI [Discontinued] tAPI - A Mod To Make Mods

Discussion in 'Released' started by Yoraiz0r, Oct 14, 2014.

Thread Status:
Not open for further replies.
Thread was lock by: Tunnel King
Reason: discontinued prior to 1.3 release
Lock date: 20:26 04-08-2016
  1. Sapharan

    Sapharan Skeletron Prime

    Yay for r11 and whole team. (Not yay for lots of fixes to be made, lol)
     
    Shockah and Yoraiz0r like this.
  2. ppowersteef

    ppowersteef Paladin

    wait, Yoraiz0r has created tAPI? (i know not him alone, but still)
    i thought he was just a modder, dang.
     
  3. Gratuitous Lurking

    Gratuitous Lurking Terrarian

    Huzzah! Updates!
     
  4. TerrorPenguin

    TerrorPenguin Spazmatism

    doesn't matter, still cant figure out how to code a damn boomerang
     
  5. Sapharan

    Sapharan Skeletron Prime

    Dude, he is Terraria dev, tAPI dev AND modder.
     
  6. zadum4ivii

    zadum4ivii Official Terrarian

    F*ck it. What to do? Getting this errors when building my mod.

    Terraria 1.2.4.1, tAPI Builder r11

    ========================================
    Building mod TheZMod

    Validating Jsons...
    Compiling code...
    FPlayer.cs (58,14)
    'TAPI.ModPlayer' does not contain a constructor that takes 2 arguments
    public FPlayer(ModBase modBase, Player player) : base(modBase, player) { }
    ^
    MNPC.cs (47,13)
    'TAPI.ModNPC' does not contain a constructor that takes 2 arguments
    public MNPC(ModBase modBase, NPC n) : base(modBase, n){ }
    ^
    MWorld.cs (36,12)
    'TAPI.ModWorld' does not contain a constructor that takes 1 arguments
    public MWorld(ModBase modbase) : base(modbase)
    ^
    MechanicalPlate.cs (59,13)
    'TAPI.ModItem' does not contain a constructor that takes 2 arguments
    public MechanicalPlate(ModBase modBase, Item I) : base(modBase, I){ }
    ^
    MechanicalPlate.cs (85,29)
    'TAPI.Defs' does not contain a definition for 'npcs'
    int npcID = NPC.NewNPC((int)p.Center.X, (int)p.Center.Y - 500, Defs.npcs["Z2:Mechanical"].type, 0);
    ^
    MechanicalPlate.cs (85,37)
    'TAPI.Defs' does not contain a definition for 'npcs'
    int npcID = NPC.NewNPC((int)p.Center.X, (int)p.Center.Y - 500, Defs.npcs["Z2:Mechf"].type, 0);
    ^
    MechanicalPlate.cs (85,45)
    'TAPI.Defs' does not contain a definition for 'npcs'
    int npcID = NPC.NewNPC((int)p.Center.X, (int)p.Center.Y - 500, Defs.npcs["Z2:MechanicalBrain"].type, 0);
    ^
    DragonBoots.cs (49,13)
    'TAPI.ModItem' does not contain a constructor that takes 2 arguments
    public DragonBoots(ModBase modbase, Item I) : base(modbase, I) { }
    ^
    KingRing.cs (46,13)
    'TAPI.ModItem' does not contain a constructor that takes 2 arguments
    public KingRing(ModBase modbase, Item I) : base(modbase, I) { }
    ^
    MageCrystal.cs (49,13)
    'TAPI.ModItem' does not contain a constructor that takes 2 arguments
    public MageCrystal(ModBase modbase, Item I) : base(modbase, I) { }
    ^
    RangerCrystal.cs (51,13)
    'TAPI.ModItem' does not contain a constructor that takes 2 arguments
    public RangerCrystal(ModBase modbase, Item I) : base(modbase, I) { }
    ^
    SummonerCrystal.cs (53,13)
    'TAPI.ModItem' does not contain a constructor that takes 2 arguments
    public SummonerCrystal(ModBase modbase, Item I) : base(modbase, I) { }
    ^
    WarriorCrystal.cs (52,13)
    'TAPI.ModItem' does not contain a constructor that takes 2 arguments
    public WarriorCrystal(ModBase modbase, Item I) : base(modbase, I) { }
    ^
    ShredderCuirass.cs (53,14)
    'TAPI.ModItem' does not contain a constructor that takes 2 arguments
    public ShredderCuirass(ModBase modbase, Item I) : base(modbase, I) { }
    ^
    ShredderCuirass.cs (11,19)
    'Terraria.Player' does not contain a definition for 'noKnockback' and no extension method 'noKnockback' accepting a first argument of type 'Terraria.Player' could be found (are you missing a using directive or an assembly reference?)
    player.noKnockback = true;
    ^
    ClockShark.cs (54,13)
    'TAPI.ModItem' does not contain a constructor that takes 2 arguments
    public ClockShark(ModBase modBase, Item I) : base(modBase, I){ }
    ^
    Zadum4iviiWings.cs (53,13)
    'TAPI.ModItem' does not contain a constructor that takes 2 arguments
    public Zadum4iviiWings(ModBase modbase, Item I) : base(modbase, I) { }
    ^
    ForestOwl.cs (52,14)
    'TAPI.ModNPC' does not contain a constructor that takes 2 arguments
    public ForestOwl(ModBase modBase, NPC n) : base(modBase, n) { }
    ^
    ForestOwl.cs (63,33)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:SnowOwlGore1"], 1f);
    ^
    ForestOwl.cs (63,34)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:SnowOwlGore2"], 1f);
    ^
    JungleGiantFrog.cs (58,14)
    'TAPI.ModNPC' does not contain a constructor that takes 2 arguments
    public JungleGiantFrog(ModBase modBase, NPC n) : base(modBase, n) { }
    ^
    JungleGiantFrog.cs (63,33)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:Bullfrog1"], 1f);
    ^
    JungleGiantFrog.cs (63,34)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:Bullfrog2"], 1f);
    ^
    SnowOwl.cs (50,14)
    'TAPI.ModNPC' does not contain a constructor that takes 2 arguments
    public SnowOwl(ModBase modBase, NPC n) : base(modBase, n) { }
    ^
    SnowOwl.cs (63,33)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:SnowOwlGore1"], 1f);
    ^
    SnowOwl.cs (63,34)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:SnowOwlGore2"], 1f);
    ^
    Mechanical.cs (53,14)
    'TAPI.ModNPC' does not contain a constructor that takes 2 arguments
    public Mechanical(ModBase modBase, NPC n) : base(modBase, n) { }
    ^
    Mechanical.cs (63,25)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:Mech1"], 1f);
    ^
    Mechanical.cs (63,26)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:Mech2"], 1f);
    ^
    Mechanical.cs (63,27)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:Mech3"], 1f);
    ^
    DevilSword.cs (53,14)
    'TAPI.ModNPC' does not contain a constructor that takes 2 arguments
    public DevilSword(ModBase modBase, NPC n) : base(modBase, n) { }
    ^
    DevilSword.cs (63,33)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:Sharkoron1"], 1f);
    ^
    DevilSword.cs (63,34)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:Sharkoron2"], 1f);
    ^
    DevilSword.cs (63,35)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:Sharkoron3"], 1f);
    ^
    Sharkoron.cs (52,14)
    'TAPI.ModNPC' does not contain a constructor that takes 2 arguments
    public Sharkoron(ModBase modBase, NPC n) : base(modBase, n) { }
    ^
    Sharkoron.cs (63,33)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:Sharkoron1"], 1f);
    ^
    Sharkoron.cs (63,34)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:Sharkoron2"], 1f);
    ^
    Sharkoron.cs (63,35)
    'TAPI.Defs' does not contain a definition for 'gores'
    Gore.NewGore(npc.position, npc.velocity, Defs.gores["Z2:Sharkoron3"], 1f);
    ^
    Failed to build TheZMod.

    ========================================

    Built 0 mods.
     
  7. Shockah

    Shockah Grandson of The Wizard

    Remove the constructor altogether in all cases.

    Code:
    NPCDef.byName
    Code:
    knockbackResist = 0f; //1f is the default, 0f is what Cobalt Shield etc. do
    Code:
    GoreDef.gores
     
  8. Betailas

    Betailas Terrarian

    Wow! That's awesome! BTW, does r11 support mods for older versions, for 1.2.2?
     
  9. Shockah

    Shockah Grandson of The Wizard

    A lot of stuff changed, so most likely not without some tinkering. We took the opportunity to change some stuff, because r10 was still considered a WIP version, unlike r11.
     
    Last edited: Oct 14, 2014
  10. zadum4ivii

    zadum4ivii Official Terrarian

    The problem with Gore solved. But what constructor I must remove? Can you Bold it? Thanks.

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Diagnostics;
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;
    using Terraria;
    using TAPI;

    namespace Z2
    {
    public class Sharkoron : ModNPC
    {
    public Sharkoron(ModBase modBase, NPC n) : base(modBase, n) { }

    public override bool CanSpawn(int x, int y, int type, Player spawnedOn)
    {

    if (Main.dayTime && (spawnedOn.zone["Ocean"]) && Main.rand.Next(1) == 0) return true;
    if (!Main.dayTime && (spawnedOn.zone["Ocean"]) && Main.rand.Next(1) == 0) return true;
    return false;
    }

    public override void HitEffect(int hitDirection, double damage, bool isDead)
    {
    for (int m = 0; m < (isDead ? 20 : 5); m++)
    {
    int dustID = Dust.NewDust(npc.position, npc.width, npc.height, 5, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, Color.White, isDead && m % 2 == 0 ? 3f : 1f);
    if (isDead && m % 2 == 0) { Main.dust[dustID].noGravity = true; }
    }
    if (isDead)
    {
    Gore.NewGore(npc.position, npc.velocity, GoreDef.gores["Z2:Sharkoron1"], 1f);
    Gore.NewGore(npc.position, npc.velocity, GoreDef.gores["Z2:Sharkoron2"], 1f);
    Gore.NewGore(npc.position, npc.velocity, GoreDef.gores["Z2:Sharkoron3"], 1f);
    }
    }
    }
    }
     
  11. Betailas

    Betailas Terrarian

    a lot of thanks! waiting for new mods.
     
  12. Shockah

    Shockah Grandson of The Wizard

    All of them. Do you know what a constructor is? Basically, lines like:
    Code:
    public ClassName(args here) : base(args) { }
    We dropped using them, because they were tedious to write.
     
    Nopezal and Yoraiz0r like this.
  13. zadum4ivii

    zadum4ivii Official Terrarian

    Thank you so much ^-^
    --- Double Post Merged, Oct 14, 2014 ---


    Maybe I am annoying, but what is the problem now?

    using Terraria;
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Diagnostics;
    using TAPI;
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;

    namespace Z2
    {
    public class ShredderCuirass : ModItem
    {


    public override void Effects(Player player)
    {
    player.moveSpeed += 5f;
    knockbackResist = 0f;
    player.spikedBoots += 1;
    player.meleeDamage += 5f;
    player.maxMinions = 99;
    player.lifeRegen = 100;
    }
    }
    }

    Why I have this error:
    Terraria 1.2.4.1, tAPI Builder r11

    ========================================
    Building mod TheZMod

    Validating Jsons...
    Compiling code...
    ShredderCuirass.cs (4,19)
    The name 'knockbackResist' does not exist in the current context
    knockbackResist = 0f;
    ^
    Failed to build TheZMod.

    ========================================

    Built 0 mods.
     
    Last edited: Oct 14, 2014
    Yoraiz0r and Shockah like this.
  14. Shockah

    Shockah Grandson of The Wizard

    knockbackResist -> player.knockbackResist
     
  15. zadum4ivii

    zadum4ivii Official Terrarian

    Yaaay, now everything is working! Thank you again! :happy:
     
  16. W1K

    W1K Witch

    So wait, now that we don't need constructors anymore, we just need to include the methods? Kinda like old tConfig?
     
    Yoraiz0r and Arkhayla like this.
  17. Shockah

    Shockah Grandson of The Wizard

    You still need the using statements, and namespace and class declarations. Other than that - yep.
     
    Nopezal likes this.
  18. W1K

    W1K Witch

    Yeah I just realized what you meant. Tho I've been wondering, now that we don't have a constructor, how do we refer to the object if we don't declare the name of the var anymore. Is there a sort of default name in the background?

    Also I just realized, look at the modding community and the peoples titles. Yorai is the Wizard. Shockah is the Grandson of the Wizard. I'm the Witch.
    WHAT THE :red:
     
  19. zadum4ivii

    zadum4ivii Official Terrarian

    How I could fix dat code?

    using System;
    using System.Diagnostics;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.Xna.Framework;

    using TAPI;
    using Terraria;

    namespace Z2
    {

    {
    if (!mediumcoreRespawn)
    {
    player.statLifeMax = 100;
    player.statManaMax = 0;
    }

    int slot = 3;
    player.inventory[slot].SetDefaults("Z2:Crystal");
    player.inventory[slot++].Prefix(-1);

    }
    }
    }
     
  20. Shockah

    Shockah Grandson of The Wizard

    You still need a class declaration, so it's fine, as it contains the name.

    Code:
    using System;
    using System.Diagnostics;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.Xna.Framework;
    using TAPI;
    using Terraria;
    namespace Z2
    {
      public class MPlayer : ModPlayer
      {
      public virtual void OnInventoryReset(bool mediumcoreRespawn)
      {
      if (!mediumcoreRespawn)
      {
      player.statLifeMax = 100;
      player.statManaMax = 0;
      }
      int slot = 3;
      player.inventory[slot].SetDefaults("Z2:Crystal");
      player.inventory[slot++].Prefix(-1);
      }
      }
    }
     
    Bullseye55 and Yoraiz0r like this.
Thread Status:
Not open for further replies.