Standalone [1.3] tModLoader - A Modding API

How can i generate ore more frequently, or even generate it by smashing an alter ? I can gererate ore but its only at chest levels so pretty scattered and not much ore ?
 
ok guys i havge a problem, i downloaded some mods from the tmodloader broweser but whenever i try to make a new world it gets stuck on the generating structures part

Heres my mods:
Bluemagic
Cheatsheet
Cheatsheet Extended
EasyTerraria
EnenemyMods
Heros Mod
Schwifty
Thorium mod

my version of tmodloader is
v.0.8.1.2

i downloaded the older version because the newest one wouldint work
 
ok guys i havge a problem, i downloaded some mods from the tmodloader broweser but whenever i try to make a new world it gets stuck on the generating structures part

Heres my mods:
Bluemagic
Cheatsheet
Cheatsheet Extended
EasyTerraria
EnenemyMods
Heros Mod
Schwifty
Thorium mod

my version of tmodloader is
v.0.8.1.2

i downloaded the older version because the newest one wouldint work
AFAIK, Bluemagic, Cheatsheet, Cheatsheet Extended and EnemyMods don't touch WorldGen. I doubt Hero's Mod does either. Bluemagic's mod saves a few pieces of info through ModWorld, and that should be it. You should honestly disable each mod one by one to find out which is causing the issue. It could also be multiple mods working against each other causing the issue.
[doublepost=1467738760,1467738657][/doublepost]
Yes, you are right. But there is no such melee attack speed value.
I believe player.meleeSpeed is a thing, at least something along those lines.
[doublepost=1467738794][/doublepost]
Verify your game cache through Steam.
Or just run the backup file.
[doublepost=1467738937][/doublepost]
Tmodloader is saying it cant find a place to install to, what do i do?
Did you make sure to unpack the files from the zip archive first?
If it still doesn't work, you can just copy all files and folders into C:\Program Files (x86)\Steam\steamapps\common\Terraria and overwrite when needed.
 
How can i generate ore more frequently, or even generate it by smashing an alter ? I can gererate ore but its only at chest levels so pretty scattered and not much ore ?
 
Could you please post the entire code?
You can't, that feature exists to prevent double posts (which are against the rules). If you want to avoid it, edit your post instead of making a new one.


the entire code is:

Code:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace kifsMod.NPCs
{
    public class kif : ModNPC
    {
        public override bool Autoload(ref string name, ref string texture)
        {
            name = "kif";
            return mod.Properties.Autoload;
        }
        public override void SetDefaults()
        {
            npc.name = "Kif";
            npc.townNPC = true;
            npc.friendly = true;
            npc.width = 18;
            npc.height = 40;
            npc.aiStyle = 7;
            npc.damage = 10;
            npc.defense = 15;
            npc.lifeMax = 300;
            npc.soundHit = 1;
            npc.soundKilled = 1;
            npc.knockBackResist = 0.5f;
            Main.npcFrameCount[npc.type] = 26;          
            animationType = NPCID.Guide;
        }
        public override bool CanTownNPCSpawn(int numTownNPCs, int money)
        {
          
            return false;// this make that he will spawn when a house is available
        }



        public override string TownNPCName()
        {                                        //NPC names
            switch (WorldGen.genRand.Next(4))
            {
                case 0:
                    return "Kif";
                case 1:
                    return "Kif";
                case 2:
                    return "Kif";
                default:
                    return "Kif";
            }
        }




        public override string GetChat()
        {                                             //npc chat
        
            switch (Main.rand.Next(4))
            {
                case 0:
                    return "wha? sorry I waz daydreaming";
                case 1:
                    return "what's this stuff about me not paying the correct lighting bills? The lights are off all night! I Swear!";
                case 2:
                    return "they say every one has their price!";
                default:
                    return "why are you at my house? nevermind, you built it for me in the first place.";
            }
        }

        public override void SetChatButtons(ref string button, ref string button2)
        {
            button = Lang.inter[28];
        }

        public override void OnChatButtonClicked(bool firstButton, ref bool shop)
        {
            if (firstButton)
            {
                shop = true;
            }
        }

        public override void SetupShop(Chest shop, ref int nextSlot)
        {
            shop.item[nextSlot].SetDefaults(mod.ItemType("jello")); //items that he sells
            nextSlot++;
            shop.item[nextSlot].SetDefaults(mod.ItemType("flinger"));
            nextSlot++;
        }
      
        public virtual void DrawEffects(NPC npc, ref Color drawColor)
        {
          
            Lighting.AddLight(npc.position, 0.1f, 0.2f, 0.7f);
        }
      

    }
}

yes it is supposed to be a glowing town npc.
 
How can i generate ore more frequently, or even generate it by smashing an alter ? I can gererate ore but its only at chest levels so pretty scattered and not much ore ? and also what gen passes are there for example I'm using burried chests although can i use others ?
 
the entire code is:

Code:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace kifsMod.NPCs
{
    public class kif : ModNPC
    {
        public override bool Autoload(ref string name, ref string texture)
        {
            name = "kif";
            return mod.Properties.Autoload;
        }
        public override void SetDefaults()
        {
            npc.name = "Kif";
            npc.townNPC = true;
            npc.friendly = true;
            npc.width = 18;
            npc.height = 40;
            npc.aiStyle = 7;
            npc.damage = 10;
            npc.defense = 15;
            npc.lifeMax = 300;
            npc.soundHit = 1;
            npc.soundKilled = 1;
            npc.knockBackResist = 0.5f;
            Main.npcFrameCount[npc.type] = 26;         
            animationType = NPCID.Guide;
        }
        public override bool CanTownNPCSpawn(int numTownNPCs, int money)
        {
         
            return false;// this make that he will spawn when a house is available
        }



        public override string TownNPCName()
        {                                        //NPC names
            switch (WorldGen.genRand.Next(4))
            {
                case 0:
                    return "Kif";
                case 1:
                    return "Kif";
                case 2:
                    return "Kif";
                default:
                    return "Kif";
            }
        }




        public override string GetChat()
        {                                             //npc chat
       
            switch (Main.rand.Next(4))
            {
                case 0:
                    return "wha? sorry I waz daydreaming";
                case 1:
                    return "what's this stuff about me not paying the correct lighting bills? The lights are off all night! I Swear!";
                case 2:
                    return "they say every one has their price!";
                default:
                    return "why are you at my house? nevermind, you built it for me in the first place.";
            }
        }

        public override void SetChatButtons(ref string button, ref string button2)
        {
            button = Lang.inter[28];
        }

        public override void OnChatButtonClicked(bool firstButton, ref bool shop)
        {
            if (firstButton)
            {
                shop = true;
            }
        }

        public override void SetupShop(Chest shop, ref int nextSlot)
        {
            shop.item[nextSlot].SetDefaults(mod.ItemType("jello")); //items that he sells
            nextSlot++;
            shop.item[nextSlot].SetDefaults(mod.ItemType("flinger"));
            nextSlot++;
        }
     
        public virtual void DrawEffects(NPC npc, ref Color drawColor)
        {
         
            Lighting.AddLight(npc.position, 0.1f, 0.2f, 0.7f);
        }
     

    }
}

yes it is supposed to be a glowing town npc.

Change the virtual of DrawEffects to override.
 
Hey people! I trying to generate Grazin ore around the world , but see, it is just generating in isolated places
, not homogeneous.

I'm doing it through ModifyWorldGenTasks, here is the code:

Code:
public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
        {
            int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies"));
            if (ShiniesIndex != -1)
            {
                tasks.Insert(ShiniesIndex + 1, new PassLegacy("Grazodia Mod Ores", delegate (GenerationProgress progress)
                {
                    progress.Message = "Grazodia Mod Ores";

                    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(3, 6), mod.TileType("GrazinOreTile"), false, 0f, 0f, false, true);
                    }
                }));
            }
        }
 
Hey people! I trying to generate Grazin ore around the world , but see, it is just generating in isolated places
, not homogeneous.

I'm doing it through ModifyWorldGenTasks, here is the code:

Code:
public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
        {
            int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shinies"));
            if (ShiniesIndex != -1)
            {
                tasks.Insert(ShiniesIndex + 1, new PassLegacy("Grazodia Mod Ores", delegate (GenerationProgress progress)
                {
                    progress.Message = "Grazodia Mod Ores";

                    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(3, 6), mod.TileType("GrazinOreTile"), false, 0f, 0f, false, true);
                    }
                }));
            }
        }
I'm not sure what you actually want, but here is the code determining where to start the ore veins.
WorldGen.genRand.Next(0, Main.maxTilesX), WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY),

How can i generate ore more frequently, or even generate it by smashing an alter ? I can gererate ore but its only at chest levels so pretty scattered and not much ore ? and also what gen passes are there for example I'm using burried chests although can i use others ?
https://github.com/bluemagic123/tModLoader/wiki/Vanilla-World-Generation-Steps

If you want more, change the number of times you loop through the method: for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); k++)

Hopefully you understand "* 6E-05"
 
v0.1 is now uploaded. I had to rush through this since I'm leaving on vacation today, but it includes support for building and loading/reloading mods, adding recipes, and adding basic items. The main reason I put up an upload today is that thanks to my vacation, I will be unable to upload anything for an entire week. I will return on July 15, but hopefully I will be able to keep checking on here to see any feedback or bugs.

Also note that the next version will have a vastly improved interface. I will admit the current interface kind of sucks; that's what happens when I rush too much :confused:
PLS MAKE 0.8.2.1 PORTABLE WITH GOG PLS!
 
error CS1703: An assembly with the same identity 'Ionic.Zip.Reduced, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c' has already been imported. Try removing one of the duplicate references.
What I do
 
Forget About It, I search here the error and i fix it, tomorrow i'll begin with the mod, i only make a functional sword :happy::cool:
 
When i make a server my gmae crashes... HELP
 
I'm not sure what you actually want, but here is the code determining where to start the ore veins.
WorldGen.genRand.Next(0, Main.maxTilesX), WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY),


https://github.com/bluemagic123/tModLoader/wiki/Vanilla-World-Generation-Steps

If you want more, change the number of times you loop through the method: for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); k++)

Hopefully you understand "* 6E-05"

I don't really understand it ?, although i tried 10E-05 and it seems to spawn less so if i was to decrease the amount to 3E-05 would that make it more common ?
 
How can i make my modified ore generate around the world by smashing alters ? Never done it before if it works yet ? How would i write the code for this ?
 
I dont know how to use tmodreader.
First, I open tmodreader and nothing happen, just the loading mouse,
then i click to the mod and i choose tmodreader andthe same thing.
Plus, I have the mod files in the input folder but don't do a thing
What I can do to use it? :confused:
 
I have a bit of a problem that's probably just me being dopey with syntax. I'm trying to find the max stack of a vanilla item from within the ModWorld file using the item ID. So something like:
Code:
int MaxDirtStack = something(ItemID.DirtBlock).maxStack     // equals 999;

But I haven't been able to find anything that works correctly. Can anyone guide me in the right direction?
 
How can i make my modified ore generate around the world by smashing alters ? Never done it before if it works yet ? How would i write the code for this ?
 
Can someone help me to make your player spawn with certain items depending on their name. I tried an IF statement but it's just using the ELSE even when I have the name typed exactly the same :/
here is the code:

Code:
namespace ImmersionMod
{
    public class ImmersionModPlayer : ModPlayer
    {
        public override void SetupStartInventory(IList<Item> items)
        {
            if(player.name == "Consition")
            {
                Item item = new Item();
                item.SetDefaults(Terraria.ID.ItemID.Seaweed);
                items.Add(item);
            }
            else
            {
                Item item = new Item();
                item.SetDefaults(mod.ItemType("ThankYou"));
                items.Add(item);
            }
        }
    }
 
Back
Top Bottom