Standalone [1.3] tModLoader - A Modding API

Here is my full code:

Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;

namespace Tremor.Tiles {
public class Bars : ModTile
{
    public override void SetDefaults()
    {
        Main.tileFrameImportant[Type] = true;
        Main.tileNoAttach[Type] = true;
        Main.tileSolidTop[Type] = true;
        Main.tileLavaDeath[Type] = true;
        TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1);
        TileObjectData.newTile.Height = 1;
        TileObjectData.newTile.CoordinateHeights = new int[]{16};
        TileObjectData.newTile.StyleHorizontal = true;
        TileObjectData.newTile.StyleWrapLimit = 111;
        TileObjectData.addTile(Type);
        mapColor = new Color(13, 88, 130);
        mapName = "Bar";
        Main.tileShine[Type] = 1100;
        Main.tileSolid[Type] = true;
    }

    public override void KillMultiTile(int i, int j, int frameX, int frameY)
    {
        int style = frameX / 18;
        string item;
        switch(style)
        {
        case 0:
            item = "SteelBar";
            break;
        case 1:
            item = "MagmoniumBar";
            break;
        case 2:
            item = "EvershinyBar";
            break;
        case 3:
            item = "ChaosBar";
            break;
        case 4:
            item = "BronzeBar";
            break;
        default:
            return;
        }
        Item.NewItem(i * 16, j * 16, 16, 48, mod.ItemType(item));
    }
}}
Uh... I guess there isn't any bug after all then. KillMultiTile is only for blocks that take up multiple tiles (for example, beds and trophies and workbenches). Which is why the hook has "multi" in its name. What you're looking for is this:
https://github.com/bluemagic123/tModLoader/wiki/ModTile#public-virtual-bool-dropint-i-int-j
Keep in mind that you'll have to get frameX and frameY by yourself, with Main.tile[i, j].frameX and Main.tile[i, j].frameY when you use this hook.
 
Hm. I'm assuming you specified the dependency in build.txt. Is this with v0.5, or the v0.6 pre-release on Github?


Just to make sure, your Terraria.exe has not been modified by anything else in any way, and you followed the instructions very carefully, right?
I did specify the dependency in the build.txt file and am using v0.5. Is there anything you cannot do when having a mod as a dependency? I'm trying to have a class in my dependent mod inherit from a class in the other non-dependent mod, as well as aquiring some Static variables...
 
I did specify the dependency in the build.txt file and am using v0.5. Is there anything you cannot do when having a mod as a dependency? I'm trying to have a class in my dependent mod inherit from a class in the other non-dependent mod, as well as aquiring some Static variables...
Hm, if you're using pure v0.5 then I don't know what's happening. (I did just find a bug about mod dependencies that I pushed to the Github shortly after v0.5 though.)
The only point of having a mod as a dependency is to be able to use classes from that mod (since ModLoader already has methods that let you access content, etc. of other mods), so I'm not entirely sure why it isn't working for you. The DependentMod for the ExampleMod was working properly last time I checked it.
 
Hm, if you're using pure v0.5 then I don't know what's happening. (I did just find a bug about mod dependencies that I pushed to the Github shortly after v0.5 though.)
The only point of having a mod as a dependency is to be able to use classes from that mod (since ModLoader already has methods that let you access content, etc. of other mods), so I'm not entirely sure why it isn't working for you. The DependentMod for the ExampleMod was working properly last time I checked it.
Hmm, allright. I'll just try debugging the whole thing to see where it breaks and get back to you!

EDIT:
Fyi, it might be just me making a stupid mistake... That's always a possibility.
 
Uh... I guess there isn't any bug after all then. KillMultiTile is only for blocks that take up multiple tiles (for example, beds and trophies and workbenches). Which is why the hook has "multi" in its name. What you're looking for is this:
https://github.com/bluemagic123/tModLoader/wiki/ModTile#public-virtual-bool-dropint-i-int-j
Keep in mind that you'll have to get frameX and frameY by yourself, with Main.tile[i, j].frameX and Main.tile[i, j].frameY when you use this hook.
And how to get X and Y using Main.tile[i, j].frameX and Main.tile[i, j].frameY? Where should I put the coords?
 
And how to get X and Y using Main.tile[i, j].frameX and Main.tile[i, j].frameY? Where should I put the coords?
...Try looking at the code I gave you. Notice how it includes "Main.tile[i, j]". Whenever Main.tile is indexed like this, the first value is the x-coordinate, and the second value is the y-coordinate.
In addition, if you look through the ModTile hooks, nearly all of them have an "i" parameter and a "j" parameter. You even used these parameters when you were trying to use KillMultiTile. Here's a hint: i and j still mean the same thing in Drop.
 
Does anyone know how to check if the player is facing left?
[DOUBLEPOST=1445432770,1445432187][/DOUBLEPOST]nevermind.. got it
Code:
if (player.direction == -1)
 
Hey, i need help. What is wrong with this? It take no efect in game...
Code:
public override void UpdateAccessory(Player player)
    {
        player.magicDamage *= 1.08f;
    }
 
Hey, i need help. What is wrong with this? It take no efect in game...
Code:
public override void UpdateAccessory(Player player)
    {
        player.magicDamage *= 1.08f;
    }
Could you post the whole item code? This snipped looks fine, but it might be something else in your items source.
 
Could you post the whole item code? This snipped looks fine, but it might be something else in your items source.
Ok...
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Ersion.Items.Powers {
public class Magicianlvl3 : ModItem
{
    public override void SetDefaults()
    {
        item.name = "Magician lvl 3";
        item.width = 32;
        item.height = 32;
        item.toolTip = "Increases 8% magic damage and mana in 10";
        item.rare = 2;
        item.accessory = true;
    }
   
    public override void UpdateAccessory(Player player)
    {
        player.magicDamage *= 1.08f;
        player.statManaMax2 += 10;
    }
    public override void AddRecipes()
    {
        ModRecipe recipe = new ModRecipe(mod);
        recipe.AddIngredient(null, "Classlvl3");
        recipe.AddIngredient(null, "Magicianlvl2");
        recipe.AddTile(null, "MiniPowerTable");
        recipe.SetResult(this);
        recipe.AddRecipe();
    }
}}
 
Ok...
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Ersion.Items.Powers {
public class Magicianlvl3 : ModItem
{
    public override void SetDefaults()
    {
        item.name = "Magician lvl 3";
        item.width = 32;
        item.height = 32;
        item.toolTip = "Increases 8% magic damage and mana in 10";
        item.rare = 2;
        item.accessory = true;
    }
  
    public override void UpdateAccessory(Player player)
    {
        player.magicDamage *= 1.08f;
        player.statManaMax2 += 10;
    }
    public override void AddRecipes()
    {
        ModRecipe recipe = new ModRecipe(mod);
        recipe.AddIngredient(null, "Classlvl3");
        recipe.AddIngredient(null, "Magicianlvl2");
        recipe.AddTile(null, "MiniPowerTable");
        recipe.SetResult(this);
        recipe.AddRecipe();
    }
}}
Hmm, also looks fine. Btw (and this might just be the case, don't know for sure, though) increasing any kind of damage should be done different. While you have it like
Code:
player.magicDamage *= 1.08f;
it should be done like
Code:
player.magicDamage += 0.08f;
This increases all magic damage output by 8%. If you want it (for example) to be 20% instead, you should make it '+= 0.2F'.
 
Hmm, also looks fine. Btw (and this might just be the case, don't know for sure, though) increasing any kind of damage should be done different. While you have it like
Code:
player.magicDamage *= 1.08f;
it should be done like
Code:
player.magicDamage += 0.08f;
This increases all magic damage output by 8%. If you want it (for example) to be 20% instead, you should make it '+= 0.2F'.

Yes, i tried that in the past but doesn't work :/
 
*Looks at Patch.bat and vanilla folder* Oh. OHHH. I got it now, I had put Game Launcher in place of the vanilla Terraria now, I have it fixed. Thanks for your help!
 
hello, please excuse me for this, but are there any released mods for this? and if so, could somebody make a list of them
This question has been frequently asked and there are probably a few lists out there, but I'd advice you to look for yourself.
Got to the WIP and Released sections and look for threads with the tModLoader flair.
Some of them don't have a download yet or are (as the section suggests) WIP, but they are all updated by their original owners, so you're always up-to-date.

EDIT:
You Ninja...
 
Hello, I am playing on a Mac, and I have tried many times to get the Patch.bat to generate the modded terraria.exe. However, I am unable to create the modded file with Patch.bat. Is there something I have to do in order for it to work?
 
Hello, I am playing on a Mac, and I have tried many times to get the Patch.bat to generate the modded terraria.exe. However, I am unable to create the modded file with Patch.bat. Is there something I have to do in order for it to work?
You need to wait for v0.6 in order to be able to play on Mac. Hopefully it should be released sometime soon.
 
Back
Top Bottom