tModLoader Official tModLoader Help Thread

Hmm I have an error and I can't find anything in the migration guide to help my code looks like this but I'll try something in a minute:
Code:
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace TheCrack.Items
{   [AutoloadEquip(EquipType.Wings)]
    public class LunarWings : ModItem
    {

        public override void SetDefaults()
        {
            item.name = "Lunar Wings";
            item.width = 22;
            item.height = 20;
            item.toolTip = "Very Stiff.";
            item.value = 10;
            item.rare = 2;
            item.accessory = true;
        }

        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.wingTimeMax = 45;  //wings Height
        }

        public override void VerticalWingSpeeds(ref float ascentWhenFalling, ref float ascentWhenRising,
            ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
        {
            ascentWhenFalling = 0.85f;
            ascentWhenRising = 0.25f;
            maxCanAscendMultiplier = 1f;
            maxAscentMultiplier = 3f;
            constantAscend = 0.135f;
        }

        public override void HorizontalWingSpeeds(ref float speed, ref float acceleration)
        {
            speed = 9f;
            acceleration *= 3f;
        }

        public override void AddRecipes()  //How to craft this item
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(mod.ItemType("LunarBar"), 10);   //you need 10 Wood
            recipe.AddTile(TileID.WorkBenches);   //at work bench
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
Errors:
c:\Users\aforsyth\Documents\My Games\Terraria\ModLoader\Mod Sources\TheCrack\Items\LunarWings.cs(27,30) : error CS0115: 'TheCrack.Items.LunarWings.VerticalWingSpeeds(ref float, ref float, ref float, ref float, ref float)': no suitable method found to override

c:\Users\aforsyth\Documents\My Games\Terraria\ModLoader\Mod Sources\TheCrack\Items\LunarWings.cs(37,30) : error CS0115: 'TheCrack.Items.LunarWings.HorizontalWingSpeeds(ref float, ref float)': no suitable method found to override
 
Hmm I have an error and I can't find anything in the migration guide to help my code looks like this but I'll try something in a minute:
Code:
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace TheCrack.Items
{   [AutoloadEquip(EquipType.Wings)]
    public class LunarWings : ModItem
    {

        public override void SetDefaults()
        {
            item.name = "Lunar Wings";
            item.width = 22;
            item.height = 20;
            item.toolTip = "Very Stiff.";
            item.value = 10;
            item.rare = 2;
            item.accessory = true;
        }

        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.wingTimeMax = 45;  //wings Height
        }

        public override void VerticalWingSpeeds(ref float ascentWhenFalling, ref float ascentWhenRising,
            ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
        {
            ascentWhenFalling = 0.85f;
            ascentWhenRising = 0.25f;
            maxCanAscendMultiplier = 1f;
            maxAscentMultiplier = 3f;
            constantAscend = 0.135f;
        }

        public override void HorizontalWingSpeeds(ref float speed, ref float acceleration)
        {
            speed = 9f;
            acceleration *= 3f;
        }

        public override void AddRecipes()  //How to craft this item
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(mod.ItemType("LunarBar"), 10);   //you need 10 Wood
            recipe.AddTile(TileID.WorkBenches);   //at work bench
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
The item.name be named now "DisplayName.SetDefault" and is now in "SetStaticDefault" see in this guide
 
Hmm I have an error and I can't find anything in the migration guide to help my code looks like this but I'll try something in a minute:
Code:
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace TheCrack.Items
{   [AutoloadEquip(EquipType.Wings)]
    public class LunarWings : ModItem
    {

        public override void SetDefaults()
        {
            item.name = "Lunar Wings";
            item.width = 22;
            item.height = 20;
            item.toolTip = "Very Stiff.";
            item.value = 10;
            item.rare = 2;
            item.accessory = true;
        }

        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.wingTimeMax = 45;  //wings Height
        }

        public override void VerticalWingSpeeds(ref float ascentWhenFalling, ref float ascentWhenRising,
            ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
        {
            ascentWhenFalling = 0.85f;
            ascentWhenRising = 0.25f;
            maxCanAscendMultiplier = 1f;
            maxAscentMultiplier = 3f;
            constantAscend = 0.135f;
        }

        public override void HorizontalWingSpeeds(ref float speed, ref float acceleration)
        {
            speed = 9f;
            acceleration *= 3f;
        }

        public override void AddRecipes()  //How to craft this item
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(mod.ItemType("LunarBar"), 10);   //you need 10 Wood
            recipe.AddTile(TileID.WorkBenches);   //at work bench
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
item.name and item.toolTip go under SetStaticDefault now, it would have to look like this:
Code:
    public override void SetStaticDefaults()
     {
       DisplayName.SetDefault("Lunar Wings");
       Tooltip.SetDefault("Very Stiff.");
     }

edit: damn, dennis beat me to it by a second :redmunch:
 
item.name and item.toolTip go under SetStaticDefault now, it would have to look like this:
Code:
    public override void SetStaticDefaults()
     {
       DisplayName.SetDefault("Lunar Wings");
       Tooltip.SetDefault("Very Stiff.");
     }

edit: damn, dennis beat me to it by a second :redmunch:
Well thanks for pointing that out. I knew it was to be fixed but I was focusing on Horizontal and Vertical wing speed IF YOU WOULD LOOK AT THE ERROR I GAVE then you would probaly know what I need help with. I'm focused on my mod even though I'm VERY YOUNG to be a coder. BUT I'M not telling how old. Less than 13 though.
 
Well thanks for pointing that out. I knew it was to be fixed but I was focusing on Horizontal and Vertical wing speed IF YOU WOULD LOOK AT THE ERROR I GAVE then you would probaly know what I need help with. I'm focused on my mod even though I'm VERY YOUNG to be a coder. BUT I'M not telling how old. Less than 13 though.
Well, after comparing your code to the ExampleWIngs.cs, you seem to be missing the "Player player" in your line.
Try adding it in like in the example:
Code:
public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising,
ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
{
ascentWhenFalling = 0.85f;
ascentWhenRising = 0.15f;
maxCanAscendMultiplier = 1f;
maxAscentMultiplier = 3f;
constantAscend = 0.135f;
}
public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration)
{
speed = 9f;
acceleration *= 2.5f;
}

I've never made wings myself, though, I wouldn't know if it works.
 
Well, after comparing your code to the ExampleWIngs.cs, you seem to be missing the "Player player" in your line.
Try adding it in like in the example:
Code:
public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising,
ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
{
ascentWhenFalling = 0.85f;
ascentWhenRising = 0.15f;
maxCanAscendMultiplier = 1f;
maxAscentMultiplier = 3f;
constantAscend = 0.135f;
}
public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration)
{
speed = 9f;
acceleration *= 2.5f;
}

I've never made wings myself, though, I wouldn't know if it works.
No its something 0.10 related because It worked pre 0.10
 
If you use tmodloader 0.10 you must write this
Code:
[AutoloadEquip(EquipType.Head)]
public class AbominationMask : ModItem
instead of
Code:
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
    equips.Add(EquipType.Head);
    return true;
You can see in this Guide

For Projectles with fire debuff you can extract my mod the Molten Drill and Jackhamsroom have one

Thank you, now my shield works! I'm quite happy now. I didn't see that guide when I was out searching for any guide I could find, so I've got that in another window for as long as I'm learning. Now I just need to learn how to add buffs and all that.

For extracting the mod, how would I go about doing that? I can't seem to find anything that says how to do that. I appreciate your permission to do so, but I don't know how.
 
Thank you, now my shield works! I'm quite happy now. I didn't see that guide when I was out searching for any guide I could find, so I've got that in another window for as long as I'm learning. Now I just need to learn how to add buffs and all that.

For extracting the mod, how would I go about doing that? I can't seem to find anything that says how to do that. I appreciate your permission to do so, but I don't know how.
Mods->More Info->Extract then look in Documents\My Games\Terraria\ModLoader\Mod Reader\[ModName] and read tModReader.txt to see what the author has allowed you to extract.
 
So I tried to make a spear that shoots a projectile (apart from the spear projectile), that shoots another projectile, but didn't really make any progress and played around a bit. Not knowing if it would do anything I just tried " item.shoot = mod.ProjectileType<Projectiles.partisan>() & mod.ProjectileType<Projectiles.probe>();", but then it got weird.
Instead of shooting any of the two, the spear exploded and shot a completely unrelated projectile from another mod and I have no idea how that could even happen. There's nothing in the code that would connect those two mods. :eek:

Um, so my question is: how can I make a spear shoot a second projectile/make the spear projectile shoot another projectile that doesn't just fall to the ground but acts more like a demon scythe, for example?
 
So I tried to make a spear that shoots a projectile (apart from the spear projectile), that shoots another projectile, but didn't really make any progress and played around a bit. Not knowing if it would do anything I just tried " item.shoot = mod.ProjectileType<Projectiles.partisan>() & mod.ProjectileType<Projectiles.probe>();", but then it got weird.
Instead of shooting any of the two, the spear exploded and shot a completely unrelated projectile from another mod and I have no idea how that could even happen. There's nothing in the code that would connect those two mods. :eek:

Um, so my question is: how can I make a spear shoot a second projectile/make the spear projectile shoot another projectile that doesn't just fall to the ground but acts more like a demon scythe, for example?

This is from my Jackhamshromm and his projectile not fall on the ground
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace BettertakeaPowerTool.Projectiles
{
    public class Jackhamshroom : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.CloneDefaults(ProjectileID.ChlorophyteJackhammer);
            Main.projFrames[projectile.type] = 4;
        }
              public override Color? GetAlpha(Color lightColor)
             {
            return Color.White;
              }
        private int shootCounter;
         public override void AI()
            {
            shootCounter++;
            if (shootCounter >= 24)
                    {
                shootCounter = 0;
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X/3, projectile.velocity.Y/3, 131, projectile.damage, 0f, projectile.owner, 0f, 0f);
                   }
                 projectile.frameCounter++;
                 if (projectile.frameCounter >= 4.44444444444f)
                    {
                projectile.frameCounter = 0;
                     projectile.frame = (projectile.frame + 1) % 4;
                   }
             }
    }
}
 
Back
Top Bottom