Standalone [1.3] tModLoader - A Modding API

So..that means you fixed it? o.o
Yes, pretty much.
[doublepost=1476351306,1476351207][/doublepost]
Hey guys, been having trouble on the browser (Pre 0.8) where my characters are being automatically deleted after about 2 hours of play. This wasn't happening for a bit, so I thought it was fixed, but my most recent character disappeared once I got to Chlorophyte. (~ 6 hours of play)
I believe the problem may be related to the .Tplr extension, but even then I have no idea how to prevent it.
Which mods do you have enabled, and on which tML version are you?
 
I'm on Tmodloader Version 0.8.3.4

My mods are:
Dye easy
Prefixes for enemies
eXtreme fishing bait
Even more modifiers
Player Health Bar
Tremor
Wireless
Snakes fishing expansion
imkShushi mod and the boss loot bags extension
Maxstackplus
Terranova
Pies vanity sets
Jayl Mod-fishing
Worldgen previewer
Quality Of Life
Infinity-endless items
RPG Classes
The luggage

Holy moly, never notice how big that list was before.
 
How can I "update" my tModLoader without deleting old version(characters and worlds)?
 
I don't know if this is still a bug or not but my friend can't open his SteamOverlay in game (he's on MacOSx). So we have trouble playing modded multiplayer. I know ReLogic fixed this bug but your tmodloader seems to re-enable this bug.
 
sorry but WHYYYYYYYYY ICANT NO MORE USE CHARACTER
Impossibile leggere oltre la fine del flusso.
in System.IO.BinaryReader.FillBuffer(Int32 numBytes)
in System.IO.BinaryReader.ReadUInt16()
in Terraria.ModLoader.IO.ItemIO.GetCustomData(Int32 type, BinaryReader reader, Boolean hasGlobalSaving)
in Terraria.ModLoader.Default.MysteryItem.LoadCustomData(BinaryReader reader)
in Terraria.ModLoader.IO.ItemIO.ReadCustomData(Item item, Byte[] data, Boolean hasGlobalSaving)
[doublepost=1476385004,1476384986][/doublepost];(
 
sorry but WHYYYYYYYYY ICANT NO MORE USE CHARACTER
Impossibile leggere oltre la fine del flusso.
in System.IO.BinaryReader.FillBuffer(Int32 numBytes)
in System.IO.BinaryReader.ReadUInt16()
in Terraria.ModLoader.IO.ItemIO.GetCustomData(Int32 type, BinaryReader reader, Boolean hasGlobalSaving)
in Terraria.ModLoader.Default.MysteryItem.LoadCustomData(BinaryReader reader)
in Terraria.ModLoader.IO.ItemIO.ReadCustomData(Item item, Byte[] data, Boolean hasGlobalSaving)
[doublepost=1476385004,1476384986][/doublepost];(
I've been having this same issue.

SRsRYtg.png

This is what the character selection menu looks like
 
Last edited:
I've been having this same issue.

SRsRYtg.png

This is what the character selection menu looks like
if u can restore the data message me
 
That error means that the compiler thinks it's possible for the game to get through all of the code without returning a value. Fix this by replacing the last 'else if (condition)' with 'else'. You don't really need it anyway because either it won't be reached or it will always return true.

oh sry i fixed this one right after posting it just forgot to update that but what of the first error

anyway to get random numbers in the tree file it wont allow anything with main.

main.rand.next
main.hardmode

so on
 
oh sry i fixed this one right after posting it just forgot to update that but what of the first error

anyway to get random numbers in the tree file it wont allow anything with main.

main.rand.next
main.hardmode

so on

Are you useing "main" or "Main"? As the capitalization matters. (also it should be "Next")
 
v0.8.3.5
-Updated to Terraria 1.3.3.3
-Added mod packs - ability to enable/disable groups of mods at once
-Added ability to search mod browser by author
-Added ModifyInterfaceLayers hook
-DrawLayers can now modify the DrawInfo parameter
-Added whoAmI parameter to world-drawing hooks for items
-Made Main._drawInterfaceGameTime public
-Fixed bug where custom tile kill check uses liquid placement check
-Added modpath option for dedicated server command line
-Minor fixes and improvements

Note that if you're using the PreDrawInWorld or PostDrawInWorld hook for ModItem or GlobalItem, you will have to update your mod.

Enjoy!

Edit: Also, I'm trying something new with this update. Downloads are hosted through Github instead of Mediafire. Hopefully this circumvents some problems with Mediafire some people have; also hopefully no new problems get created.
Hello bluemagic123. Thanks for the update. However, the most recent update has caused my playerLayers to be invisible. Here's one as an example.
Code:
public static readonly PlayerLayer NamahFaceLayer = new PlayerLayer("TDK", "NamahFaceLayer", PlayerLayer.Head, delegate(PlayerDrawInfo drawInfo)
        {
            Player drawPlayer = drawInfo.drawPlayer;//shortcut to the player

            if (!drawPlayer.invis) //if the player isn't invisible -- add within range
            {
                //calculate position to draw the sprite at
                Vector2 drawPosition = new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2f) + (float)(drawPlayer.width / 2f))),
                    (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f + drawPlayer.gfxOffY - drawPlayer.mount.PlayerOffset)));
                //draw the sprite
                Main.playerDrawData.Add(new DrawData(TerrarianDreamkeepers.tNamahFace, drawPosition + drawPlayer.headPosition + drawInfo.headOrigin,
                    drawPlayer.bodyFrame, drawInfo.upperArmorColor, drawPlayer.headRotation, drawInfo.headOrigin, 1f, drawInfo.spriteEffects, 0));
                //draw the halo also
                Main.playerDrawData.Add(new DrawData(TerrarianDreamkeepers.tHalo, drawPosition + drawPlayer.headPosition + drawInfo.headOrigin - new Vector2(0, 8),
                    drawPlayer.bodyFrame, Color.FromNonPremultiplied(253, 203, 246, MPlayer.haloAlpha[drawPlayer.whoAmI]), drawPlayer.headRotation, drawInfo.headOrigin, 1f, drawInfo.spriteEffects, 0));
            }
        });
And here's how I've been adding them.
Code:
                    case 3: //If Namah
                        if (layers[i].Name == "Legs")
                        {
                            layers[i].visible = false;
                            layers.Insert(i + 1, NamahLegLayer);
                        }
                        if (layers[i].Name == "Body")
                        {
                            layers[i].visible = false;
                            layers.Insert(i + 1, NamahBodyLayer);
                        }
                        if (layers[i].Name == "Head")
                        {
                            layers[i].visible = false;
                            layers.Insert(i + 1, NamahFaceLayer);
                        }
                        if (layers[i].Name == "Arms")
                        {
                            layers[i].visible = false;
                            layers.Insert(i + 1, NamahArmLayer);
                        }
                        break;
Commenting out the line 'layers.visible = false;' causes my custom layer to reappear along with the vanilla layer. So do custom layers inherit the visibility of their parent layer? Is there a way to fix this? Also, I noticed that the Example Mod hasn't been updated. Is this coming soon?
 
Hello bluemagic123. Thanks for the update. However, the most recent update has caused my playerLayers to be invisible. Here's one as an example.
Code:
public static readonly PlayerLayer NamahFaceLayer = new PlayerLayer("TDK", "NamahFaceLayer", PlayerLayer.Head, delegate(PlayerDrawInfo drawInfo)
        {
            Player drawPlayer = drawInfo.drawPlayer;//shortcut to the player

            if (!drawPlayer.invis) //if the player isn't invisible -- add within range
            {
                //calculate position to draw the sprite at
                Vector2 drawPosition = new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2f) + (float)(drawPlayer.width / 2f))),
                    (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f + drawPlayer.gfxOffY - drawPlayer.mount.PlayerOffset)));
                //draw the sprite
                Main.playerDrawData.Add(new DrawData(TerrarianDreamkeepers.tNamahFace, drawPosition + drawPlayer.headPosition + drawInfo.headOrigin,
                    drawPlayer.bodyFrame, drawInfo.upperArmorColor, drawPlayer.headRotation, drawInfo.headOrigin, 1f, drawInfo.spriteEffects, 0));
                //draw the halo also
                Main.playerDrawData.Add(new DrawData(TerrarianDreamkeepers.tHalo, drawPosition + drawPlayer.headPosition + drawInfo.headOrigin - new Vector2(0, 8),
                    drawPlayer.bodyFrame, Color.FromNonPremultiplied(253, 203, 246, MPlayer.haloAlpha[drawPlayer.whoAmI]), drawPlayer.headRotation, drawInfo.headOrigin, 1f, drawInfo.spriteEffects, 0));
            }
        });
And here's how I've been adding them.
Code:
                    case 3: //If Namah
                        if (layers[i].Name == "Legs")
                        {
                            layers[i].visible = false;
                            layers.Insert(i + 1, NamahLegLayer);
                        }
                        if (layers[i].Name == "Body")
                        {
                            layers[i].visible = false;
                            layers.Insert(i + 1, NamahBodyLayer);
                        }
                        if (layers[i].Name == "Head")
                        {
                            layers[i].visible = false;
                            layers.Insert(i + 1, NamahFaceLayer);
                        }
                        if (layers[i].Name == "Arms")
                        {
                            layers[i].visible = false;
                            layers.Insert(i + 1, NamahArmLayer);
                        }
                        break;
Commenting out the line 'layers.visible = false;' causes my custom layer to reappear along with the vanilla layer. So do custom layers inherit the visibility of their parent layer? Is there a way to fix this? Also, I noticed that the Example Mod hasn't been updated. Is this coming soon?
Player layers do inherit the invisibility of their parent layer. Pretty much the entire point of parenting layers is to inherit invisibility, so you could just make your layers parent-less. I'm not sure why they were showing in earlier updates, that was probably some bug.

ExampleMod hasn't updated since as far as I know it hasn't been changed.
 
Are you useing "main" or "Main"? As the capitalization matters. (also it should be "Next")
did u not read the first post?
 
v0.8.3.5
-Updated to Terraria 1.3.3.3
-Added mod packs - ability to enable/disable groups of mods at once
-Added ability to search mod browser by author
-Added ModifyInterfaceLayers hook
-DrawLayers can now modify the DrawInfo parameter
-Added whoAmI parameter to world-drawing hooks for items
-Made Main._drawInterfaceGameTime public
-Fixed bug where custom tile kill check uses liquid placement check
-Added modpath option for dedicated server command line
-Minor fixes and improvements

Note that if you're using the PreDrawInWorld or PostDrawInWorld hook for ModItem or GlobalItem, you will have to update your mod.

Enjoy!

Edit: Also, I'm trying something new with this update. Downloads are hosted through Github instead of Mediafire. Hopefully this circumvents some problems with Mediafire some people have; also hopefully no new problems get created.
YESSSSSS!!!!
 
did u not read the first post?

so how can i get random stuff from trees like change some of the drops to something els

it wont allow main.rand.Next(0, 10)

error CS0103: The name 'Main' does not exist in the current context

why does it say this or is there some other way to get random numbers?


int f = main.rand.Next(0, 100);
if(f >= 0 && f <= 74)
{
return mod.ItemType("ITEM NAME");
}
else if(f >= 75 && f <= 99)
{
return mod.ItemType("ITEM NAME");
}


this also gives another error to

error CS0161: MODs NAME.Tiles.trees.ITEM NAME.DropWood ()': not all code paths return a value

Unless you manually typed all out that code out into your post, I am guessing you did not have "main" capitalized.. but regardless, do you have
Code:
using Terraria;
at the top of the file you are having a problem with?

Or if I completely missed your problem, I am sorry and have no clue
 
Unless you manually typed all out that code out into your post, I am guessing you did not have "main" capitalized.. but regardless, do you have
Code:
using Terraria;
at the top of the file you are having a problem with?

Or if I completely missed your problem, I am sorry and have no clue

well that worked but it runs the random number per game tick

is there a way for it to just run when the tree grows

the tree is blinking fast as it keeps running the numbers
 
bandicam 2016-10-14 12-17-00-557.jpg
bandicam 2016-10-14 12-17-00-758.jpg



public override Texture2D GetTexture()
{
int f = Main.rand.Next(0, 10);
if(f >= 0 && f <= 0)
{
return mod.GetTexture("Tiles/trees/loottree1");
}
else if(f >= 1 && f <= 1)
{
return mod.GetTexture("Tiles/trees/loottree2");
}
else if(f >= 2 && f <= 2)
{
return mod.GetTexture("Tiles/trees/loottree3");
}
else if(f >= 3 && f <= 3)
{
return mod.GetTexture("Tiles/trees/loottree4");
}
else if(f >= 4 && f <= 4)
{
return mod.GetTexture("Tiles/trees/loottree5");
}
else if(f >= 5 && f <= 5)
{
return mod.GetTexture("Tiles/trees/loottree6");
}
else if(f >= 6 && f <= 6)
{
return mod.GetTexture("Tiles/trees/loottree7");
}
else if(f >= 7 && f <= 7)
{
return mod.GetTexture("Tiles/trees/loottree8");
}
else if(f >= 8 && f <= 8)
{
return mod.GetTexture("Tiles/trees/loottree9");
}
else if(f >= 9 && f <= 9)
{
return mod.GetTexture("Tiles/trees/loottree910");
}
else //this is not used but is needed
{
return mod.GetTexture("Tiles/trees/loottree1");
}
}

as the 2 pictures show they are taken one after the other and the trees blink fast
(i think per game tick)

also i did not think it randomize per piece but it did

is there away to get this code to only run once when the tree grows
(tho this looks really cool)
 
Last edited:
View attachment 143903 View attachment 143902View attachment 143903


public override Texture2D GetTexture()
{
int f = Main.rand.Next(0, 10);
if(f >= 0 && f <= 0)
{
return mod.GetTexture("Tiles/trees/loottree1");
}
else if(f >= 1 && f <= 1)
{
return mod.GetTexture("Tiles/trees/loottree2");
}
else if(f >= 2 && f <= 2)
{
return mod.GetTexture("Tiles/trees/loottree3");
}
else if(f >= 3 && f <= 3)
{
return mod.GetTexture("Tiles/trees/loottree4");
}
else if(f >= 4 && f <= 4)
{
return mod.GetTexture("Tiles/trees/loottree5");
}
else if(f >= 5 && f <= 5)
{
return mod.GetTexture("Tiles/trees/loottree6");
}
else if(f >= 6 && f <= 6)
{
return mod.GetTexture("Tiles/trees/loottree7");
}
else if(f >= 7 && f <= 7)
{
return mod.GetTexture("Tiles/trees/loottree8");
}
else if(f >= 8 && f <= 8)
{
return mod.GetTexture("Tiles/trees/loottree9");
}
else if(f >= 9 && f <= 9)
{
return mod.GetTexture("Tiles/trees/loottree910");
}
else //this is not used but is needed
{
return mod.GetTexture("Tiles/trees/loottree1");
}
}

as the 2 pictures show they are taken one after the other and the trees blink fast
(i think per game tick)

also i did not think it randomize per piece but it did

is there away to get this code to only run once when the tree grows
(tho this looks really cool)
First of all, don't do (f >= 0 && f <= 0), just do (f == 0). It's less confusing and (marginally) faster on your CPU.

Secondly, depending on how your tilesheets looks, you could create a field in the ModTree class and then assign it a random value in the constructor, then use that value in the GetTexture method. If your tilesheet uses different colours for different tiles, that should work out.
 
First of all, don't do (f >= 0 && f <= 0), just do (f == 0). It's less confusing and (marginally) faster on your CPU.

Secondly, depending on how your tilesheets looks, you could create a field in the ModTree class and then assign it a random value in the constructor, then use that value in the GetTexture method. If your tilesheet uses different colours for different tiles, that should work out.

well the numbers i use is not ment to be these but i se copy paste and this is just a test
i plan on useing 0-74 and 75-99 for the real use


loottree1.png loottree2.png

these are the pictures (10 of them) really simple just the same thing with another color

also i dont know how to do code with out some example code

sry dont do much codeing i do mostly copy pasteing but with just that i do get far
 
Back
Top Bottom