tModLoader Official tModLoader Help Thread

Why does it say "No suitable method to compile"?

public override void UpdateArmorSet (Player player, string set, ref bool longTrail, ref bool smallPuls, ref bool smallPulse, ref bool largePulse, ref bool shortTrail)
{
longTrail = true;
shortTrail = true;
smallPulse = true;
largePulse = true;
}

You are overriding a virtual method, which means you have to exactly copy the signature of the virtual method. You can't add your own parameters. Remove everything after Player player.
 
You are overriding a virtual method, which means you have to exactly copy the signature of the virtual method. You can't add your own parameters. Remove everything after Player player.
I tried that and it said "longtrail cannot be foun in the current content"
:/
 
This is normal, where you have find your longtrail? What is this?
When I was looking around for an effect that gives the shadow armor after effect thing, I found this:
https://github.com/bluemagic123/tModLoader/wiki/ModItem
scroll down and you'll find it. From what I understood, this is a special effect on armors. don't know how to use it though, I tries public virtual void instead of override and nothing happened.
also found it here:
http://forums.terraria.org/index.php?threads/1-3-tmodloader-a-modding-api.23726/page-214
 
When I was looking around for an effect that gives the shadow armor after effect thing, I found this:
https://github.com/bluemagic123/tModLoader/wiki/ModItem
scroll down and you'll find it. From what I understood, this is a special effect on armors. don't know how to use it though, I tries public virtual void instead of override and nothing happened.
also found it here:
http://forums.terraria.org/index.php?threads/1-3-tmodloader-a-modding-api.23726/page-214

To give the shadow armor effect just do this (in your armor helm file):
Code:
public override void ArmorSetShadows(Player player, ref bool longTrail, ref bool smallPulse, ref bool largePulse, ref bool shortTrail)
{
smallPulse = true;
shortTrail = true;
}

If you want an armor to emit dust like the shadow armor you will have to do something different I'm sure.
 
To give the shadow armor effect just do this (in your armor helm file):
public override void ArmorSetShadows(Player player, ref bool longTrail, ref bool smallPulse, ref bool largePulse, ref bool shortTrail)
{
smallPulse = true;
shortTrail = true;
}
Is it also possible to put it in the setbonus?
 
Is it also possible to put it in the setbonus?

You have to have the full set equipped for this method to work. That's why it's called "ArmorSETShadows" I'm pretty sure ;)

Putting it in the set bonus wouldn't work and it would be redundant anyway.
 
Does anyone know if there is an 'easy' way to make a biome background active while an NPC is active? I'm trying to make the Nebula Tower background appear while my Devourer of Gods is active.
 
Does anyone know if there is an 'easy' way to make a biome background active while an NPC is active? I'm trying to make the Nebula Tower background appear while my Devourer of Gods is active.
I have not idea how change biome background(with always a sun who move, etc), but i can send you the small code for put a picture behind your character.
But this is probably not than you want, ah ah, sorry x)
Click to this capture. Spoiler and image are bugged sometimes...
 

Attachments

  • Capture 2016-06-27 00_31_27.png
    Capture 2016-06-27 00_31_27.png
    250.2 KB · Views: 164
Last edited:
Okay, I figured out the biome background while an NPC is active but now I have a new problem.

I tried to get my ore to generate upon a vanilla boss down but it didn't work. Here's the code in the ModWorld file:

Code:
public override void PostWorldGen()
{
if (NPC.downedGolemBoss)
{
if (uelibloomSpawns < 3)
{
Main.NewText("New pockets of ore have been energized in the underground jungle!", Color.Lime.R, Color.Lime.G, Color.Lime.B);
uelibloomSpawns += 1;
for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 11E-05); k++)
{
int x = Main.maxTilesX;
int y = Main.maxTilesY;
if (Main.tile[x, y].type == TileID.Mud)
{
int i2 = WorldGen.genRand.Next(0, x);
int j2 = WorldGen.genRand.Next((int)(y * .4f), (int)(y * .8f));
WorldGen.OreRunner(i2, j2, (double)WorldGen.genRand.Next(3, 4), WorldGen.genRand.Next(3, 8), (ushort)mod.TileType("UelibloomOre"));
}
}
}
}
}
 
Okay, I figured out the biome background while an NPC is active but now I have a new problem.

I tried to get my ore to generate upon a vanilla boss down but it didn't work. Here's the code in the ModWorld file:

Code:
public override void PostWorldGen()
{
if (NPC.downedGolemBoss)
{
if (uelibloomSpawns < 3)
{
Main.NewText("New pockets of ore have been energized in the underground jungle!", Color.Lime.R, Color.Lime.G, Color.Lime.B);
uelibloomSpawns += 1;
for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 11E-05); k++)
{
int x = Main.maxTilesX;
int y = Main.maxTilesY;
if (Main.tile[x, y].type == TileID.Mud)
{
int i2 = WorldGen.genRand.Next(0, x);
int j2 = WorldGen.genRand.Next((int)(y * .4f), (int)(y * .8f));
WorldGen.OreRunner(i2, j2, (double)WorldGen.genRand.Next(3, 4), WorldGen.genRand.Next(3, 8), (ushort)mod.TileType("UelibloomOre"));
}
}
}
}
}
You have to do that in NPCLoot. PostWorldGen is only called during world gen, so Golem is most definitely not Downed yet.
 
You have to do that in NPCLoot. PostWorldGen is only called during world gen, so Golem is most definitely not Downed yet.

Ah, that makes a lot more sense. Thank you :)

I'll probably just move it to my Devourer boss for now since it can't be mined until after the Golem anyway, and my upcoming boss isn't ready yet anyway.
 
New
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