tModLoader Official tModLoader Help Thread

does the name have to have .png? i think i saw what i did wronf
[doublepost=1484485829,1484485632][/doublepost]
According to this error, you're missing a texture file at "rglmod/Items" with the name "Aetherblade.png". If you do have a texture at that given location, double check your spelling.
so what you said did work. now i need to do a lot of debugging. at least one damn problems off my chest. thanks mate.
btw if ur interested this is the log.

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(25,39) : error CS1514: { expected

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(25,39) : error CS1519: Invalid token ';' in class, struct, or interface member declaration

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(41,9) : error CS1519: Invalid token '{' in class, struct, or interface member declaration

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(43,33) : error CS1519: Invalid token '(' in class, struct, or interface member declaration

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(43,50) : error CS1519: Invalid token ')' in class, struct, or interface member declaration

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(44,29) : error CS1519: Invalid token '(' in class, struct, or interface member declaration

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(45,29) : error CS1519: Invalid token '(' in class, struct, or interface member declaration

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(46,20) : error CS1519: Invalid token '=' in class, struct, or interface member declaration

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(46,26) : error CS1520: Method must have a return type

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(46,39) : error CS1001: Identifier expected

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(47,34) : error CS1519: Invalid token '(' in class, struct, or interface member declaration

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(48,29) : error CS1519: Invalid token '(' in class, struct, or interface member declaration

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(49,29) : error CS1519: Invalid token '(' in class, struct, or interface member declaration

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(52,1) : error CS1022: Type or namespace definition, or end-of-file expected
 
oh dear. another bug i dont understand. everything else i fixed. just this...

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(28,29) : error CS1519: Invalid token '(' in class, struct, or interface member declaration
 
I want to make a custom Buff but i dont know the list of player stats i a few like player.statLifeMax and player.statLife but i dont know the rest can someone tell me
 
I want to make a custom Buff but i dont know the list of player stats i a few like player.statLifeMax and player.statLife but i dont know the rest can someone tell me
Well, these are some I know:
player.meleeDamage
player.magicDamage
player.rangedDamage
player.thrownDamage
player.lifeRegen
player.moveSpeed
player.statDefense
 
oh dear. another bug i dont understand. everything else i fixed. just this...

c:\Users\Hafiz\Documents\My Games\Terraria\ModLoader\Mod Sources\rglmod\Items\aetherblade.cs(28,29) : error CS1519: Invalid token '(' in class, struct, or interface member declaration
Just do you know: all these errors are syntax related. Double check all your brackets (open and close).
I want to make a custom Buff but i dont know the list of player stats i a few like player.statLifeMax and player.statLife but i dont know the rest can someone tell me
If you could tell us what kind of buff you're trying to make, we could help you a bit more in detail.
Why am I being ignored!? NOTICE ME SENPAI!!!
A word beforehand: this is not critisism, just my view on the subject.
For your latest question, I think most people would assume that someone working with worm AI would know how to do something basic like making timers and spawning new NPCs. Also, you've shown us the tail code of your worm, while the head is the 'leader'(?).
 
Just do you know: all these errors are syntax related. Double check all your brackets (open and close).

If you could tell us what kind of buff you're trying to make, we could help you a bit more in detail.

A word beforehand: this is not critisism, just my view on the subject.
For your latest question, I think most people would assume that someone working with worm AI would know how to do something basic like making timers and spawning new NPCs. Also, you've shown us the tail code of your worm, while the head is the 'leader'(?).
I wanted to make the minions spawn where the tail is I guess? But I could get the head code if you want.
 
Just do you know: all these errors are syntax related. Double check all your brackets (open and close).

If you could tell us what kind of buff you're trying to make, we could help you a bit more in detail.

A word beforehand: this is not critisism, just my view on the subject.
For your latest question, I think most people would assume that someone working with worm AI would know how to do something basic like making timers and spawning new NPCs. Also, you've shown us the tail code of your worm, while the head is the 'leader'(?).
umm i dont really see the problem. if you do please tell me because im blind af.

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

namespace rglmod.Items
{
public class Aetherblade : ModItem {

public override void SetDefaults()
{
item.name = "Aetherblade";
item.magic = false;
item.useTime = 16;
item.useStyle = 5;
item.width = 16;
item.height = 16;
item.maxStack = 1;
Items.tooltip = "Starter weapon for the majority of Races.";
item.value = 100;
item.rare = 3;
}
public override void AddRecipes();

Modrecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock);
recipe.SetResult(this);
recipe.AddRecipe;
}
}
 
umm i dont really see the problem. if you do please tell me because im blind af.

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

namespace rglmod.Items
{
public class Aetherblade : ModItem {

public override void SetDefaults()
{
item.name = "Aetherblade";
item.magic = false;
item.useTime = 16;
item.useStyle = 5;
item.width = 16;
item.height = 16;
item.maxStack = 1;
Items.tooltip = "Starter weapon for the majority of Races.";
item.value = 100;
item.rare = 3;
}
public override void AddRecipes();

Modrecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock);
recipe.SetResult(this);
recipe.AddRecipe;
}
}
In such a case, I'd recommend formatting your code correctly. If you look at the following, you can immediately see where you've gone wrong:
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace rglmod.Items
{
    public class Aetherblade : ModItem 
    {
        public override void SetDefaults()
        {
            item.name = "Aetherblade";
            item.magic = false;
            item.useTime = 16;
            item.useStyle = 5;
            item.width = 16;
            item.height = 16;
            item.maxStack = 1;
            Items.tooltip = "Starter weapon for the majority of Races.";
            item.value = 100;
            item.rare = 3;
        }
       
        public override void AddRecipes();

        Modrecipe recipe = new ModRecipe(mod);
        recipe.AddIngredient(ItemID.DirtBlock);
        recipe.SetResult(this);
        recipe.AddRecipe;
    }
}
The AddRecipes method is not working correctly. First of all, you don't need the semicolon there and second, don't forget to open { and close } the method.
 
oh yeah. im :red:ing :red:ed. thanks man
In such a case, I'd recommend formatting your code correctly. If you look at the following, you can immediately see where you've gone wrong:
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace rglmod.Items
{
    public class Aetherblade : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Aetherblade";
            item.magic = false;
            item.useTime = 16;
            item.useStyle = 5;
            item.width = 16;
            item.height = 16;
            item.maxStack = 1;
            Items.tooltip = "Starter weapon for the majority of Races.";
            item.value = 100;
            item.rare = 3;
        }
      
        public override void AddRecipes();

        Modrecipe recipe = new ModRecipe(mod);
        recipe.AddIngredient(ItemID.DirtBlock);
        recipe.SetResult(this);
        recipe.AddRecipe;
    }
}
The AddRecipes method is not working correctly. First of all, you don't need the semicolon there and second, don't forget to open { and close } the method.
 
Iam lerning of how to make custom potions so iam recreating the lifesteal potion but the max health inscrese more than once and when the buff goes the max helth does not reverses heres my code please tell me whats worng with my code

Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace MyFirstMod.Buffs
{
    public class HP : ModBuff
    {
        public override void SetDefaults()
        {
            Main.buffNoTimeDisplay[Type] = false;
            Main.buffName[this.Type] = "More Health";
            Main.buffTip[this.Type] = "More Health";
        }
        public override void Update(Player player, ref int buffIndex)
        {                                             //
            player.AddBuff(mod.BuffType("Super Life Froce"), 1); //this is an example of how to add your own buff
            if (player.statLifeMax < 1000)
            {
               player.statLifeMax += (int)Math.Ceiling(player.statLifeMax * 0.2);
                if (player.statLifeMax > 1000)
                {
                    player.statLifeMax = 1000;
                }      
            }
            else
            {
                player.statLifeMax = 1000;
            }
        }
    }
}
 
Iam lerning of how to make custom potions so iam recreating the lifesteal potion but the max health inscrese more than once and when the buff goes the max helth does not reverses heres my code please tell me whats worng with my code

Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace MyFirstMod.Buffs
{
    public class HP : ModBuff
    {
        public override void SetDefaults()
        {
            Main.buffNoTimeDisplay[Type] = false;
            Main.buffName[this.Type] = "More Health";
            Main.buffTip[this.Type] = "More Health";
        }
        public override void Update(Player player, ref int buffIndex)
        {                                             //
            player.AddBuff(mod.BuffType("Super Life Froce"), 1); //this is an example of how to add your own buff
            if (player.statLifeMax < 1000)
            {
               player.statLifeMax += (int)Math.Ceiling(player.statLifeMax * 0.2);
                if (player.statLifeMax > 1000)
                {
                    player.statLifeMax = 1000;
                }     
            }
            else
            {
                player.statLifeMax = 1000;
            }
        }
    }
}
You're using statLifeMax, where you should probably be using statLifeMax2
You can try using that.
 
When are you gonna help me 'crack that nut' ( ͡° ͜ʖ ͡°)
Whenever you feel like it! :p
Allright, so lets start off with some (very simple) theory: To spawn an NPC every few seconds, we need a timer and we need to be able to spawn NPCs.
That's really all there is to it. For the timer we'll want to use an index of the npc.ai array. As we can see, ai[1] and ai[3] are already taken (since they're used in the AI).
So lets take npc.ai[0] and create a timer:
Code:
public override void AI()
{
    if(npc.ai[0]++ >= 120)
    {
        // Spawn NPC!
        npc.ai[0] = 0;
    }
    // Rest of the AI.
}
So here we have our timer. Terraria updates work with 'ticks'. Every second contains 60 ticks, meaning that (for example) 120 ticks equals 2 seconds or 180 3 seconds. From the if statement you can see that we've made a timer for 2 seconds. Then after we spawn the NPC, we reset npc.ai[0] (our timer) so that it starts at 0 again and counts to 120 ticks/2 seconds again.
For the spawn code, you'll want to use the NPC.NewNPC method. It looks something like this:
Code:
// Note that I've used placeholder variable names to act as parameters.
NPC.NewNPC(positionX, positionY, NPCType);
positionX represents the X position at which we want to spawn the new NPC. positionY the exact same as positionX but over the Y axis. NPCType is the type of NPC we want to spawn. So a filled method could look something like this:
Code:
NPC.NewNPC(npc.Center.X, npc.Center.Y, mod.NPCType("MyMinionWorm_Head"));
All lines together, the spawn sequence looks something like this:
Code:
public override void AI()
{
    if(npc.ai[0]++ >= 120)
    {
        // Spawn NPC!
        NPC.NewNPC(npc.Center.X, npc.Center.Y, mod.NPCType("MyMinionWorm_Head"));

        npc.ai[0] = 0;
    }
    // Rest of the AI.
}

Hope that helps you!
 
Whenever you feel like it! :p
Allright, so lets start off with some (very simple) theory: To spawn an NPC every few seconds, we need a timer and we need to be able to spawn NPCs.
That's really all there is to it. For the timer we'll want to use an index of the npc.ai array. As we can see, ai[1] and ai[3] are already taken (since they're used in the AI).
So lets take npc.ai[0] and create a timer:
Code:
public override void AI()
{
    if(npc.ai[0]++ >= 120)
    {
        // Spawn NPC!
        npc.ai[0] = 0;
    }
    // Rest of the AI.
}
So here we have our timer. Terraria updates work with 'ticks'. Every second contains 60 ticks, meaning that (for example) 120 ticks equals 2 seconds or 180 3 seconds. From the if statement you can see that we've made a timer for 2 seconds. Then after we spawn the NPC, we reset npc.ai[0] (our timer) so that it starts at 0 again and counts to 120 ticks/2 seconds again.
For the spawn code, you'll want to use the NPC.NewNPC method. It looks something like this:
Code:
// Note that I've used placeholder variable names to act as parameters.
NPC.NewNPC(positionX, positionY, NPCType);
positionX represents the X position at which we want to spawn the new NPC. positionY the exact same as positionX but over the Y axis. NPCType is the type of NPC we want to spawn. So a filled method could look something like this:
Code:
NPC.NewNPC(npc.Center.X, npc.Center.Y, mod.NPCType("MyMinionWorm_Head"));
All lines together, the spawn sequence looks something like this:
Code:
public override void AI()
{
    if(npc.ai[0]++ >= 120)
    {
        // Spawn NPC!
        NPC.NewNPC(npc.Center.X, npc.Center.Y, mod.NPCType("MyMinionWorm_Head"));

        npc.ai[0] = 0;
    }
    // Rest of the AI.
}

Hope that helps you!
Thank you! But every time I die, it doesn't despawn but the tail and some other segments at the end disappear, is there a way to make it instantly despawn, or stop making the end parts disappear?
 
Thank you! But every time I die, it doesn't despawn but the tail and some other segments at the end disappear, is there a way to make it instantly despawn, or stop making the end parts disappear?
Then you'll probably want to override this method to check whether or not the head is dead/inactive:
Code:
public override bool CheckActive()
{
    if(Main.npc[npc.ai[3]].active) return false;
    return true;
}
That should work. No other way to know than to test it out!
 
Back
Top Bottom