tModLoader Official tModLoader Help Thread

It show me another error :p

http://hastebin.com/emuweqewaw.coffee

(logs)

c:\Users\MiHP\Documents\My Games\Terraria\ModLoader\Mod Sources\XtrafaMod\MyPlayer.cs(7,55) : error CS0246: No se puede encontrar el tipo o el nombre de espacio de nombres 'Item' (¿falta una directiva using o una referencia de ensamblado?)

c:\Users\MiHP\Documents\My Games\Terraria\ModLoader\Mod Sources\XtrafaMod\MyPlayer.cs(7,49) : error CS0246: No se puede encontrar el tipo o el nombre de espacio de nombres 'IList' (¿falta una directiva using o una referencia de ensamblado?)

I think you have to insert "using Terraria;" too
 
c: \ Users \ MIHP \ Documents \ My Games \ Terraria \ ModLoader \ Mod Sources \ XtrafaMod \ MyPlayer.cs ( 8,49 ) : error CS0246 : Can not find the type or namespace name ' IList ' ( Is there a using directive or an assembly reference missing? )
 
For example:
Code:
if (Main.rand.Next(5) == 1)
you have 1/5 (20%) chance
[doublepost=1473112257,1473112140][/doublepost]
c: \ Users \ MIHP \ Documents \ My Games \ Terraria \ ModLoader \ Mod Sources \ XtrafaMod \ MyPlayer.cs ( 8,49 ) : error CS0246 : Can not find the type or namespace name ' IList ' ( Is there a using directive or an assembly reference missing? )

Have you added:
Code:
using Terraria.DataStructures;
?
 
c: \ Users \ MIHP \ Documents \ My Games \ Terraria \ ModLoader \ Mod Sources \ XtrafaMod \ MyPlayer.cs ( 8,49 ) : error CS0246 : Can not find the type or namespace name ' IList ' ( Is there a using directive or an assembly reference missing? )
Add this to the top of your code.
Code:
using System.Collections;
 
c: \ Users \ MIHP \ Documents \ My Games \ Terraria \ ModLoader \ Mod Sources \ XtrafaMod \ MyPlayer.cs ( 9,49 ) : error CS0308 : The type ' System.Collections.IList ' no generic can not be used with arguments type
 
It works now! so much thanks guys! :D
upload_2016-9-6_0-1-1.png
 
Oh, he's using IList<T>? In that case, yes, he should use .Generic.

Would have been useful if that was mentioned in the error, though.
Actually it was :p :
c: \ Users \ MIHP \ Documents \ My Games \ Terraria \ ModLoader \ Mod Sources \ XtrafaMod \ MyPlayer.cs ( 9,49 ) : error CS0308 : The type ' System.Collections.IList ' no generic can not be used with arguments type
 
Actually it was :p :

Only after adding System.Collections, which was in response to this:
Code:
c: \ Users \ MIHP \ Documents \ My Games \ Terraria \ ModLoader \ Mod Sources \ XtrafaMod \ MyPlayer.cs ( 8,49 ) : error CS0246 : Can not find the type or namespace name ' IList ' ( Is there a using directive or an assembly reference missing? )
I didn't see the code, so I didn't know he was using generics. That's why I originally suggested to reference System.Collections, because that's where IList (without arguments) comes from.

Don't get me wrong, you are right, but what I said I only said because the error message was incomplete. :)
 
Okay, so I have a question that may be more complex than I think... I'm trying to change the World size labels, by replacing the old ones (not really nessesary whatsoever, I'm trying to do it out of boredom and because getting into coding seems fun) and so far I got this:

Code:
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Map;
using Terraria.ModLoader;


namespace CustomWorldTags
{
    public class CustomWorldTags : Mod
    {
        public int WorldSizeX;

        public int WorldSizeY;

        public string _worldSizeName;

        public CustomWorldTags()
        {
            Properties = new ModProperties();
        }

        public void SetWorldSize(int x, int y)
        {
            this.WorldSizeX = x;
            this.WorldSizeY = y;
            if (x >= 0 && x < 4200)
            {
                this._worldSizeName = "Small";
                return;
            }
            if (x >= 4200 && x < 8400)
            {
                this._worldSizeName = "Medium";
                return;
            }
            if (x >= 8400 && x < 12600)
            {
                this._worldSizeName = "Large";
                return;
            }
            if (x >= 12600 && x < 16800)
            {
                this._worldSizeName = "Huge";
                return;
            }
            if (x >= 16800)
            {
                this._worldSizeName = "Colossal";
                return;
            }
        }
    }
}

On the bright side, it compiles just fine. On the bad side, it literally doesn't do anything :/ what can I do? Since there's no error log to check I can't figure out what I'm doing wrong

Again, this is just a low priority, for-fun thing I'm trying t do, so if it's too complex just tell me.
 
Okay, so I have a question that may be more complex than I think... I'm trying to change the World size labels, by replacing the old ones (not really nessesary whatsoever, I'm trying to do it out of boredom and because getting into coding seems fun) and so far I got this:

Code:
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Map;
using Terraria.ModLoader;


namespace CustomWorldTags
{
    public class CustomWorldTags : Mod
    {
        public int WorldSizeX;

        public int WorldSizeY;

        public string _worldSizeName;

        public CustomWorldTags()
        {
            Properties = new ModProperties();
        }

        public void SetWorldSize(int x, int y)
        {
            this.WorldSizeX = x;
            this.WorldSizeY = y;
            if (x >= 0 && x < 4200)
            {
                this._worldSizeName = "Small";
                return;
            }
            if (x >= 4200 && x < 8400)
            {
                this._worldSizeName = "Medium";
                return;
            }
            if (x >= 8400 && x < 12600)
            {
                this._worldSizeName = "Large";
                return;
            }
            if (x >= 12600 && x < 16800)
            {
                this._worldSizeName = "Huge";
                return;
            }
            if (x >= 16800)
            {
                this._worldSizeName = "Colossal";
                return;
            }
        }
    }
}

On the bright side, it compiles just fine. On the bad side, it literally doesn't do anything :/ what can I do? Since there's no error log to check I can't figure out what I'm doing wrong

Again, this is just a low priority, for-fun thing I'm trying t do, so if it's too complex just tell me.
The labels are determined in code right where it displays it, there are no hooks so no way to change them.
 
Am I doing this right? This is for very early prehardmode wings I am trying to make. (My old Makeshift Wings from tAPI)

Code:
using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;

namespace TerraWingsMod.Items
{
   public class MakeshiftWings : ModItem
   {
     public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
     {
       equips.Add(EquipType.Wings);
       return true;
     }

     public override void SetDefaults()
     {
       item.name = "Makeshift Wings";
       item.width = 22;
       item.height = 36;
       item.toolTip = "Allows minor flight and slow fall.";
       item.toolTip2 = "Macgyver would be proud.";
       item.value = 20;
       item.rare = 0;
       item.accessory = true;
     }
     public override void UpdateAccessory(Player player, bool hideVisual)
     {
       player.wingTimeMax = 25;
     }

     public override void VerticalWingSpeeds(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(ref float speed, ref float acceleration)
     {
       speed = 1f;
       acceleration *= 1.0f;
     }

     public override void AddRecipes()
     {
       ModRecipe recipe = new ModRecipe(mod);
       recipe.AddIngredient(null, "Umbrella", 1);
       recipe.AddIngredient(null, "RocketBoots", 1);
       recipe.AddTile(TileID.TinkerersWorkshop);
       recipe.SetResult(this);
       recipe.AddRecipe();
     }
   }
}

I am trying to make my own prehardmode wings mod, and one of the wings will be my old makeshift wings.

Most of the wings I want to make will be crafted, but one set I want to drop from Queen Bee (with a 15% chance), I am sure once I read around the tutorial pages enough that I will eventually figure out how to add custom drops to vanilla bosses, but if anyone wants to help me speed that process up go ahead.
Actually I think I would much rather make the wings craftable instead of a boss drop, make the player do more then just fight a boss.
 
Last edited:
Back
Top Bottom