Standalone [1.3] tModLoader - A Modding API

Um okay, new problem, (I took the other thing out of the mod so I could test something else and I went longer without an error than last time!)
So basically whenever I use my modded throwing weapon it shoots out overpowered shurikens... no clue why... oh also the shurikens drop too which makes no sense since I never even programmed that in, I'm not even really using shuriken ai either which bother's me even more... My images are working for this one except for the projectile even though it should work just fine since I put the projectile image in so no clue there...
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Drom.Items.Weapons
{
public class NightKunai : ModItem
{
public override void SetDefaults()
{
item.name = "Nights Kunai";
item.damage = 34;
item.thrown = true;
item.width = 40;
item.height = 40;
item.useTime = 8;
item.autoReuse = true;
item.useAnimation = 15;
item.noMelee = true;
item.useStyle = 1;
item.maxStack = 1;
item.toolTip = "A True Ninjas Kunai";
item.knockBack = 1f;
item.value = Item.sellPrice(0, 1, 0, 0);
item.rare = 8;
item.shoot = mod.ProjectileType("NightKunai");
item.shoot = 3;
item.shootSpeed = 9;
item.noUseGraphic = true;

}

public override void AddRecipes()
{
NightKunaiRecipe recipe = new NightKunaiRecipe(mod);
recipe.AddIngredient(ItemID.Shuriken);
recipe.AddIngredient(ItemID.Flamarang);
recipe.AddIngredient(ItemID.SpikyBall);
recipe.AddIngredient(ItemID.Bone);
recipe.AddTile(TileID.Anvils);
recipe.SetResult(this, 1);
recipe.AddRecipe();
}
}

public class NightKunaiRecipe : ModRecipe
{
public NightKunaiRecipe(Mod mod) : base(mod)
{

}

}
}

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Drom.Projectiles
{
public class NightKunai : ModProjectile
{
public override void SetDefaults()
{
projectile.name = "NightKunai";
projectile.width = 40;
projectile.height = 40;
projectile.alpha = 255;
projectile.friendly = true;
projectile.tileCollide = true;
projectile.ignoreWater = true;
projectile.thrown = true;
projectile.aiStyle = 27;
projectile.penetrate = 7;
projectile.light = 0.5f;
}
}
}

And finally folder structure as well as a few photos of what the heck is happening(Also no clue where the little white barrier thing came from, must be from one of the mods I have installed):
3.jpg

4.jpg

5.jpg

6.jpg

7.jpg

8.jpg
 
hi, how can i get my npc to produce light? i have copied and pasted the code out of your exampleMod but it still won't work! i have even switched the 0.1f 0.7 0.1f
to 1000000000f 10000000000f 10000000000f and STILL no light! not even one bit!
Could you please post the entire code?
oh, and HOW CAN I GET THIS STUPID THING TOO STOP MERGING!?
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.
 
Im getting this error in now,

c:\Users\James Turlan\Documents\My Games\Terraria\ModLoader\Mod Sources\GameofThrones\GameofThrones.cs(17,30) : error CS0115: 'GameofThrones.GameofThrones.SetModInfo(out string, ref Terraria.ModLoader.ModProperties)': no suitable method found to override
[doublepost=1467730837,1467730772][/doublepost]This is the code please help, this is the mod build btw.

using System;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using GameofThrones.Items;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using System.Linq;
using System.IO;

namespace GameofThrones
{
public class GameofThrones: Mod
{
public override void SetModInfo(out string name, ref ModProperties properties)
{
name = "Game of Thrones";
properties.Autoload = true;
properties.AutoloadGores = true;
properties.AutoloadSounds = true;
}

}
}
 
Im getting this error in now,

c:\Users\James Turlan\Documents\My Games\Terraria\ModLoader\Mod Sources\GameofThrones\GameofThrones.cs(17,30) : error CS0115: 'GameofThrones.GameofThrones.SetModInfo(out string, ref Terraria.ModLoader.ModProperties)': no suitable method found to override
That is because the SetModInfo method is obsolete. Remove that method and use the following instead:
Code:
public GameofThrones()
{
    Properties = new ModProperties()
    {
        Autoload = true,
        AutoloadGores = true,
        AutoloadSounds = true
    };
}
 
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 :guideconfused:
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
 
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 ?
 
Back
Top Bottom