tModLoader Official tModLoader Help Thread

My worm boss that i am trying to create seems to be separated into different segments that arent joined together. File:
 

Attachments

  • VoidLeviathan.zip
    9.8 KB · Views: 136
Ah I feel dumb for missing that. Thank you. The flickering is completely fixed now, it's a solid color all the time. Any idea how I would go about giving it the red glow? It's still a white projectile but in game when fired from the sword it glows in that nice red color.
Well, "Color(255, 255, 255, 200)" is basically a white, slightly transparent colour. The four numbers correspond to Red, Blue, Green and Alpha (transparency). If you want a reddish colour, you'd want to have the red value higher that the blue and green values. E.g. 255, 64, 64, 200.

How would I get my town NPC to say the name of another town NPC, for example, when the Demolitionist says: "Even [Name of Arms Dealer] wants what I'm selling!"
It's fairly simple. Just put something like the following in your NPC's GetChat hook.
Code:
if (NPC.AnyNPCs(NPCID.Merchant)) //if the merchant is found
{
    int merchantInd= NPC.FindFirstNPC(NPCID.Merchant); //Find the Merchant's Index
    return "I need to have a word with " + Main.npc[merchantInd].displayName + " about stuff.";
}
 
It's fairly simple. Just put something like the following in your NPC's GetChat hook.
Code:
if (NPC.AnyNPCs(NPCID.Merchant)) //if the merchant is found
{
    int merchantInd= NPC.FindFirstNPC(NPCID.Merchant); //Find the Merchant's Index
    return "I need to have a word with " + Main.npc[merchantInd].displayName + " about stuff.";
}
Ok, but how would I do that with this code?
Code:
        public override string GetChat()
        {
            switch (Main.rand.Next(3))
            {
                case 0:
                    return "Everyone else looks at me in a weird way, but [Name of Cyborg] seems to be fine with me.";
                case 1:
                    return "Hello.";
                default:
                    return "Why am I here?";
            }
        }
 
Ok, but how would I do that with this code?
Code:
        public override string GetChat()
        {
            switch (Main.rand.Next(3))
            {
                case 0:
                    return "Everyone else looks at me in a weird way, but [Name of Cyborg] seems to be fine with me.";
                case 1:
                    return "Hello.";
                default:
                    return "Why am I here?";
            }
        }
Just implement it into your own code like this:
Code:
public override string GetChat()
{
    switch (Main.rand.Next(3))
    {
        case 0:            
            int cyborgID= NPC.FindFirstNPC(NPCID.Cyborg);
            return "Everyone else looks at me in a weird way, but " + Main.npc[cyborgID].displayName +" seems to be fine with me.";
        case 1:
            return "Hello.";
        default:
            return "Why am I here?";
    }
}
 
I'm trying to make my projectile work as a beam. I have a method that works but doesn't work well. I was hoping for it to work similarly to the Last Prism but I just can't figure it out. If anyone could help it would be greatly appreciated. Here's the frankencode I have so far:

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

namespace KillGun.Projectiles
{

    public class IceBlast : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "IceBlast";
            projectile.width = 30;
            projectile.height = 30;
            projectile.friendly = true;
            projectile.tileCollide = false;
            projectile.penetrate = -1;
            projectile.timeLeft = 360;
            projectile.extraUpdates = 100;
            projectile.ignoreWater = true;
         
        }
        public override void AI()
        {
            projectile.localAI[0] += 1f;
            if (projectile.localAI[0] > 2f)
            {
                for (int num562 = 0; num562 < 3; num562++)
                {
                    projectile.alpha = 255;
                    int num563 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y - projectile.height/4), projectile.width + 4, projectile.height + 4, 15, 0f, 0f, 0, default(Color), 0.75f);
                    Main.dust[num563].scale = (float)Main.rand.Next(70, 110) * 0.013f;
                    Main.dust[num563].velocity *= 0.2f;
                    Main.dust[num563].noGravity = true;
                }
            }
        }
    }
}
 
I'm trying to make my projectile work as a beam. I have a method that works but doesn't work well. I was hoping for it to work similarly to the Last Prism but I just can't figure it out. If anyone could help it would be greatly appreciated. Here's the frankencode I have so far:

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

namespace KillGun.Projectiles
{

    public class IceBlast : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "IceBlast";
            projectile.width = 30;
            projectile.height = 30;
            projectile.friendly = true;
            projectile.tileCollide = false;
            projectile.penetrate = -1;
            projectile.timeLeft = 360;
            projectile.extraUpdates = 100;
            projectile.ignoreWater = true;
        
        }
        public override void AI()
        {
            projectile.localAI[0] += 1f;
            if (projectile.localAI[0] > 2f)
            {
                for (int num562 = 0; num562 < 3; num562++)
                {
                    projectile.alpha = 255;
                    int num563 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y - projectile.height/4), projectile.width + 4, projectile.height + 4, 15, 0f, 0f, 0, default(Color), 0.75f);
                    Main.dust[num563].scale = (float)Main.rand.Next(70, 110) * 0.013f;
                    Main.dust[num563].velocity *= 0.2f;
                    Main.dust[num563].noGravity = true;
                }
            }
        }
    }
}
Last Prism uses actual images, rather than dust to form the laser.
 
Probably this in the debuff file

Code:
public override void Update(Player player, ref int buffIndex)
  {
  player.statDefense = 0;
  }

It would probably need to be in Player.PostUpdate if you really want to do this.

Else it's just going to occur in the middle of a bunch of other defense modifications.
 
How to make a throwing weapon can be reforged at goblin tinkerer?
I'm making some mod focus on throwing class, however I can not pass this step. `:(
 
How to make a throwing weapon can be reforged at goblin tinkerer?
I'm making some mod focus on throwing class, however I can not pass this step. `:(
This will only work with a throwing weapon that isn't consumable, because you cannot reforge items that stack. You could makea throwing weapon that consumes ammo, but is still reforgable (like how bows and guns work)
 
can someone help me with my terraria it has mod loader and a few mods but for some reason i am getting 9 frames when i have more than enough power to get 60
 
I have a problem while trying to make a basic mod to add a worm boss with a summoner and a sword that it should drop.
The only errors i'm having that it admits are there are these:
c:\Users\Maxim\Documents\My Games\Terraria\ModLoader\Mod Sources\FirstMod\NPCs\BS\BSBody.cs(27,17) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundHit' and no extension method 'soundHit' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Maxim\Documents\My Games\Terraria\ModLoader\Mod Sources\FirstMod\NPCs\BS\BSHead.cs(30,17) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundHit' and no extension method 'soundHit' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Maxim\Documents\My Games\Terraria\ModLoader\Mod Sources\FirstMod\NPCs\BS\BSHead.cs(32,17) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundKilled' and no extension method 'soundKilled' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Maxim\Documents\My Games\Terraria\ModLoader\Mod Sources\FirstMod\NPCs\BS\BSHead.cs(37,25) : error CS1061: 'Terraria.ModLoader.Mod' does not contain a definition for 'GetMusicSlot' and no extension method 'GetMusicSlot' accepting a first argument of type 'Terraria.ModLoader.Mod' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Maxim\Documents\My Games\Terraria\ModLoader\Mod Sources\FirstMod\NPCs\BS\BSTail.cs(27,17) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundHit' and no extension method 'soundHit' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

after having multiple problems with a (Player player) thing going on with the summon item, and now this.
Can i get help at all, and sorry if this is annoying to see <.<
 
c:\Users\Maxim\Documents\My Games\Terraria\ModLoader\Mod Sources\FirstMod\NPCs\BS\BSHead.cs(32,17) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundKilled' and no extension method 'soundKilled' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Maxim\Documents\My Games\Terraria\ModLoader\Mod Sources\FirstMod\NPCs\BS\BSHead.cs(37,25) : error CS1061: 'Terraria.ModLoader.Mod' does not contain a definition for 'GetMusicSlot' and no extension method 'GetMusicSlot' accepting a first argument of type 'Terraria.ModLoader.Mod' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Maxim\Documents\My Games\Terraria\ModLoader\Mod Sources\FirstMod\NPCs\BS\BSTail.cs(27,17) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundHit' and no extension method 'soundHit' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)


It should be "HitSound" and "DeathSound". As for the music slot thing... I don't know anything about Terraria's music so I can't comment much but I don't think that's part of an NPC.
 
It should be "HitSound" and "DeathSound". As for the music slot thing... I don't know anything about Terraria's music so I can't comment much but I don't think that's part of an NPC.
Thanks, ill try that.
The temporary solution i got was turning those triggers off, making no deathsounds or hitsounds <.<
I donno where to put the music thing then, it works with them //'d off.
Another problem after getting everything to work was the Summon item not working.

Sticking in an edit: Boss also dosen't drop an item i specified to drop.

It says the boss spawns (albeit, not saying the name, just saying " has appeared!") but it never appears, i ended up using Cheat Sheet to spawn it and try it.
Just incase, code for that:
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace FirstMod.Items
{
public class MockupSkeleserpent : ModItem
{
public override void SetDefaults()

{
item.name = "Mockup Skeleserpent";

item.width = 40;

item.height = 40;

item.toolTip = "Looks like some kind of bad boss summoner...";

item.toolTip2 = "Summons Skeleserpent.";

item.useTime = 10;

item.useAnimation = 20;

item.useStyle = 4;

item.knockBack = 6;

item.value = 10000;

item.rare = 3;

item.UseSound = SoundID.Item29;

item.consumable = true;
item.autoReuse = false;

}

public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
texture = "FirstMod/Items/MockupSkeleserpent"; // This is an example
return true;
}

public override bool UseItem(Player player)
{
NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("BS"));
Main.PlaySound(15, (int)player.position.X, (int)player.position.Y, 0);
return true;
}

public override void AddRecipes()

{

ModRecipe recipe = new ModRecipe(mod);

recipe.AddIngredient("Wood", 1);
recipe.AddIngredient("Rope", 3);
recipe.AddIngredient("Soul of Flight", 3);

recipe.anyWood = true;
recipe.AddTile(TileID.WorkBenches);

recipe.SetResult("MockupSkeleserpent");

recipe.AddRecipe();
}
}
}
 
@GodzillaFightn
Next time you post code please do it inside a code tag, under the insert option where spoiler is also.

As for the code, I haven't worked on a multipart boss. I'd make sure that the head texture files are in place because I had some weirdness earlier due to that being missing. It may be some problem in the BS class rather than in the item.

Edit: re head textures, not textures for the head portion of the boss but the "_Head_Boss" textures used in the minimap.
 
Next time you post code please do it inside a code tag, under the insert option where spoiler is also.

As for the code, I haven't worked on a multipart boss. I'd make sure that the head texture files are in place because I had some weirdness earlier due to that being missing. It may be some problem in the BS class rather than in the item.

Edit: re head textures, not textures for the head portion of the boss but the "_Head_Boss" textures used in the minimap.

Its not a multipart, just a simple worm-style boss.
Also, the code tag thing, i didnt check Insert cuz i thought it would be its own icon...woops...
The _Head_Boss is there, and i just now made sure that all class-related new things in BSHead were turned to BS completely, instead of BSHead.
The Hitsound and Deathsound arent working, saying it cant convert to LegacySoundStyle when trying to Build.
 
Back
Top Bottom