Standalone [1.3] tModLoader - A Modding API

I'm currently having a bug where I can't load a world after joining it, then leaving it... So yeah :P
 
Im getting this error. Please help: Error Cs0103: The Name 'AddMapEntry' does not exist in the current context. Although Addmapentry does exist.

Here -

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

namespace DarkArmorReforged.Tiles
{
public class CobaltAnvil : 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.Style2x1);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 };
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.addTile(Type);
adjTiles = new int[] { TileID.Anvils };
AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch);
AddMapEntry(new Color(255, 255, 255), "CobaltAnvil");
}

public override void KillMultiTile(int i, int j, int frameX, int frameY)
{
Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("CobaltAnvil"));
}
}
}
 
Im getting this error. Please help: Error Cs0103: The Name 'AddMapEntry' does not exist in the current context. Although Addmapentry does exist.

Here -

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

namespace DarkArmorReforged.Tiles
{
public class CobaltAnvil : 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.Style2x1);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 };
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.addTile(Type);
adjTiles = new int[] { TileID.Anvils };
AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch);
AddMapEntry(new Color(255, 255, 255), "CobaltAnvil");
}

public override void KillMultiTile(int i, int j, int frameX, int frameY)
{
Item.NewItem(i * 16, j * 16, 48, 48, mod.ItemType("CobaltAnvil"));
}
}
}
Have you installed tModLoader correctly? I've just copy+pasted that code and it worked fine. Try reinstalling tModLoader and try again.
 
when i disable a mod that has a npc in it,and go back to a world that has a modded npc in it .the world wil fail to load.
I just tried with ExampleMod and it works. Can you tell me more about what mod and npc cause the problem?
 
How do I make something happen for 10 seconds?
 
I just tried with ExampleMod and it works. Can you tell me more about what mod and npc cause the problem?
well, this mod has an npc named ed the custom weapon developer. i didnt want him in my world, so i disable the mod, and i went back to my world and it said "load backup?"
So i did that, but it failed to load the backup.( then i realized it was the mod true eternity that causes the worlds to fail loading)
 
How would one go about making an NPC spawn additional NPCs every few seconds, say, an NPC spawning another modded NPC every 5 seconds?
 
How do I make something happen for 10 seconds?
Depends on what is causing the thing to happen for 10 seconds.

How would one go about making an NPC spawn additional NPCs every few seconds, say, an NPC spawning another modded NPC every 5 seconds?
Using npc's "npc.ai" variables helps with this, so you would probably do something like this with your NPC.

Code:
public override void AI()
{
    if(npc.ai[0] == 360) //we can also do if (npc.ai[0] % 360 ==0)
    {
       NPC.NewNPC(//Stuff in here, too lazy to fill in);
       npc.ai[0] = 0; //if we do the other way, then you wouldn't need this
    }
    npc.ai[0] += 1f;
}
 
Last edited:
-Modded NPCs disappear upon being hit?
I can confirm this. Me and my friend played this on a modded server with the tremor mod installed, and the Undead Warrior NPC disappeared upon hitting it.
 
I can confirm this. Me and my friend played this on a modded server with the tremor mod installed, and the Undead Warrior NPC disappeared upon hitting it.
multiplayer is not working wait for the next update

Status: Very busy with homework
v0.7.2:
-Fix server-sync bug with OnPickup hook - Complete
 
Depends on what is causing the thing to happen for 10 seconds.


Using npc's "npc.ai" variables helps with this, so you would probably do something like this with your NPC.

Code:
public override void AI()
{
    if(npc.ai[0] == 360) //we can also do if (npc.ai[0] % 360 ==0)
    {
       NPC.NewNPC(//Stuff in here, too lazy to fill in);
       npc.ai[0] = 0; //if we do the other way, then you wouldn't need this
    }
    npc.ai[0] += 1f;
}


Code:
        public override void AI()
        {
            if(npc.ai[87] % 360 ==0)
            {
                NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("notimportant"));
            }
            npc.ai[87] += 1f;
        }

So I'm trying to get it to use the crimson mimic AI by default instead of 0, but this causes it not to spawn anymore. I probably missed something, I'm not to experienced with AI stuff.
 
Code:
        public override void AI()
        {
            if(npc.ai[87] % 360 ==0)
            {
                NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("notimportant"));
            }
            npc.ai[87] += 1f;
        }

So I'm trying to get it to use the crimson mimic AI by default instead of 0, but this causes it not to spawn anymore. I probably missed something, I'm not to experienced with AI stuff.
Try using PostAI() instead of just AI() it could work since it is called after vanilla code.
[DOUBLEPOST=1457133899,1457133583][/DOUBLEPOST]
Try using PostAI() instead of just AI() it could work since it is called after vanilla code.
Actually I just saw why it doesn't work, there are only, I believe, 4 places ai can store those being
Code:
npc.ai[0]
npc.ai[1]
npc.ai[2]
npc.ai[3]

You need to choose one of those slots unless you increased the amount of npc.ai slots. I would recommend that you go through them all because there is a chance that some or all of these npc.ai are already being used by the Crimson Mimic AI.
 
How do I switch between Vanilla Terraria and tMod? I'm not wanting to play with the tMod all the time and I'd rather not delete, rename, move, etc, files every time I want to switch.
 
Has servers been implemented?
 
Has servers been implemented?
Servers have been implemented, just there are some problems and Bluemagic is patching it up soon.
How do I switch between Vanilla Terraria and tMod? I'm not wanting to play with the tMod all the time and I'd rather not delete, rename, move, etc, files every time I want to switch.
There should be something like Terraria.bak.exe, rename that to Terraria.exe and it should work as vanilla Terraria if I recall correctly.
 
Servers have been implemented, just there are some problems and Bluemagic is patching it up soon.

There should be something like Terraria.bak.exe, rename that to Terraria.exe and it should work as vanilla Terraria if I recall correctly.
Well, I have a little experience with servers. I hope I could host a server for my beta testers.
 
Servers have been implemented, just there are some problems and Bluemagic is patching it up soon.

There should be something like Terraria.bak.exe, rename that to Terraria.exe and it should work as vanilla Terraria if I recall correctly.
I remember that file from the past, but no such thing exists in my install folder of Terraria. None the less, I should figure it out eventually on how to jump back and forth without doing to much.
 
I remember that file from the past, but no such thing exists in my install folder of Terraria. None the less, I should figure it out eventually on how to jump back and forth without doing to much.
Do you have a file called Terraria_v1.3.0.8.exe?
 
Back
Top Bottom