Standalone [1.3] tModLoader - A Modding API

how whould i make it for AnyMechBoss?
SO that if DEstoryer,Twins Or Skeletron is killed the Ore Spawnes
can i just Replace if(npc.type == 4) with
if if (NPC.downedMechBossAny == true)
?
I believe you'd put the NPC IDs of all the mech bosses in. I haven't tested out multiple NPCs though so you may have to go through trial and error if my suggestion doesn't work
 
opps.. my mistake it's c:\Users\Dewfoam\Documents\My Games\Terraria\Modloader\ModSources\CroisMod\NPCs\ModGlobalNPC.cs(4,16) : error CS0234: The type or namespace name 'Modloader' does not exist in the namespace 'Terraria' (are you missing an assembly reference?)
That's it..

It's Terraria.ModLoader. Capital L.
 
Are custom backgrounds still impossible?
I was fishing through the games code and found this: public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
Can this method be used or, as I stated, are custom backgrounds imposssible?
 
Could someone please help me. I changed the boss in the code to one of my other ones that works and it summoned, but the one I want to summon won't work could someone please find the reason in this code:

SUMMON ITEM

using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace TerraMagna.Items
{
public class LightAbsorber : ModItem
{
public override void SetDefaults()
{
item.name = "Light Absorber";
item.width = 20;
item.height = 20;
item.maxStack = 50;
AddTooltip("May offend something");
item.value = 0;
item.rare = 9;
item.useAnimation = 30;
item.useTime = 30;
item.useStyle = 4;
item.consumable = false;
}
public override bool UseItem(Player player)
{
NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("ES"));
Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);

return true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "MagnaIngot", 15);
recipe.AddIngredient(null, "ShipCore", 2);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}

BOSS

using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace TerraMagna.NPCs.Boss
{
public class ES : ModNPC
{
public override void SetDefaults()
{
npc.name = "ES";
npc.displayName = "Elumite Sphere";
npc.aiStyle = 14;
npc.lifeMax = 60000;
npc.damage = 400;
npc.defense = 350;
npc.knockBackResist = 0f;
npc.width = 100;
npc.height = 100;
animationType = NPCID.DemonEye;
Main.npcFrameCount[npc.type] = 2;
npc.value = Item.buyPrice(1, 0, 75, 40);
npc.npcSlots = 1f;
npc.boss = true;
npc.lavaImmune = true;
npc.noGravity = true;
npc.noTileCollide = true;
npc.soundHit = 8;
npc.soundKilled = 14;
npc.buffImmune[24] = true;
music = MusicID.Plantera;
npc.netAlways = true;
}
public override void AutoloadHead(ref string headTexture, ref string bossHeadTexture)
{
bossHeadTexture = "TerraMagna/NPCs/Boss/ES_Head_Boss";
}
public override void BossLoot(ref string name, ref int potionType)
{
potionType = ItemID.GreaterHealingPotion;
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ElumiteIngot"), 60);
if (Main.rand.Next(10) == 0)
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.AnkhCharm, 1);
}
if (Main.rand.Next(3) == 0)
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.LavaCharm, 1);
}
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
{
npc.lifeMax = (int)(npc.lifeMax * 0.579f * bossLifeScale);
npc.damage = (int)(npc.damage * 0.6f);
}
public override void AI()
{
npc.ai[0]++;
npc.ai[5]++;
Player player = Main.player[npc.target];
if (!player.active || player.dead)
{
npc.velocity = new Vector2(0f, 10f);
if (npc.timeLeft > 10)
{
npc.timeLeft = 10;
}
return;
}

npc.ai[6]++;
if (npc.ai[6] >= 200)
{
float Speed = 25f;
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
int damage = 100;
int type = mod.ProjectileType("ESShot");
Main.PlaySound(23, (int)npc.position.Y, 17);
float rotation = (float)Math.Atan2(vector8.Y - (player.position.Y + (player.height * 0.5f)), vector8.X - (player.position.X + (player.width * 0.5f)));
int num54 = Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 0f, 0);
npc.ai[6] = 0;
}

npc.ai[7]++;
if (npc.ai[7] >= 40)
{
float Speed = 25f;
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
int damage = 60;
int type = mod.ProjectileType("ESShot");
Main.PlaySound(23, (int)npc.position.Y, 17);
float rotation = (float)Math.Atan2(vector8.Y - (player.position.Y + (player.height * 0.5f)), vector8.X - (player.position.X + (player.width * 0.5f)));
int num54 = Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 0f, 0);
npc.ai[7] = 0;
}
}
}
}
 
Are custom backgrounds still impossible?
I was fishing through the games code and found this: public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
Can this method be used or, as I stated, are custom backgrounds imposssible?
Still not implemented.

npc.ai[6]++;
There are only 4 ai values for NPC. You'll need to find a different way to do whatever this code is doing.
 
Still not implemented.


There are only 4 ai values for NPC. You'll need to find a different way to do whatever this code is doing.
Actually, I believe @Gorateron has gotten backgrounds
to work for our mod, and possibly @Eldrazi for the Gyrolite mod (along with a blue glow). Not certain if it's just title screen or not. :p
 
There are only 4 ai values for NPC. You'll need to find a different way to do whatever this code is doing.

Thank you! I would never have known that
 
Is there prefixes in this mod? I would really like to get the legendary prefix on my terrablade without going to the goblin tinkerer and hoping for the best .
 
Is there prefixes in this mod? I would really like to get the legendary prefix on my terrablade without going to the goblin tinkerer and hoping for the best .

tMod is not a mod directly. Its a tool to help in the creation of mods.

More directly answering; No.
 
PLEASE HELP ME.. i have error when i compile my mod..

HERE IS THE ERROR

c:\Users\Dewfoam\Documents\My Games\Terraria\ModLoader\Mod Sources\MOD\Items\Weapons\SepultchuresSword.cs(9,15) : error CS1514: { expected
 
open the cs thats named there, look at line 9 (as it states right there)
you are missing a { at line 9, it tells you right there
 
I can't see any mods in the mod browser, i know it's beta but everyone else seems to be able to. I'm using the latest version of terraria and the latest version of tModLoader (V0.8.0.0). Any idea how i can do something about it to fix it?
 
open the cs thats named there, look at line 9 (as it states right there)
you are missing a { at line 9, it tells you right there
Thanks for the reply!!
[doublepost=1463577996,1463577892][/doublepost]
open the cs thats named there, look at line 9 (as it states right there)
you are missing a { at line 9, it tells you right there
like this??


using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;

{ namespace The Well Mod.Items.Weapons //where is located
{
public class SepultchuresSword : ModItem
{
public override void SetDefaults()
{
item.name = "SepultchuresSword"; //Sword name
item.damage = 30; //Sword damage
item.melee = true; //if it's melee
item.width = 90; //Sword width
item.height = 90; //Sword height
item.toolTip = "SepultchuresSwor"; //Item Description
item.useTime = 25; //how fast
item.useAnimation = 25;
item.useStyle = 1; //Style is how this item is used, 1 is the style of the sword
item.knockBack = 5; //Sword knockback
item.value = 100;
item.rare = 10;
item.useSound = 1; //1 is the sound of the sword
item.autoReuse = true; //if it's capable of autoswing.
item.useTurn = true;
item.shoot = mod.ProjectileType("YourProjectileName");
item.shootSpeed = 8f; //projectile speed
}
public override void AddRecipes() //How to craft this sword
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1); //you need 1 DirtBlock
recipe.AddTile(TileID.WorkBenches); //at work bench
recipe.SetResult(this);
recipe.AddRecipe();

}
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
player.AddBuff(mod.BuffType("BuffName"), 400); //400 is the buff time
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(1) == 0)
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("DustName"));
}
}
}
}
[doublepost=1463578108][/doublepost]not working..
 
Thanks for the reply!!
[doublepost=1463577996,1463577892][/doublepost]
like this??


using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;

{ namespace The Well Mod.Items.Weapons //where is located
{
public class SepultchuresSword : ModItem
{
public override void SetDefaults()
{
item.name = "SepultchuresSword"; //Sword name
item.damage = 30; //Sword damage
item.melee = true; //if it's melee
item.width = 90; //Sword width
item.height = 90; //Sword height
item.toolTip = "SepultchuresSwor"; //Item Description
item.useTime = 25; //how fast
item.useAnimation = 25;
item.useStyle = 1; //Style is how this item is used, 1 is the style of the sword
item.knockBack = 5; //Sword knockback
item.value = 100;
item.rare = 10;
item.useSound = 1; //1 is the sound of the sword
item.autoReuse = true; //if it's capable of autoswing.
item.useTurn = true;
item.shoot = mod.ProjectileType("YourProjectileName");
item.shootSpeed = 8f; //projectile speed
}
public override void AddRecipes() //How to craft this sword
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1); //you need 1 DirtBlock
recipe.AddTile(TileID.WorkBenches); //at work bench
recipe.SetResult(this);
recipe.AddRecipe();

}
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
player.AddBuff(mod.BuffType("BuffName"), 400); //400 is the buff time
}
public override void MeleeEffects(Player player, Rectangle hitbox)
{
if (Main.rand.Next(1) == 0)
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("DustName"));
}
}
}
}

actually no, the { wasn't actually the problem it seems. this is why you post your code with your question lol, i gave the wrong answer

what is happening is actually that you have spaces in your namespace

{ namespace The Well Mod.Items.Weapons
is wrong

namespace TheWellMod.Items.Weapons
is right

you can't have spaces in the namespace like that. you will need to go through each of your CS files and correct this, im sure more errors will pop up the same

also go to INSERT and then select CODE when your posting, it looks much better than just straight posting it like that
 
I can't see any mods in the mod browser, i know it's beta but everyone else seems to be able to. I'm using the latest version of terraria and the latest version of tModLoader (V0.8.0.0). Any idea how i can do something about it to fix it?
Did u try reloading the page cause i tryed reloading it it the mod apeared through my eyes..
 
Did u try reloading the page cause i tryed reloading it it the mod apeared through my eyes..
I tried every combination of filters and reloaded the pages every time, still nothing.
 
actually no, the { wasn't actually the problem it seems. this is why you post your code with your question lol, i gave the wrong answer

what is happening is actually that you have spaces in your namespace

{ namespace The Well Mod.Items.Weapons
is wrong

namespace TheWellMod.Items.Weapons
is right

you can't have spaces in the namespace like that. you will need to go through each of your CS files and correct this, im sure more errors will pop up the same

also go to INSERT and then select CODE when your posting, it looks much better than just straight posting it like that
THANKS MAN!! AND I LIKE YOUR MOD TOO u have a mod link in it?? cause it has really cool sprites!
[doublepost=1463578680,1463578529][/doublepost]
I tried every combination of filters and reloaded the pages every time, still nothing.
that's a shame.. SORRY i don't have ideas..
 
THANKS MAN!! AND I LIKE YOUR MOD TOO u have a mod link in it?? cause it has really cool sprites!
nah its just sprites, my mod is one of those permanently WIP things. i may complete it sometime in the future, but i promised to first help a friend out with their's, once theirs is done i'll finish my own

I can't see any mods in the mod browser, i know it's beta but everyone else seems to be able to. I'm using the latest version of terraria and the latest version of tModLoader (V0.8.0.0). Any idea how i can do something about it to fix it?
u on a mac?
 
nah its just sprites, my mod is one of those permanently WIP things. i may complete it sometime in the future, but i promised to first help a friend out with their's, once theirs is done i'll finish my own
what is the name of ur mod the WIP thingyss..
[doublepost=1463578859,1463578795][/doublepost]and..

i have a question??
how to be like you??
i mean the word under your picture (Pixel Pirate)??
 
nah its just sprites, my mod is one of those permanently WIP things. i may complete it sometime in the future, but i promised to first help a friend out with their's, once theirs is done i'll finish my own


u on a mac?
I saw that post before, no i use windows 10.
[doublepost=1463579098,1463579019][/doublepost]
what is the name of ur mod the WIP thingyss..
[doublepost=1463578859,1463578795][/doublepost]and..

i have a question??
how to be like you??
i mean the word under your picture (Pixel Pirate)??
You need to link your account to steam and have the pixel piracy game on your account, then you can pick wether you want to be pixel pirate or terrarian.
 
Back
Top Bottom