Standalone [1.3] tModLoader - A Modding API

Read what I said above.
You still didn't got what I meant. I don't want to change the player max mana from mana stars,
but the temporary mana status that the player has that resets at player update.
In other words, I don't want to change statManaMax, I want to change statManaMax2.
For health the health change works independent of the value, for mana, It is capped at 400 max.
 
You still didn't got what I meant. I don't want to change the player max mana from mana stars,
but the temporary mana status that the player has that resets at player update.
In other words, I don't want to change statManaMax, I want to change statManaMax2.
For health the health change works independent of the value, for mana, It is capped at 400 max.
And you didn't read what I said above.
 
I read and checked, for life It did somewhat the same thing that the script of life max boost in my mod does,
but still, the mana is still capped at 400, while the health has unlimited value.
I just had a look through the player class, and found the following buried deep in the update function.
Code:
if (this.statManaMax2 > 400)
{
    this.statManaMax2 = 400;
}
Looks like I was right the first time.There may be a way to set the max mana above 400 and have it display, but it may be glitchy.

hey... i want a easy and fast way to change between mod and vannilla without deleting
[doublepost=1524320451,1524320335][/doublepost]like a "switch" from terraria on=mods and off=Vanila terraria.
but i dont want delete and reinstall every single day that i want play vanila and mods
A much easier way is to leave the Vanilla .exe alone and rename the tMod .exe to something else like Terraria.tMod.exe. Then create a second shortcut to the tMod one and you don't need to swap anything.
 
I have a problem with the german translation.
I can't see what key i choose, beacuse the reset button text is too big:
 

Attachments

  • lel.png
    lel.png
    221.4 KB · Views: 221
I just had a look through the player class, and found the following buried deep in the update function.
Code:
if (this.statManaMax2 > 400)
{
    this.statManaMax2 = 400;
}
Looks like I was right the first time.There may be a way to set the max mana above 400 and have it display, but it may be glitchy.
Those lines of codes could be deactivateable, beside I wonder how they still remain on tModLoader.
 
You need to make a batch file, or rather two batch files: one to switch to vanilla, the other to tmodloader.

ETA: I wrote two quick ones for myself, which I've attached. They assume that you've already backed up your vanilla Terreria (as Terraria.exe.BACKUP) and the tModloader version (as Terraria.exe.tMODLOADER), also that you;ve got Steam installed on your D: drive (so you'll need to change that if appropriate). To use just double click the version for which you want to run and it will copy the appropriate .exe and launch it.
ETA2: Okay, apparently you can't upload .bat files here. So, make 2 new text files, rename them to whatever you want, making sure to change the extensions to .bat, as follows:

Code:
copy "D:\Program Files (x86)\Steam\steamapps\common\Terraria\Terraria.exe.BACKUP" "D:\Program Files (x86)\Steam\steamapps\common\Terraria\Terraria.exe"
start /d  "D:\Program Files (x86)\Steam\steamapps\common\Terraria\" Terraria.exe

Code:
copy "D:\Program Files (x86)\Steam\steamapps\common\Terraria\Terraria.exe.tMODLOADER" "D:\Program Files (x86)\Steam\steamapps\common\Terraria\Terraria.exe"
start /d  "D:\Program Files (x86)\Steam\steamapps\common\Terraria\" "D:\Program Files (x86)\Steam\steamapps\common\Terraria\Terraria.exe"

As written, the code assumes default Windows 7 paths, so of course you'll need to adjust those if your install is somewhere else.
Use at your own risk, I make no guarantees.

[doublepost=1524337804][/doublepost]

Have you tried deleting and redownloading the Calamity mod? Have you tried running the game with the Calamity mod disabled?
wait... that terraria.exe.BACKUP is the terraria launcher or the terraria 1.3.5.3 launcher?
and i use C: that does interfer?
EDIT1: dont worked. sadly.
 
Last edited:
So i'm making a mod (trying) but i have some troubles at compile
Error CS1001: idenftifier expected. (it doen's tell me the line)

Here is my code... Somebody help me please D':

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using TerrariaWatch;

namespace TerrariaWatch.Items
{
public class SoldadoGun : ModItem //nombre del archivo con la imagen
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Rifle 76"); //nombre ingame
Tooltip.SetDefault("Arma perteneciente al mejor soldado, reclutado en el escuadron TerrariaWatch.");
}
public override void SetDefaults()
{
item.damage = 100;
item.ranged = true;
item.width = 60; //Tamaño de Ancho
item.height = 28; //Tamaño de Alto
item.useTime = 10; //mientras mas alto sea el useTime mas lenta será el arma. Usa un bajo UseTime para que el arma sea Rapida
item.useAnimation = 20;
item.useStyle = 5; //Dejar en 5 para que el personaje use el arma de forma normal
item.crit = 15;
item.noMelee = false;
item.knockBack = 2;
item.value = 100000; //Precio
item.rare = 4;
item.UseSound = SoundID.Item11;
item.autoReuse = true;
item.shoot = 10; //dejar en 10 para que dispare balas normales
item.shootSpeed = 10f;
item.useAmmo = AmmoID.Bullet; //se puede copiar para agregar mas proyectiles
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null."Symbol", 1);
recipe.AddIngredient(ItemID.Obsidian, 30);
recipe.AddIngredient(ItemID.GoldCoin, 80);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this, 1);
recipe.AddRecipe();
}
}
}

Thank youu!!!!
 
So i'm making a mod (trying) but i have some troubles at compile
Error CS1001: idenftifier expected. (it doen's tell me the line)

Here is my code... Somebody help me please D':

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using TerrariaWatch;

namespace TerrariaWatch.Items
{
public class SoldadoGun : ModItem //nombre del archivo con la imagen
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Rifle 76"); //nombre ingame
Tooltip.SetDefault("Arma perteneciente al mejor soldado, reclutado en el escuadron TerrariaWatch.");
}
public override void SetDefaults()
{
item.damage = 100;
item.ranged = true;
item.width = 60; //Tamaño de Ancho
item.height = 28; //Tamaño de Alto
item.useTime = 10; //mientras mas alto sea el useTime mas lenta será el arma. Usa un bajo UseTime para que el arma sea Rapida
item.useAnimation = 20;
item.useStyle = 5; //Dejar en 5 para que el personaje use el arma de forma normal
item.crit = 15;
item.noMelee = false;
item.knockBack = 2;
item.value = 100000; //Precio
item.rare = 4;
item.UseSound = SoundID.Item11;
item.autoReuse = true;
item.shoot = 10; //dejar en 10 para que dispare balas normales
item.shootSpeed = 10f;
item.useAmmo = AmmoID.Bullet; //se puede copiar para agregar mas proyectiles
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null."Symbol", 1);
recipe.AddIngredient(ItemID.Obsidian, 30);
recipe.AddIngredient(ItemID.GoldCoin, 80);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this, 1);
recipe.AddRecipe();
}
}
}

Thank youu!!!!
Edit: it tells me the error is in the line:
RecipeAddIngredient (null. "Symbol", 1);

I'm trying to add some Mod items to the recipe (symbol is an item). How can i make it right?
PS: the item already works ingame.
 
Last edited:
Edit: it tells me the error is in the line:
RecipeAddIngredient (null. "Symbol", 1);

I'm trying to add some Mod items to the recipe (symbol is an item). How can i make it right?
PS: the item already works ingame.
The period after "null" needs to be a comma.
btw, you can't have soldiers gun without bullet spread and the helix rockets
 
I used monodevelop to compile my mod since I am on linux, and whenever I try to build+reload or just build I get the error: make sure you have exactly one class extending mod. how can I fix this?
 
i'm actually surprised the ":red:ed level" i am lmao
thank you!!
What you mean with "bullet spread and the helix rockets"? the weapon it's just a rifle
If you are basing it off the soldier from overwatch (like the code implies), those are key features.

I used monodevelop to compile my mod since I am on linux, and whenever I try to build+reload or just build I get the error: make sure you have exactly one class extending mod. how can I fix this?

I've never heard of this, but it looks like an issue with the mod-defining file. Do you have more than one by mistake?
 
So I'm having a couple problems and I don't understand the problems. (First mod) I've been scrounging around the internet for an answer, but if I found an answer I was too illiterate to understand it. Can I get some help? Thanks!

c:\Users\SeaMoo\Documents\My Games\Terraria\ModLoader\Mod Sources\LivingGrowthMod\Items\LivingShadewoodWorkBench.cs(11,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\SeaMoo\Documents\My Games\Terraria\ModLoader\Mod Sources\LivingGrowthMod\Items\LivingShadewoodWorkBench.cs(15,13) : error CS0103: The name 'AddTooltip' does not exist in the current context

c:\Users\SeaMoo\Documents\My Games\Terraria\ModLoader\Mod Sources\LivingGrowthMod\Tiles\LivingShadewoodWorkBench.cs(19,13) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModTile.AddMapEntry(Microsoft.Xna.Framework.Color, Terraria.Localization.LocalizedText)' has some invalid arguments

c:\Users\SeaMoo\Documents\My Games\Terraria\ModLoader\Mod Sources\LivingGrowthMod\Tiles\LivingShadewoodWorkBench.cs(19,51) : error CS1503: Argument 2: cannot convert from 'string' to 'Terraria.Localization.LocalizedText'

using System;
using Terraria.ID;
using Terraria.ModLoader;

namespace LivingGrowthMod.Items
{
public class LivingShadewoodWorkBench : ModItem
{
public override void SetDefaults()
{
item.name = "Crafter";
item.width = 28;
item.height = 14;
item.maxStack = 1;
AddTooltip("A work bench made from living shadewood.");
item.useTurn = true;
item.autoReuse = true;
item.useAnimation = 15;
item.useTime = 10;
item.useStyle = 1;
item.consumable = true;
item.value = 150;
item.createTile = mod.TileType("LivingShadewoodWorkBench");
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Shadewood, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
 
Just a reminder to everyone posting here, this is a ghost town. All modders and people who can help you with modding or troubleshooting are in the discord chat: discord.me/tModLoader
 
what's the mod defining file? the .cs one?
It is the one that has:

class [modname] : mod
{
}

Others have "moditem", "modPlayer", "modglobalnpc", etc.

Oh, and literally all the code files should be .cs
[doublepost=1524695702,1524695556][/doublepost]
So I'm having a couple problems and I don't understand the problems. (First mod) I've been scrounging around the internet for an answer, but if I found an answer I was too illiterate to understand it. Can I get some help? Thanks!

c:\Users\SeaMoo\Documents\My Games\Terraria\ModLoader\Mod Sources\LivingGrowthMod\Items\LivingShadewoodWorkBench.cs(11,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\SeaMoo\Documents\My Games\Terraria\ModLoader\Mod Sources\LivingGrowthMod\Items\LivingShadewoodWorkBench.cs(15,13) : error CS0103: The name 'AddTooltip' does not exist in the current context

c:\Users\SeaMoo\Documents\My Games\Terraria\ModLoader\Mod Sources\LivingGrowthMod\Tiles\LivingShadewoodWorkBench.cs(19,13) : error CS1502: The best overloaded method match for 'Terraria.ModLoader.ModTile.AddMapEntry(Microsoft.Xna.Framework.Color, Terraria.Localization.LocalizedText)' has some invalid arguments

c:\Users\SeaMoo\Documents\My Games\Terraria\ModLoader\Mod Sources\LivingGrowthMod\Tiles\LivingShadewoodWorkBench.cs(19,51) : error CS1503: Argument 2: cannot convert from 'string' to 'Terraria.Localization.LocalizedText'

using System;
using Terraria.ID;
using Terraria.ModLoader;

namespace LivingGrowthMod.Items
{
public class LivingShadewoodWorkBench : ModItem
{
public override void SetDefaults()
{
item.name = "Crafter";
item.width = 28;
item.height = 14;
item.maxStack = 1;
AddTooltip("A work bench made from living shadewood.");
item.useTurn = true;
item.autoReuse = true;
item.useAnimation = 15;
item.useTime = 10;
item.useStyle = 1;
item.consumable = true;
item.value = 150;
item.createTile = mod.TileType("LivingShadewoodWorkBench");
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.Shadewood, 10);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}

the name and tooltip use a different line, and go under the method SetStaticDefaults
 
Back
Top Bottom