• For issues you find with the Switch and Console releases, please follow this link and give as much detail as possible. This is the speediest way to get info to Pipeworks and get a hotfix in the works.
  • For issues you find with the Mobile 1.3 update, please follow this link and give as much detail as possible. This is the speediest way to get info to DR Studios to look at your issue. Also, some troubleshooting hints here.

tAPI [Discontinued] tAPI - A Mod To Make Mods

Status
Not open for further replies.

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.
 

Shockah

Grandson of The Wizard
does not contain a constructor that takes 2 arguments
Remove the constructor altogether in all cases.

'TAPI.Defs' does not contain a definition for 'npcs'
Code:
NPCDef.byName
'Terraria.Player' does not contain a definition for 'noKnockback'
Code:
knockbackResist = 0f; //1f is the default, 0f is what Cobalt Shield etc. do
'TAPI.Defs' does not contain a definition for 'gores'
Code:
GoreDef.gores
 

Shockah

Grandson of The Wizard
Wow! That's awesome! BTW, does r11 support mods for older versions, for 1.2.2?
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:

zadum4ivii

Official Terrarian
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
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);
}
}
}
}
 

zadum4ivii

Official Terrarian
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.
Thank you so much ^-^[DOUBLEPOST=1413288392][/DOUBLEPOST]

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:

W1K

Eater of Worlds
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:
 

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);

}
}
}
 

Shockah

Grandson of The Wizard
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?
You still need a class declaration, so it's fine, as it contains the name.

How I could fix dat code?
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);
  }
  }
}
 
Status
Not open for further replies.
Top Bottom