Standalone [1.3] tModLoader - A Modding API

Dan Yami

Empress of Light
:red: i wanna add a Picture of some items from my mod into my signature but the only thing it says is "URL",
why??? where can i upload a picture??
 

Snrasha

Terrarian
Terraria forum have this problem, i have not idea why, but already: Do not post this question off topic . Post in good topic ^^.

After, you need use upload a file in a topic for that. (then take the url)
 

Dan Yami

Empress of Light
pls look at this:

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

namespace SacredTools.Projectiles
{

    public class MoonBeam : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Moon Beam";  //projectile name
            projectile.width = 20;       //projectile width
            projectile.height = 28;  //projectile height
            projectile.friendly = true;      //make that the projectile will not damage you
            projectile.melee = true;         //
            projectile.tileCollide = true;   //make that the projectile will be destroed if it hits the terrain
            projectile.penetrate = 5;      //how many npc will penetrate
            projectile.timeLeft = 200;   //how many time this projectile has before disepire
            projectile.light = 0.75f;    // projectile light
            projectile.extraUpdates = 1;
            projectile.ignoreWater = true;  
        }
        public override void AI()           //this make that the projectile will face the corect way
        {                                                           // |
            projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
            projectile.velocity.Y += projectile.ai[0];
    
    
            if (projectile.localAI[0] == 0f)
            {
                Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20);
                projectile.localAI[0] = 1f;
            }
            int num666 = 8;
            Color color = new Color(36, 158, 184);
            int rand = Main.rand.Next(4);
            switch (rand)
            {
                case 0:
                color = new Color(255, 135, 0);
                break;
                case 1:
                color = new Color(255, 0, 248);
                break;
                case 2:
                color = new Color(28, 201, 132);
                break;
                case 3:
                color = new Color(9, 222, 255);
                break;
            }
            int num667 = Dust.NewDust(new Vector2(projectile.position.X + (float)num666 + 6, projectile.position.Y + (float)num666), projectile.width - num666 * 2, projectile.height - num666 * 2, 66, 0f, 0f, 0,color, 1.5f);  //projectile dust color
            Main.dust[num667].velocity *= 0.5f;
            Main.dust[num667].velocity += projectile.velocity * 0.1f;
            Main.dust[num667].noGravity = true;
            Main.dust[num667].noLight = false;
            Main.dust[num667].scale = 1.5f;
        }
           
           
       
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            target.AddBuff(mod.BuffType("MoonCurse"), 500);
            target.AddBuff(BuffID.Chilled, 500);
            target.AddBuff(BuffID.Frostburn, 500);
        }
       
        public override void Kill(int timeLeft)
        {
            for (int i = 4; i < 31; i++)
            {
                Color color = new Color(36, 158, 184);
                int rand = Main.rand.Next(4);
                switch (rand)
                {
                    case 0:
                    color = new Color(255, 135, 0);
                    break;
                    case 1:
                    color = new Color(255, 0, 248);
                    break;
                    case 2:
                    color = new Color(28, 201, 132);
                    break;
                    case 3:
                    color = new Color(9, 222, 255);
                    break;
                }
     
                float x = projectile.oldVelocity.X * (30f / i);
                float y = projectile.oldVelocity.Y * (30f / i);
                int newDust = Dust.NewDust(new Vector2(projectile.oldPosition.X - x, projectile.oldPosition.Y - y), 8, 8, 66, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, color, 1.8f);
                Main.dust[newDust].noGravity = true;
                Main.dust[newDust].velocity *= 0.5f;
                newDust = Dust.NewDust(new Vector2(projectile.oldPosition.X - x, projectile.oldPosition.Y - y), 8, 8, 66, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, color, 1.4f);
                Main.dust[newDust].velocity *= 0.05f;
                Main.dust[newDust].noGravity = true;
            }
        }
       
       
       
       
       
    }
}

wats wrong with it??
 

Snrasha

Terrarian
So, you cannot search a small? ><
If you have test just 1 or 2 times, you can find, so why? ><

This is probably that, your problem and the rectangle than i talk:
int num667 = Dust.NewDust(new Vector2(projectile.position.X + (float)num666 + 6, projectile.position.Y + (float)num666), projectile.width - num666 * 2, projectile.height - num666 * 2, 66, 0f, 0f, 0,color, 1.5f); //projectile dust color

If no, try, you can found alone, i think ^^.
 

DivermanSam

Empress of Light
Is there a way to reset or change the dialog that's already present within a town npc's chat box? Like if I was using button2 to cause an effect, I would need to have the dialog change to reflect what occurs.
 

Dan Yami

Empress of Light
hey, that thorium banner...
i haz 2 questions:
1: how did u get it there
2: is that green haired girl an npc or a hairstyle??
3: i have another question
4: thats no question
5: whatever, heres the last question: can we make custom hair with TmodLoader???
[doublepost=1468438809,1468438782][/doublepost]6: becus i can: is that golem on the left and right something legit in the Mod??
[doublepost=1468439008][/doublepost]7: i have sooo many questions:
wanna make a Crossover?? i add a reference to ur mod and u add something from me, or something like that, and, please teach me modding!
 

bropower125

Official Terrarian
yeah but what file would i move the character to?
There would be a folder with the exact same name in the tmodloader folder as there would be for the character folder for the base game.
18.jpg

19.jpg

See how they both have a players folder? Just port the character from one folder to the other
 

Snrasha

Terrarian
Is there a way to modify what the vanilla NPCs sell? I want my merchant to sell wood


Code:
    public class NPCloot : GlobalNPC
    {

        public override void SetupShop(int type, Chest shop, ref int nextSlot)
        {
            if (type == NPCID.Merchant)
            {
                // example condition.
                if (NPC.downedBoss1 && NPC.downedSlimeKing && NPC.downedQueenBee)
                {
                    shop.item[nextSlot].SetDefaults(ItemID.Wood); // Maybe not "Wood", ah ah.
                    nextSlot++;
                }
            }
            base.SetupShop(type, shop, ref nextSlot);
      }  }
If you have not idea here put that, go look example mod, he answer you.
 

anon567

Terrarian
Code:
    public class NPCloot : GlobalNPC
    {

        public override void SetupShop(int type, Chest shop, ref int nextSlot)
        {
            if (type == NPCID.Merchant)
            {
                // example condition.
                if (NPC.downedBoss1 && NPC.downedSlimeKing && NPC.downedQueenBee)
                {
                    shop.item[nextSlot].SetDefaults(ItemID.Wood (ot other));
                    nextSlot++;
                }
            }
            base.SetupShop(type, shop, ref nextSlot);
      }  }
If you have not idea here put that, go look example mod, he answer you.

Thanks
 

Solo-Ion

Dungeon Spirit
k... also, why does the dust from my projectile generate a few pixels offset from the impact point??
Probably because you are adding 6 to the horizontal position of the dust's spawn point.
int num667 = Dust.NewDust(new Vector2(projectile.position.X + (float)num666 + 6, projectile.position.Y + (float)num666), projectile.width - num666 * 2, projectile.height - num666 * 2, 66, 0f, 0f, 0,color, 1.5f); //projectile dust color
 
Top Bottom