Standalone [1.3] tModLoader - A Modding API

Make sure you copied my edited code in its entirety. It should not be throwing that error.

Also, if you want to attract my attention, either quote my messages by pressing the Reply button in the lower left corner of my post, or tag me (@Kazzymodus). Otherwise, I won't be notified when you ask a question. :)
but i've backuped to 9.0.2 and i've got no problem at that version, but on 9.0.3
 
Try running the server manually and check the output for errors.

The output as in ?\Documents\My Games\Terraria\ModLoader\Logs?

If so it only show's this:
Code:
Failed to read Reduced Grinding's config file! Recreating config...
BossChecklist Call Error:    at BossChecklist.BossChecklist.Call(Object[] args) in D:\Documents\My Games\Terraria\ModLoader\Mod Sources\BossChecklist\BossChecklist.cs:line 110Object reference not set to an instance of an object.

I might be wrong but I don't think that this could affect the connection in any way
 
I finally got my tmodlodaer working, and now it starts up just fine. That is until it starts loading mods and comes up with this error and crashes:


---------------------------
Terraria: Error
---------------------------
System.MissingFieldException: Field not found: 'Terraria.Main.rand'.

at BossExpertise.BossExpertise.ModifyTransformMatrix(Matrix transform)

at Terraria.ModLoader.ModHooks.ModifyTransformMatrix(Matrix Transform)

at Terraria.Main.do_Draw(GameTime gameTime)

at Terraria.Main.DoDraw(GameTime gameTime)

at Terraria.Main.Draw(GameTime gameTime)

at Microsoft.Xna.Framework.Game.DrawFrame()

at Microsoft.Xna.Framework.Game.Tick()

at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)

at Microsoft.Xna.Framework.GameHost.OnIdle()

at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()

at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)

at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)

at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)

at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

at System.Windows.Forms.Application.Run(Form mainForm)

at Microsoft.Xna.Framework.WindowsGameHost.Run()

at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)

at Terraria.Program.LaunchGame(String[] args)
---------------------------
OK
---------------------------






is this because my mods just need to be updated?
 
I finally got my tmodlodaer working, and now it starts up just fine. That is until it starts loading mods and comes up with this error and crashes:


---------------------------
Terraria: Error
---------------------------
System.MissingFieldException: Field not found: 'Terraria.Main.rand'.

at BossExpertise.BossExpertise.ModifyTransformMatrix(Matrix transform)

at Terraria.ModLoader.ModHooks.ModifyTransformMatrix(Matrix Transform)

at Terraria.Main.do_Draw(GameTime gameTime)

at Terraria.Main.DoDraw(GameTime gameTime)

at Terraria.Main.Draw(GameTime gameTime)

at Microsoft.Xna.Framework.Game.DrawFrame()

at Microsoft.Xna.Framework.Game.Tick()

at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)

at Microsoft.Xna.Framework.GameHost.OnIdle()

at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()

at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)

at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)

at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)

at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

at System.Windows.Forms.Application.Run(Form mainForm)

at Microsoft.Xna.Framework.WindowsGameHost.Run()

at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)

at Terraria.Program.LaunchGame(String[] args)
---------------------------
OK
---------------------------






is this because my mods just need to be updated?
yes, look there at the error, it says BossExpertise.

could someone here please explain to me what had changed in the "hurt"-method? (in item not modplayer)
Here is the new parameters to player.Hurt:
Code:
public double Hurt(PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp = false, bool quiet = false, bool Crit = false, int cooldownCounter = -1)
I think all that has changed is there is the PlayerDeathReason object. You can do a custom reason with PlayerDeathReason.ByCustomReason("Too much candy")
 
Make sure you copied my edited code in its entirety. It should not be throwing that error.

Also, if you want to attract my attention, either quote my messages by pressing the Reply button in the lower left corner of my post, or tag me (@Kazzymodus). Otherwise, I won't be notified when you ask a question. :)

Weirdly enough copied ur code but i get this error
error CS0111: Type 'NicksMod.NPCs.KillerWhale' already defines a member called 'CanSpawn' with the same parameter types

here code incase
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;


namespace NicksMod.NPCs
{
public class KillerWhale : ModNPC
{
public override void SetDefaults()
{
npc.name = "Killer Whale";
npc.displayName = "Killer Whale";
npc.width = 70;
npc.height = 70;
npc.damage = 65;
npc.defense = 15;
npc.lifeMax = 500;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
npc.value = 60f;
npc.knockBackResist = 0.5f;
npc.aiStyle = 16;
Main.npcFrameCount[npc.type] = 3;
aiType = NPCID.Shark; //npc behavior
animationType = NPCID.Shark;
}

public override float CanSpawn(NPCSpawnInfo spawnInfo)
{
return spawnInfo.spawnTileY < Main.worldSurface && !Main.dayTime ? 0.5f : 0.5f;
}

public override void FindFrame(int frameHeight)
{
npc.frameCounter -= 0.1F; // Determines the animation speed. Higher value = faster animation.
npc.frameCounter %= Main.npcFrameCount[npc.type];
int frame = (int)npc.frameCounter;
npc.frame.Y = frame * frameHeight;
npc.spriteDirection = npc.direction;
}

public override void NPCLoot() //Npc drop
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OrcaFin"));
}

public override float CanSpawn(NPCSpawnInfo spawnInfo)
{
int x = spawnInfo.spawnTileX;
int y = spawnInfo.spawnTileY;
int tile = (int)Main.tile[x, y].type;
return (NicksMod.NormalSpawn(spawnInfo) && (tile == 53 || tile == 112 || tile == 116 || tile == 234) && NicksMod.NoZoneAllowWater(spawnInfo) && spawnInfo.water) && y < Main.rockLayer && (x < 250 || x > Main.maxTilesX - 250)
}
}
}
 
Weirdly enough copied ur code but i get this error
error CS0111: Type 'NicksMod.NPCs.KillerWhale' already defines a member called 'CanSpawn' with the same parameter types

here code incase
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;


namespace NicksMod.NPCs
{
public class KillerWhale : ModNPC
{
public override void SetDefaults()
{
npc.name = "Killer Whale";
npc.displayName = "Killer Whale";
npc.width = 70;
npc.height = 70;
npc.damage = 65;
npc.defense = 15;
npc.lifeMax = 500;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
npc.value = 60f;
npc.knockBackResist = 0.5f;
npc.aiStyle = 16;
Main.npcFrameCount[npc.type] = 3;
aiType = NPCID.Shark; //npc behavior
animationType = NPCID.Shark;
}

public override float CanSpawn(NPCSpawnInfo spawnInfo)
{
return spawnInfo.spawnTileY < Main.worldSurface && !Main.dayTime ? 0.5f : 0.5f;
}

public override void FindFrame(int frameHeight)
{
npc.frameCounter -= 0.1F; // Determines the animation speed. Higher value = faster animation.
npc.frameCounter %= Main.npcFrameCount[npc.type];
int frame = (int)npc.frameCounter;
npc.frame.Y = frame * frameHeight;
npc.spriteDirection = npc.direction;
}

public override void NPCLoot() //Npc drop
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("OrcaFin"));
}

public override float CanSpawn(NPCSpawnInfo spawnInfo)
{
int x = spawnInfo.spawnTileX;
int y = spawnInfo.spawnTileY;
int tile = (int)Main.tile[x, y].type;
return (NicksMod.NormalSpawn(spawnInfo) && (tile == 53 || tile == 112 || tile == 116 || tile == 234) && NicksMod.NoZoneAllowWater(spawnInfo) && spawnInfo.water) && y < Main.rockLayer && (x < 250 || x > Main.maxTilesX - 250)
}
}
}
Ah, yes. Remove the CanSpawn override you don't want.
 
... ehmm... where do I have to put it in?
The old was:
public double Hurt(int Damage, int hitDirection, bool pvp = false, bool quiet = false, string deathText = " was slain...", bool Crit = false, int cooldownCounter = -1)
The new is:
public double Hurt(PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp = false, bool quiet = false, bool Crit = false, int cooldownCounter = -1)

So, if before you were calling:
player.Hurt(10, 1);
now you would call
player.Hurt(PlayerDeathReason.ByCustomReason("Too much candy"), 10, 1);
 
So, if before you were calling:
player.Hurt(10, 1);
now you would call
player.Hurt(PlayerDeathReason.ByCustomReason("Too much candy"), 10, 1);
... it doesnt like that at me but like this... :
Code:
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
        {
               int spike = (int)Math.Floor((double)(damage / 10));
                 player.Hurt(spike, target.direction);
            base.OnHitNPC(player, target, damage, knockBack, crit);
        }
so is it wrong the way I did it?
 
... it doesnt like that at me but like this... :
Code:
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
        {
               int spike = (int)Math.Floor((double)(damage / 10));
                 player.Hurt(spike, target.direction);
            base.OnHitNPC(player, target, damage, knockBack, crit);
        }
so is it wrong the way I did it?
You're not giving me much to go on here....what IS the error?

oh, you'll need using Terraria.DataStructures; at the top, btw
 
You're not giving me much to go on here....what IS the error?
sorry 'bout that
well i have to translate it from german...
i think it says something like "no overload accepts 2-arguments for the 'hurt'-method" or something like that
i already figured out that there is something missing between the brackets... but i dont know whats missing
 
sorry 'bout that
well i have to translate it from german...
i think it says something like "no overload accepts 2-arguments for the 'hurt'-method" or something like that
i already figured out that there is something missing between the brackets... but i dont know whats missing
Yeah, you are missing the PlayerDeathReason!

player.Hurt(PlayerDeathReason.ByCustomReason("Too much candy"),spike, target.direction);
 
Back
Top Bottom