Standalone [1.3] tModLoader - A Modding API

Yeah so the item will be 4x4 in style.

This is the code so far,

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

namespace DarkArmorReforged.Tiles
{
    public class LongTable : ModTile
    {
        public override void SetDefaults()
        {
            Main.tileSolidTop[Type] = false;
            Main.tileFrameImportant[Type] = true;
            Main.tileNoAttach[Type] = true;
            Main.tileLavaDeath[Type] = true;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); (I put this as 3x3 as it was the max without getting an error)
            TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16};
            TileObjectData.newTile.CoordinateWidth = 16;
            TileObjectData.newTile.CoordinatePadding = 2;
            TileObjectData.addTile(Type);
            AddMapEntry(new Color(255, 255, 255), "LongTable");
            adjTiles = new int[] { TileID.WorkBenches };
            AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch);
        }

        public override void KillMultiTile(int i, int j, int frameX, int frameY)
        {
            Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("LongTable"));
        }
    }
}
Allright, so one thing you can do is create your whole own 'placement style'.
Lemme give you an example (with comments, of course):

This code:
Code:
TileObjectData.newTile.Width = 4; // Set the width of the tile, 4 in this case.
TileObjectData.newTile.Height = 4; // Set the height of the tile, 4 in this case.

// Set the origin of this tile. This is used when displaying the tile preview.
// Since all Terraria objects are placed from their botom left perspective, we set the Y parameter of the Point to 3.
TileObjectData.newTile.Origin = new Point16(0, 3); 

// The following will only allow this tile to be placed on a solid surface all along the way of this tile.
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0);
TileObjectData.newTile.UsesCustomCanPlace = true; // We do use a custom can place.
TileObjectData.newTile.LavaDeath = true; // Optional, guess that speaks for itself.
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; // Since our tile is 4 pieces high, we need to define 4 values here.
TileObjectData.newTile.CoordinateWidth = 16; // The width of each of the tile pieces (default is 16).
TileObjectData.newTile.CoordinatePadding = 2; // The padding of each tile piece on the tilesheet.
TileObjectData.addTile(Type);

Basically replaces this code you already have (in the SetDefaults function):
Code:
TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); (I put this as 3x3 as it was the max without getting an error)
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16};
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.addTile(Type);
 
because Im still not getting the progress message
[DOUBLEPOST=1457436990,1457436833][/DOUBLEPOST]using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using System.Collections.Generic;
using Terraria.World.Generation;
using Terraria.GameContent.Generation;

namespace Enderuim.Tiles
{
public class EnderuimOreGen : ModWorld
{
public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
{
int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Buried Chests"));

tasks.Insert(ShiniesIndex + 1, new PassLegacy("Crazy Ore", delegate (GenerationProgress progress){;
{
progress.Message = "Growing Enderuim Crystals...";

for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); k++)
{
WorldGen.TileRunner(WorldGen.genRand.Next(0, Main.maxTilesX), WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(2, 6), mod.TileType("EnderuimOre"), false, 0f, 0f, false, true);
}
};
}));
}
}}
[DOUBLEPOST=1457437131][/DOUBLEPOST]
No only the part in my post above.
This is what it should be EnderShot
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using System.Collections.Generic;
using Terraria.World.Generation;
using Terraria.GameContent.Generation;

namespace Enderuim.Tiles
    {
        public class EnderuimOre : ModWorld
        {
            public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
        {
            int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Buried Chests"));

            tasks.Insert(ShiniesIndex + 1, new PassLegacy("Crazy Ore", delegate (GenerationProgress progress){;
            {
                progress.Message = "Growing Enderuim Crystals...";

                for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); k++)
                {
                    WorldGen.TileRunner(WorldGen.genRand.Next(0, Main.maxTilesX), WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(2, 6), mod.TileType("EnderuimOre"), false, 0f, 0f, false, true);
                }
            };
        }));
    }
}}
do you atleast know how to make it more common so I can find it quicker?
 
because Im still not getting the progress message
[DOUBLEPOST=1457436990,1457436833][/DOUBLEPOST]using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using System.Collections.Generic;
using Terraria.World.Generation;
using Terraria.GameContent.Generation;

namespace Enderuim.Tiles
{
public class EnderuimOreGen : ModWorld
{
public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
{
int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Buried Chests"));

tasks.Insert(ShiniesIndex + 1, new PassLegacy("Crazy Ore", delegate (GenerationProgress progress){;
{
progress.Message = "Growing Enderuim Crystals...";

for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); k++)
{
WorldGen.TileRunner(WorldGen.genRand.Next(0, Main.maxTilesX), WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(2, 6), mod.TileType("EnderuimOre"), false, 0f, 0f, false, true);
}
};
}));
}
}}
[DOUBLEPOST=1457437131][/DOUBLEPOST]
do you atleast know how to make it more common so I can find it quicker?
You can modify the third and fourth parameter of that function to make it more common (higher values).
 
6E-05); k++) <- these?
 
This is for the custom 4x4
Im getting an error here,
TileObjectData.newTile.Origin = new Point16(0, 3);

(23,49) : error CS0246: The type or namespace name 'Point16' could not be found (are you missing a using directive or an assembly reference?)

26,55) : error CS0246: The type or namespace name 'AnchorData' could not be found (are you missing a using directive or an assembly reference?)

(26,66) : error CS0103: The name 'AnchorType' does not exist in the current context
 
0f, 0f, false, true); <---?
[DOUBLEPOST=1457437457,1457437423][/DOUBLEPOST]
Im getting an error here,
TileObjectData.newTile.Origin = new Point16(0, 3);

(23,49) : error CS0246: The type or namespace name 'Point16' could not be found (are you missing a using directive or an assembly reference?)

26,55) : error CS0246: The type or namespace name 'AnchorData' could not be found (are you missing a using directive or an assembly reference?)

(26,66) : error CS0103: The name 'AnchorType' does not exist in the current context
using terraria.AnchorType? idk
 
Im getting an error here,
TileObjectData.newTile.Origin = new Point16(0, 3);

(23,49) : error CS0246: The type or namespace name 'Point16' could not be found (are you missing a using directive or an assembly reference?)

26,55) : error CS0246: The type or namespace name 'AnchorData' could not be found (are you missing a using directive or an assembly reference?)

(26,66) : error CS0103: The name 'AnchorType' does not exist in the current context
Ah, you'll need to include these namespaces:
Code:
using Terraria;
using Terraria.ID;
using Terraria.Enums;
using Terraria.ModLoader;
using Terraria.ObjectData;
using Terraria.DataStructures;
0f, 0f, false, true); <---?
[DOUBLEPOST=1457437457,1457437423][/DOUBLEPOST]
using terraria.AnchorType? idk
The third and fourth, not the last four. Function parameters are split by ','.
 
can you just show me
 
can you just show me
It's not really all that hard:
Code:
WorldGen.TileRunner(WorldGen.genRand.Next(0, Main.maxTilesX), WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(2, 6), mod.TileType("EnderuimOre"), false, 0f, 0f, false, true);
                                                                                                                                    // ^^ This one                        // ^^ And this one
 
It's not really all that hard:
Code:
WorldGen.TileRunner(WorldGen.genRand.Next(0, Main.maxTilesX), WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(2, 6), mod.TileType("EnderuimOre"), false, 0f, 0f, false, true);
                                                                                                                                    // ^^ This one                        // ^^ And this one
thanks lol
Its works now
 
Im wanting to add a custom projectile to my boss, how would i go about this, im about to create the projectile, from the examplemod. Never done it before. i dont think.
 
Im wanting to add a custom projectile to my boss, how would i go about this, im about to create the projectile, from the examplemod. Never done it before. i dont think.
That really depends on the AI you want your projectile to have. It might be a good idea to look at how vanilla AI is handled.
 
That really depends on the AI you want your projectile to have. It might be a good idea to look at how vanilla AI is handled.
Im going to attempt to create a projectile which can be summonable and used with my custom weapons, then ill move onto looking into that and trying to add it to the boss as a minion.
 
Im going to attempt to create a projectile which can be summonable and used with my custom weapons, then ill move onto looking into that and trying to add it to the boss as a minion.
So you want to create a summonable minion, right?
Still, fleshing out what exactly the projectile is going to do is step one. After that, you'll really need some programming knowledge to piece a good AI together.
 
I want to change this item.shoot = ProjectileID.DemonScythe; to a mod and projectileID / would be moddedprojectile how do i do this ?
 
I want to change this item.shoot = ProjectileID.DemonScythe; to a mod and projectileID / would be moddedprojectile how do i do this ?
If I got your question right, you'll want to do:
Code:
item.shoot = mod.ProjectileType("YourProjectileClassName");
 
Do you have an example soul animation picture, because i never can get my correct.
 
Do you have an example soul animation picture, because i never can get my correct.
What do you mea by soul animation? Are you referring to the vanilla items like Soul of Might/Sight/etc?
 
Yes sorry, like those.
 
Back
Top Bottom