Standalone [1.3] tModLoader - A Modding API

Um, whatever happened to item.name? I can't find it anywhere in ExampleMod anymore. Is it still relevant? Because I still need access to naming items differently from the item file's name.
 
Is it possible to get projectiles to use more than 1 AI style?

I want my projectile to behave similarly to razorblade typhoon, but also bounce off surfaces and get faster as they travel
 
For the life of me i cannot get my boss to spawn custom entities and shoot projectiles. I also cant get said entities to shoot projectiles

Im aiming for the boss to constantly spawn entities every few seconds

Anyone able to teach me how to do this?
 
It's possible to get bosses to shoot projectiles and spawn enemies. Heres how:
Spawning enemies:

Code:
int timer = 60;//Initialise a timer for the boss to spawn NPCS. '60'
//means 60 frames, or one second.
if (timer <= 0 && Main.netMode != 1) //If my timer is 0 and not
//loading server(I think Netmode 1 is that anyways, sorry not
//good with Multiplayer friendly modding)
{
Vector2 spawnAt = npc.Center + new Vector2(0f, (float)npc.height / 2f); //Declare pawn position. This spawns NPC at the exact center of
//the boss sprite.
NPC.NewNPC((int)spawnAt.X, (int)spawnAt.Y, <Insert Npc Type/ID here>); //Spawn an NPC at spawnAt, or the center pos of boss.
timer = 60;//Reset the timer
} else timer--; //If not, minus the timer by 1 every frame,
//leading to an effective and working code that spawns one
//enemy every second.

Shooting projectiles(Extracted from the insanely old Tconfig Wiki.):
Code:
int timer2 = <Insert timer2's start value here>;
if (timer2 <= 0) //Please add another timer for projectile, if you don't want ur game to eventually explode
{
float Speed = 30f; //Speed of which projectile is fired. For all values that are 'floats', put an f after the value.
int damage = 36; //damage of the projectile
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2)); //Find the center position of the NPC
int type = <Insert projectile type or ID here>;
float KB = 0f; //Knockback. 0f means no knockback for projectile. I think theres a maximum knockback amount but idk
float rotation = (float) Math.Atan2(vector8.Y-(Main.player[npc.target].position.Y+(Main.player[npc.target].height *  0.5f)), vector8.X-(Main.player[npc.target].position.X+(Main.player[npc.target].width * 0.5f))); //You don't really need to know about this, just, it works.
Projectile.NewProjectile(vector8.X, vector8.Y,(float)((Math.Cos(rotation) * Speed)*-1),(float)((Math.Sin(rotation) *  Speed)*-1), type, damage, KB, 0); //Finally shoot a projectile
timer2 = <Insert timer2's start value here>; //Reset timer2
}
else timer2--;
These two ain't limited to timer based. I just added a timer to explain. You could, say, make the boss spawn an NPC or shoot a projectile when it hits 50% life too.
sorry if my explanation isn't clear. I need to buck up on explanation skills
 
hey can someone help me i keep getting a error code
Code:
c:\Users\Everybody\Documents\My Games\Terraria\ModLoader\Mod Sources\Test\Items\PickaxeName.cs(12,18) : error CS1061: 'Terraria.Item' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Everybody\Documents\My Games\Terraria\ModLoader\Mod Sources\Test\Items\PickaxeName.cs(17,18) : error CS1061: 'Terraria.Item' does not contain a definition for 'toolTip' and no extension method 'toolTip' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Everybody\Documents\My Games\Terraria\ModLoader\Mod Sources\Test\Items\PickaxeName.cs(25,18) : error CS1061: 'Terraria.Item' does not contain a definition for 'useSound' and no extension method 'useSound' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)
 
hey I've got a question when ever I click on terraria in steam it brings up the tmodloader version. is there a way to make it so that the original terraria opens instead of having to go into my files and going onto it from there thanks.
 
hey I've got a question when ever I click on terraria in steam it brings up the tmodloader version. is there a way to make it so that the original terraria opens instead of having to go into my files and going onto it from there thanks.
it should be in the terraria folder
 
hey I've got a question when ever I click on terraria in steam it brings up the tmodloader version. is there a way to make it so that the original terraria opens instead of having to go into my files and going onto it from there thanks.
i know its in there but is there a way to make it so that steam shortcuts to the normal terraria and not tmodloader
[doublepost=1501326888,1501326857][/doublepost]
it should be in the terraria folder
i know its in there but is there a way to make it so that steam shortcuts to the normal terraria and not tmodloader
 
i know its in there but is there a way to make it so that steam shortcuts to the normal terraria and not tmodloader
[doublepost=1501326888,1501326857][/doublepost]
i know its in there but is there a way to make it so that steam shortcuts to the normal terraria and not tmodloader
Locate Terraria's game directory and name tModLoaders .exe file (which will be called Terraria.exe) to something else (such as Terraria.tMod.exe) then rename the vanilla .exe file (which will be called something like TerrariaOriginalBackup.exe) back to Terraria.exe. You can create a shortcut to the tModLoader version so that you don't need to rename the files every time you want to swap versions.
 
When I load my mod terraria crashes (its in polish)
I hate my life.png
 
Um, whatever happened to item.name? I can't find it anywhere in ExampleMod anymore. Is it still relevant? Because I still need access to naming items differently from the item file's name.
Check in SetStaticDefaults() (ExampleBlock.cs)
[doublepost=1501328118,1501328078][/doublepost]
hey can someone help me i keep getting a error code
Code:
c:\Users\Everybody\Documents\My Games\Terraria\ModLoader\Mod Sources\Test\Items\PickaxeName.cs(12,18) : error CS1061: 'Terraria.Item' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Everybody\Documents\My Games\Terraria\ModLoader\Mod Sources\Test\Items\PickaxeName.cs(17,18) : error CS1061: 'Terraria.Item' does not contain a definition for 'toolTip' and no extension method 'toolTip' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Everybody\Documents\My Games\Terraria\ModLoader\Mod Sources\Test\Items\PickaxeName.cs(25,18) : error CS1061: 'Terraria.Item' does not contain a definition for 'useSound' and no extension method 'useSound' accepting a first argument of type 'Terraria.Item' could be found (are you missing a using directive or an assembly reference?)
Check the migration guide.
 
i dont know what to do? heres my code
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace YourModName.Items
{
    public class PickaxeName : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Wood Pickaxe-";
            item.damage = 2;
            item.melee = true;
            item.width = 32;
            item.height = 32;
            item.toolTip = "pickaxe-";
            item.useTime = 20;
            item.useAnimation = 20;
            item.pick = 40;    //pickaxe power
            item.useStyle = 1;
            item.knockBack = 6;
            item.value = 10;
            item.rare = 2;
            item.useSound = 1;
            item.autoReuse = true;
            item.useTurn = true;
        }
        public override void AddRecipes()  //How to craft this item
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Wood, 10);   //you need 10 Wood
            recipe.AddTile(TileID.WorkBenches);   //at work bench
            recipe.SetResult(this); 
            recipe.AddRecipe();
        }
    }
}
 
So, I've got another issue with the mod browser...
Every time I go to it after starting (or refresh it manually) I get the following message:

The game has crashed accessing Web Resources!

Sequence contains more than one matching element
at System.Linq.Enumerable.SingleOrDefault[Tsource](1Enumerable`1 source,Func`2 predicate)
at Terraria.ModLoader.UI.UIModBrowser.PopulateFromJSON(TmodFile[] installedMods, string json)

This is exact capitalization/punctuation just FYI.

From some searching I've gotten a few hints at what could be causing it (trying to access the same mod twice or a faulty custom type) but seeing as nobody else is having this problem I assume it's my end that's causing the issue.
Reinstalling does nothing, I've tried it 3x and each time it gives the same message. I've also tried deleting and redownloading all my mods manually, but it doesn't work then either.
Any help you can give is very much appreciated.
 
i dont know what to do? heres my code
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace YourModName.Items
{
    public class PickaxeName : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Wood Pickaxe-";
            item.damage = 2;
            item.melee = true;
            item.width = 32;
            item.height = 32;
            item.toolTip = "pickaxe-";
            item.useTime = 20;
            item.useAnimation = 20;
            item.pick = 40;    //pickaxe power
            item.useStyle = 1;
            item.knockBack = 6;
            item.value = 10;
            item.rare = 2;
            item.useSound = 1;
            item.autoReuse = true;
            item.useTurn = true;
        }
        public override void AddRecipes()  //How to craft this item
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Wood, 10);   //you need 10 Wood
            recipe.AddTile(TileID.WorkBenches);   //at work bench
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
use
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace YourModName.Items
{
    public class PickaxeName : ModItem
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Wood Pickaxe-");
            Tooltip.SetDefault("pickaxe-Line1"+ "\npickaxe-Line2");
        }
        public override void SetDefaults()
        {
            item.damage = 2;
            item.melee = true;
            item.width = 32;
            item.height = 32;
            item.useTime = 20;
            item.useAnimation = 20;
            item.pick = 40;    //pickaxe power
            item.useStyle = 1;
            item.knockBack = 6;
            item.value = 10;
            item.rare = 2;
            item.useSound = 1;
            item.autoReuse = true;
            item.useTurn = true;
        }
        public override void AddRecipes()  //How to craft this item
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.Wood, 10);   //you need 10 Wood
            recipe.AddTile(TileID.WorkBenches);   //at work bench
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

ps. I still have an un solved issue a page or 2 back if anyones in a helpful mood
 
How do you 'back up' the vanilla Terraria.exe?
Also i'm using Terraria version 1.3.4.4 and tModLoader version 0.9.2.1 and when I try to 'run' the installer it just goes into another folder.
 
Back
Top Bottom