Standalone [1.3] tModLoader - A Modding API

good mod loader crashed my terraria twice because of OP damage like -99125812934
It not op but it was at 10000019 before lol
So, if I read this right, you were able to deal 10,000,019 damage without crashing, but when it reached 99,125,812,934 it did? If so, by any chance are you using a 32-bit computer (May not matter if the ints are converted to 32-bit even in a 64-bit environment later down the line, but couldn't find anything about that in the GitHub)?

If so, these numbers exceed the 32-bit limit, which is (2^32)-1, or, 4,294,967,295, try reducing them. If this isn't an issue, perhaps we can see the code for the item causing crashes?

Also, unrelated to the quote, but man I am hyped for Mac support! I can finally make mods without reverting to my Windows 10 bootcamp. My only question is, will mods be universal, or will we need preprocessor directives to ensure mod stability for a single file, or would we even need two different versions?
 
At the moment most mods in the front page of the WIP section of the forums are tModLoader mods. There probably won't be any flair for any modding api though until they're fully released.


Most image editors will have a zoom in feature.


You'll have to use a for loop in the AI method and call Dust.NewDust inside that loop. (The example mod has some examples of this.) To give it a color, there's a color parameter in both Dust.NewDust and ModDust.NewDust (whichever you're using).


The NPC class has a lavaImmune field or something like that.
Ok - I have searched through the Example Mod and I could not find anything. Could you give me an example of code that allows the previous picture to happen?
 
So, if I read this right, you were able to deal 10,000,019 damage without crashing, but when it reached 99,125,812,934 it did? If so, by any chance are you using a 32-bit computer (May not matter if the ints are converted to 32-bit even in a 64-bit environment later down the line, but couldn't find anything about that in the GitHub)?

If so, these numbers exceed the 32-bit limit, which is (2^32)-1, or, 4,294,967,295, try reducing them. If this isn't an issue, perhaps we can see the code for the item causing crashes?

Also, unrelated to the quote, but man I am hyped for Mac support! I can finally make mods without reverting to my Windows 10 bootcamp. My only question is, will mods be universal, or will we need preprocessor directives to ensure mod stability for a single file, or would we even need two different versions?
At the moment I have it so that tModLoader actually does work on Mac. The reason it's taking so long is that I'm running into many problems trying to get mods to be universal.

I have a 64 bit
It actually doesn't matter whether or not your computer is 32 bit or 64 bit. Terraria doesn't support any damage larger than 2 to the power of 31, because signed 32-bit integers are used.
 
another error it says
Missing texture epimod/Items/Armor/SandstormBreastplate_Body
at Terraria.ModLoader.ModLoader.GetTexture(String name)
at Terraria.ModLoader.Mod.AddEquipTexture(ModItem item, EquipType type, String texture, String armTexture, String femaleTexture)
at Terraria.ModLoader.Mod.AutoloadItem(Type type)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
but
upload_2015-9-13_20-51-18.png

Edit: Nvm fixed it
 
At the moment most mods in the front page of the WIP section of the forums are tModLoader mods. There probably won't be any flair for any modding api though until they're fully released.


Most image editors will have a zoom in feature.


You'll have to use a for loop in the AI method and call Dust.NewDust inside that loop. (The example mod has some examples of this.) To give it a color, there's a color parameter in both Dust.NewDust and ModDust.NewDust (whichever you're using).


The NPC class has a lavaImmune field or something like that.

Code:
public override void CustomBehavior(ref float ai)
        {
            for (int k = 0; k < 2; k++)
            {
                int dust = Dust.NewDust(npc.position - new Vector2(8f, 8f), npc.width + 16, npc.height + 16, mod, "DarkMatter", 0f, 0f, 0, Color.Red);
                Main.dust[dust].velocity += npc.velocity * 0.25f;
            }
        }
Here's the code I am using. I do not know how to override the old dust or put the current dust in a loop. (This is for the older post about the enemy's dust)
 
no even better how do I make armor immune to EVERYTHING without having to type in every single debuff?
[DOUBLEPOST=1442178165,1442178150][/DOUBLEPOST]is there a way?
[DOUBLEPOST=1442178624][/DOUBLEPOST]also is there a way to increase my max health I'm sorry I'm asking so many questions I'm just kinda looking at the example mod and basing my stuff off of it
[DOUBLEPOST=1442178784][/DOUBLEPOST]also how do I make my own textures?
 
no even better how do I make armor immune to EVERYTHING without having to type in every single debuff?
[DOUBLEPOST=1442178165,1442178150][/DOUBLEPOST]is there a way?
[DOUBLEPOST=1442178624][/DOUBLEPOST]also is there a way to increase my max health I'm sorry I'm asking so many questions I'm just kinda looking at the example mod and basing my stuff off of it
[DOUBLEPOST=1442178784][/DOUBLEPOST]also how do I make my own textures?
I don't even know if there is player support yet so you might not be able to do those things.
 
in the example mod there's armor that allows you to increase your max mana I'm going to take a guess that you can increase your max health also you can get buff immunity heeres the files
[DOUBLEPOST=1442179382,1442179328][/DOUBLEPOST]cant get a real zipped file using that forver
[DOUBLEPOST=1442179462][/DOUBLEPOST]right?
 

Attachments

  • Travel.zip
    2.4 KB · Views: 161
in the example mod there's armor that allows you to increase your max mana I'm going to take a guess that you can increase your max health also you can get buff immunity heeres the files
[DOUBLEPOST=1442179382,1442179328][/DOUBLEPOST]cant get a real zipped file using that forver
[DOUBLEPOST=1442179462][/DOUBLEPOST]right?
Here is the list of buffs. Do it manually, there is no buff that nullifies all the debuffs. It isn't hard to copy paste.
"statLifeMax2" is the counterpart to "statManaMax2"
Make textures in any graphics editing program. Save as a typical .png. Don't forget that Microsoft Paint can't do transparent pixels.
No need to do both .7z and .zip.
 
I keep on getting a error and I edited the .cs file but it still wont compile heres the code
Code:
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace AeonsOfTerraria.Items.Armor {
public class AeonBrestplate : ModItem
{
    public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
    {
        equips.Add(EquipType.Body);
        return true;
    }

    public override void SetDefaults()
    {
        item.name = "Aeon Breastplate";
        item.width = 18;
        item.height = 18;
        AddTooltip("the ultimate brestplate.");
        item.value = 999999;
        item.rare = 10;
        item.defense = 999999999;
    }
   
    public override void UpdateEquip(Player player)
    {
        player.buffImmune[BuffID.OnFire] = true;
        player.statHealthMax2 += 1000000;
        player.statManaMax2 += 1000000;
        }   
       
    public override void AddRecipes()
    {
        ModRecipe = new ModRecipe(mod);
        recipe.AddIngredient(null, "TrueCoreAes", 30);
        recipe.AddIngredient(null, "TrueCoreCaelum", 30);
        recipe.AddIngredient(null, "TrueCoreFerus", 30);
        recipe.AddIngredient(null, "TrueCoreFortis", 30);
        recipe.AddIngredient(null, "TrueCoreInfernum", 30);
        recipe.AddIngredient(null, "TrueCoreLunar", 30);
        recipe.AddIngredient(null, "TrueCoreMalum", 30);
        recipe.AddIngredient(null, "TrueCoreRare", 30);
        recipe.AddIngredient(null, "TrueCoreSanctus", 30);
        recipe.AddTile(null, "AncientTransmuter");
        recipe.SetResult(this);
        recipe.AddRecipe();
    }
}}
[DOUBLEPOST=1442184600,1442184533][/DOUBLEPOST]it expects a ; after (2,33) error CS1002
[DOUBLEPOST=1442185114][/DOUBLEPOST]fixed one found another :(
[DOUBLEPOST=1442185176][/DOUBLEPOST]Terraria\ModLoader\Mod Sources\AeonsOfTerraria\Items\Armor\AoenBrestplate.cs(35,3) : error CS0118: 'Terraria.ModLoader.ModRecipe' is a 'type' but is used like a 'variable'
 
I keep on getting a error and I edited the .cs file but it still wont compile heres the code
Code:
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace AeonsOfTerraria.Items.Armor {
public class AeonBrestplate : ModItem
{
    public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
    {
        equips.Add(EquipType.Body);
        return true;
    }

    public override void SetDefaults()
    {
        item.name = "Aeon Breastplate";
        item.width = 18;
        item.height = 18;
        AddTooltip("the ultimate brestplate.");
        item.value = 999999;
        item.rare = 10;
        item.defense = 999999999;
    }
 
    public override void UpdateEquip(Player player)
    {
        player.buffImmune[BuffID.OnFire] = true;
        player.statHealthMax2 += 1000000;
        player.statManaMax2 += 1000000;
        } 
     
    public override void AddRecipes()
    {
        ModRecipe = new ModRecipe(mod);
        recipe.AddIngredient(null, "TrueCoreAes", 30);
        recipe.AddIngredient(null, "TrueCoreCaelum", 30);
        recipe.AddIngredient(null, "TrueCoreFerus", 30);
        recipe.AddIngredient(null, "TrueCoreFortis", 30);
        recipe.AddIngredient(null, "TrueCoreInfernum", 30);
        recipe.AddIngredient(null, "TrueCoreLunar", 30);
        recipe.AddIngredient(null, "TrueCoreMalum", 30);
        recipe.AddIngredient(null, "TrueCoreRare", 30);
        recipe.AddIngredient(null, "TrueCoreSanctus", 30);
        recipe.AddTile(null, "AncientTransmuter");
        recipe.SetResult(this);
        recipe.AddRecipe();
    }
}}
[DOUBLEPOST=1442184600,1442184533][/DOUBLEPOST]it expects a ; after (2,33) error CS1002
[DOUBLEPOST=1442185114][/DOUBLEPOST]fixed one found another :(
[DOUBLEPOST=1442185176][/DOUBLEPOST]Terraria\ModLoader\Mod Sources\AeonsOfTerraria\Items\Armor\AoenBrestplate.cs(35,3) : error CS0118: 'Terraria.ModLoader.ModRecipe' is a 'type' but is used like a 'variable'
You need to declare the ModRecipe as recipe, so:

Code:
ModRecipe recipe = new ModRecipe(mod);
 
Back
Top Bottom