Standalone [1.3] tModLoader - A Modding API

Is there an onKill thing so when the boss dies another one spawns?
There's the NPCLoot hook which you can use:
Code:
public override void NPCLoot()
{
    // Spawn your other boss here using the NPC.NewNPC method.
}
Or you can use (and I'm not exactly sure when this is fired, so don't take my word on it) the CheckDead hook:
Code:
public override bool CheckDead()
{
    // Spawn your other boss here using the NPC.NewNPC method.
    return true;
}
 
There's the NPCLoot hook which you can use:
Code:
public override void NPCLoot()
{
    // Spawn your other boss here using the NPC.NewNPC method.
}
Or you can use (and I'm not exactly sure when this is fired, so don't take my word on it) the CheckDead hook:
Code:
public override bool CheckDead()
{
    // Spawn your other boss here using the NPC.NewNPC method.
    return true;
}
Ok, now how do I summon the boss without the "Boss has Awoken!" message?
 
It isnt working for me on mac, it jsut gives me a .exe stuff
Read the README.txt, please. That would've told you to go inside the .app file and put the files in there.
Ok, now how do I summon the boss without the "Boss has Awoken!" message?
Like I said, use the NPC.NewNPC function:
Code:
NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("MyNPCType"), npc.whoAmI);
 
Can someone put up a tutorial on how to make mods on YouTube? I really want to start modding but I can't find any tutorials. Also, what programming language is this?
 
How to do that NPC despawn IF you die??
If you have a target for the NPC, you can do something like the following in one of your AI methods:
Code:
if(Main.player[npc.target].dead)
    npc.Kill();
Can someone put up a tutorial on how to make mods on YouTube? I really want to start modding but I can't find any tutorials. Also, what programming language is this?
There was someone talking about a video tutorial a while ago (a pretty long while ago).
Right now there's not really a video tutorial. There are, however, threads and info that should get you started (the links for those are in the OP).
Other than that: tModLoader programming is done in C#. Hope this helps ;)
 
If you have a target for the NPC, you can do something like the following in one of your AI methods:
Code:
if(Main.player[npc.target].dead)
    npc.Kill();

There was someone talking about a video tutorial a while ago (a pretty long while ago).
Right now there's not really a video tutorial. There are, however, threads and info that should get you started (the links for those are in the OP).
Other than that: tModLoader programming is done in C#. Hope this helps ;)
Definitely helps. I'll start learning C# then. To be honest never heard of C#.
 
Definitely helps. I'll start learning C# then. To be honest never heard of C#.
Haha, glad to be of service!
If you google something like 'C# tutorial', it'll yield a lot of results. Some in the form of plain theory and some in the form of making a small application/game. You'll have to see what works for you ;)
Also, I'd suggest downloading 'Microsoft Visual Studio 2015 Community Edition' (if you're running Windows, that is). It'll make your life a lot easier in the (near) future.
 
Haha, glad to be of service!
If you google something like 'C# tutorial', it'll yield a lot of results. Some in the form of plain theory and some in the form of making a small application/game. You'll have to see what works for you ;)
Also, I'd suggest downloading 'Microsoft Visual Studio 2015 Community Edition' (if you're running Windows, that is). It'll make your life a lot easier in the (near) future.
Alright then. Sounds good. Don't know what I'm gonna add though. Hmmm. ADD ALL THE THINGS!!!!
 
How do I make a Heat ray kind of projectile? And also this projectile isnt appearing at all:
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace Enderuim.Projectiles
{
    public class CodexVolt : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Codex Voltra";
            projectile.damage = 30;
            projectile.width = 32;
            projectile.height = 32;
            projectile.hostile = true;
            projectile.melee = true;
            projectile.penetrate = 0;
            projectile.tileCollide = true;
            projectile.alpha = 100;
            projectile.aiStyle = 1;
            projectile.knockBack = 0;
            projectile.light = 0.5f;
            aiType = 1;       
        }
    }
}
 
How do I make a vanilla NPC drop a mod item?
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Enderuim
{
    public class MyGlobalNPC21 : GlobalNPC
    {
        public override void NPCLoot(NPC npc)
        {
            if (npc.type == 266 && Main.rand.Next(20) == 0) //266 is the NpcID, and the number next to main..rand.next is the rarity. this is currently 5% chance
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodTome"), 1); //Item spawn
            }

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

namespace Enderuim
{
    public class MyGlobalNPC21 : GlobalNPC
    {
        public override void NPCLoot(NPC npc)
        {
            if (npc.type == 266 && Main.rand.Next(20) == 0) //266 is the NpcID, and the number next to main..rand.next is the rarity. this is currently 5% chance
            {
                Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("BloodTome"), 1); //Item spawn
            }

        }
    }
}
Thanks.
 
I have been asking this question for weeks: How does one make a laser (heat ray) prejectile????


Here's the code for a heat ray projectile

Code:
        public override void AI()
        {
            projectile.localAI[0] += 1f; //Increase counter by 1
            if (projectile.localAI[0] > 3f)  //by 3rd count, activate beam
            {
                for (int num562 = 0; num562 < 3; num562++)
                {
                    projectile.alpha = 255; //makes projectile invisible
                    int num563 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y - projectile.height/4), projectile.width + 4, projectile.height + 4, 15, 0f, 0f, 0, default(Color), 0.75f); //Dust for laser beam
                    Main.dust[num563].scale = (float)Main.rand.Next(70, 110) * 0.013f; //Randomizes scale of the dust
                    Main.dust[num563].velocity *= 0.2f;  //how fast dust goes
                    Main.dust[num563].noGravity = true;  //makes dust float
                }
            }
        }
 
Back
Top Bottom