Flaming Flamingo
Terrarian
Yes I install it after I install gamelauncherYes, I have 8.1, so I can confirm it does work. Have you tried installing GameLauncher and then running it?
Yes I install it after I install gamelauncherYes, I have 8.1, so I can confirm it does work. Have you tried installing GameLauncher and then running it?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TAPI;
using Terraria;
namespace CS_s_Crimson_Curse.Items.Materials
{
public class RainbowSlimeCrown
{
public RainbowSlimeCrown(ModBase mBase, Item item) : base(mBase, item)
{
}
public override bool? UseItem(Player P)
{
NPC.NewNPC(new Vector2(P.position.X, P.position.Y - 256), "CS_s_Crimson_Curse:Terrarium_Slime);
return true;
}
}
}
You basically have to copy over the entire fighter code into a custom AI then make the needed changes, because the problem is that AI's are hardcoded by NPC type, even within a single style.I have a problem. My monster uses AI #3 (Fighter AI). But it only works during night. How to make it work during day?
Maybe tAPI isn't being run with administrative privileges. Have you tried enabling administrative privileges?It doesn't go to another user and when I run tapi it says path not found under mods I have checked all other directories but it doesent go there. Does tapi work with windows 8.1
First line says everything. How many RAM does your pc have? Try closing as many programs as you can before starting terraria.This happens when I try to join a server. No mods installed. Singleplayer works fine. Any ideas?
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at TAPI.BinBuffer.ReadBytes(System.Int32 count)
at TAPI.BinBuffer.ReadString()
at Terraria.MessageBuffer.GetData(System.Int32 start, System.Int32 length)
at Terraria.NetMessage.CheckBytes(System.Int32 i = 256)
at Terraria.Netplay.ClientLoop(System.Object threadContext)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object state)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
First line says everything. How many RAM does your pc have? Try closing as many programs as you can before starting terraria.
{
"displayName": "Beacon Altar",
"size": [3,3],
"frameWidth": 16,
"frameHeight": 16,
"frameImportant": true,
"frameMax": 28,
"frameCounterMax": 28,
"solid": false,
"blocksLight": false,
"blocksSun": false,
"mergeDirt": false,
"placementConditions": "flatGround",
"placementOrigin": [0,2],
"breaksByHammer": true,
"minHammer": 120,
"dust": 1,
"sound": 4,
"soundGroup": 3,
"glows": true,
"treasure": true,
"mapColor": [50, 50, 200],
"mapHoverText": "Beacon Altar"
}
public class GenUHMDefault : WorldGenTask
{
private readonly ModBase modBase;
public GenUHMDefault(ModBase modBase) : base(modBase.mod.InternalName)
{
this.modBase = modBase;
}
public override void Generate()
{
try
{
int Amount_Of_Spawns = 80;
for (int i = 0; i < Amount_Of_Spawns; i++) BeaconAltars();
}
catch (Exception e)
{
ErrorHandling.Handle(e);
}
}
public void BeaconAltars()
{
int HX = Main.maxTilesX - 200;
int LX = 200;
int HY = Main.maxTilesY - 200;
int LY = (int)Main.worldSurface;
int x = WorldGen.genRand.Next(LX, HX + 1);
int y = WorldGen.genRand.Next(LY, HY + 1);
//Checks if the space where it spawns is empty, else generate a new position
if (WorldGen.EmptyTileCheck(x, x + 2, y, y - 2) && !WorldGen.EmptyTileCheck(x, x + 2, y + 1, y + 1))
{
WorldGen.PlaceTile(x, y, TileDef.byName["BriansMod:BeaconAltarTile"], true, true);
}
else
{
BeaconAltars();
}
}
}
public static void WorldGenModifyUltraHardModeTaskList(List<WorldGenTask> list)
{
list.Add(new GenUHMDefault(MBase.self));
}
public static void ExecuteUltraHardModeWorldGenTasks()
{
List<WorldGenTask> list = new List<WorldGenTask>();
WorldGenModifyUltraHardModeTaskList(list);
WorldGenTask[] tasks = list.ToArray();
UltraHardmodeActivated = true;
for (int i = 0; i < tasks.Length; i++)
{
tasks[i].Generate();
}
Main.NewText("The ancient gods have now been fully awakened...", Color.LightBlue, true);
}
Terraria with TAPI uses ~800-1200 megabytes of ram for me, so 3gbs is not a lot. But wait, i found something:My pc has 3 gigas of ram and I doubt if Terraria would take THAT much. This has to be some kind of error.
If nothing works you can try backing up and completely removing Terraria folder from C:\Users\UsernameHere\My Documents\My Games", but that advice is completely random. Good luck, because i completely don't know what can cause this problem if not a weak pc.I sometimes get OutOfMemory errors when I reload my mods again, and again, and again. tAPI itself may have a few memory leaks, and the mods tAPI uses can introduce even more memory issues if not coded properly. Sometimes the issue is fixed by simply Exiting the program entirely, and restarting. This may need to be done on the client and/or on the server, but more likely the client.Help? I want to join servers and it keeps crashing on me...
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at TAPI.BinBuffer.ReadBytes(System.Int32 count)
at TAPI.BinBuffer.ReadString()
at Terraria.MessageBuffer.GetData(System.Int32 start, System.Int32 length)
at Terraria.NetMessage.CheckBytes(System.Int32 i = 256)
at Terraria.Netplay.ClientLoop(System.Object threadContext)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(System.Object state)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
If this is happening even on a fresh start, you may have too many mods enabled than your computer can handle. You can try closing other programs that are currently running, or try increasing your systems pagefile size. Mods that add a lot of new content (tiles, items, npcs, etc.) use up a lot of memory. While running tAPI on my system, it can reach over 1.2 gigs of memory use. Disabling some content mods may ultimately be necessary.
Try repairing .NET Framework and installing both 3.0 and 4.0 versions if they're not installed.Friend trying to be install tapi for first time and gets this error.
Anyone know what's up with it? New to tapi so I'm not much help atm lolProblem Event Name: CLR20r3
Problem Signature 01: tapi.exe
Problem Signature 02: 1.0.0.0
Problem Signature 03: 54724df6
Problem Signature 04: tAPI
Problem Signature 05: 1.0.0.0
Problem Signature 06: 54724df6
Problem Signature 07: f0
Problem Signature 08: 0
Problem Signature 09: System.NullReferenceException
OS Version: 6.1.7601.2.1.0.256.1
Locale ID: 2057
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
You need to override ModNPC like this:How would I change the drops of an already existing NPC?
[GlobalModAttribute]
public class Dummy : ModNPC
public override void SetupLootRules(NPC unused)
{
LootRule.settingUp = true;
LootRule[] rules = new LootRule[1];
LootRule frostMoon = new LootRule("Frost Moon").Rules(new Func<NPC, bool>[]{LootRule.ruleFrostMoon});
Func<NPC, bool>[] small = {((NPC npc) => NPC.waveCount >= 11 && NPC.waveCount < 15)};
Func<NPC, bool>[] large = {((NPC npc) => NPC.waveCount >= 15)};
LootRule[] conditionals = new LootRule[2];
conditionals[0] = new LootRule(null).Rules(small).Chance((NPC npc) => 0.2 * (NPC.waveCount - 10)).Item("Bluemagic:Icicle");
conditionals[1] = new LootRule(null).Rules(large).Stack(4, 6).Item("Bluemagic:Icicle");
rules[0] = frostMoon.LootRules(conditionals);
LootRule.AddFor("Ice Queen", rules);
rules = new LootRule[1];
rules[0] = new LootRule(null).Item("Bluemagic:Bubble").Stack(5, 7);
LootRule.AddFor("Duke Fishron", rules);
rules = new LootRule[1];
LootRule pumpkinMoon = new LootRule("Pumpkin Moon").Rules(new Func<NPC, bool>[]{LootRule.rulePumpkinMoon});
small = new Func<NPC, bool>[]{((NPC npc) => NPC.waveCount >= 11 && NPC.waveCount < 15)};
large = new Func<NPC, bool>[]{((NPC npc) => NPC.waveCount >= 15)};
conditionals = new LootRule[2];
conditionals[0] = new LootRule(null).Rules(small).Chance((NPC npc) => 0.2 * (NPC.waveCount - 10)).Item("Bluemagic:ScytheBlade");
conditionals[1] = new LootRule(null).Rules(large).Stack(4, 6).Item("Bluemagic:ScytheBlade");
rules[0] = pumpkinMoon.LootRules(conditionals);
LootRule.AddFor("Pumpking", rules);
LootRule.settingUp = false;
}
I'd recommend using Main.NewText to display the coordinates of all the spawns onto your screen. That way, you can make sure the code is being called and you'll know where to look.hello. i'm trying to spawn some altars when a boss is defeated. the activation text works fine, but i've been searching all over the underground and never saw even one of my tile.
Tile's JSON:
World gen code:Code:{ "displayName": "Beacon Altar", "size": [3,3], "frameWidth": 16, "frameHeight": 16, "frameImportant": true, "frameMax": 28, "frameCounterMax": 28, "solid": false, "blocksLight": false, "blocksSun": false, "mergeDirt": false, "placementConditions": "flatGround", "placementOrigin": [0,2], "breaksByHammer": true, "minHammer": 120, "dust": 1, "sound": 4, "soundGroup": 3, "glows": true, "treasure": true, "mapColor": [50, 50, 200], "mapHoverText": "Beacon Altar" }
Activation code:Code:public class GenUHMDefault : WorldGenTask { private readonly ModBase modBase; public GenUHMDefault(ModBase modBase) : base(modBase.mod.InternalName) { this.modBase = modBase; } public override void Generate() { try { int Amount_Of_Spawns = 80; for (int i = 0; i < Amount_Of_Spawns; i++) BeaconAltars(); } catch (Exception e) { ErrorHandling.Handle(e); } } public void BeaconAltars() { int HX = Main.maxTilesX - 200; int LX = 200; int HY = Main.maxTilesY - 200; int LY = (int)Main.worldSurface; int x = WorldGen.genRand.Next(LX, HX + 1); int y = WorldGen.genRand.Next(LY, HY + 1); //Checks if the space where it spawns is empty, else generate a new position if (WorldGen.EmptyTileCheck(x, x + 2, y, y - 2) && !WorldGen.EmptyTileCheck(x, x + 2, y + 1, y + 1)) { WorldGen.PlaceTile(x, y, TileDef.byName["BriansMod:BeaconAltarTile"], true, true); } else { BeaconAltars(); } } }
The ExecuteUltraHartModeWorldGenTasks() method gets called and works correctly after my boss is defeated, but i can't see even one altar. Heck, the game doesn't even lag! Did i do something wrong???Code:public static void WorldGenModifyUltraHardModeTaskList(List<WorldGenTask> list) { list.Add(new GenUHMDefault(MBase.self)); } public static void ExecuteUltraHardModeWorldGenTasks() { List<WorldGenTask> list = new List<WorldGenTask>(); WorldGenModifyUltraHardModeTaskList(list); WorldGenTask[] tasks = list.ToArray(); UltraHardmodeActivated = true; for (int i = 0; i < tasks.Length; i++) { tasks[i].Generate(); } Main.NewText("The ancient gods have now been fully awakened...", Color.LightBlue, true); }
You can use any text editor you want (i use Notepad++) and you don't need VS at all.Do I NEED to use VS to write the cs files or is doing then freehand possible. Just now starting to work on NPCs and pets for my lh mod. Didnt wanna waste days to write it to find out it doesnt work.