tModLoader Requesting Channelled Weapon Code

Sea_Hitler

Terrarian
Working on stuff for a mod of mine and had the idea for a beam magic weapon. If someone could provide me with the code for something along the lines of a fully focused last prism, I'd be a very happy modder :)

EDIT: Actually, the code for the Shadowbeam staff beam without bounce would be better.
 
Last edited:
Working on stuff for a mod of mine and had the idea for a beam magic weapon. If someone could provide me with the code for something along the lines of a fully focused last prism, I'd be a very happy modder :)

EDIT: Actually, the code for the Shadowbeam staff beam without bounce would be better.
The beam for the shadowbeam staff is really simple actually, all you would need is a transparent 1x1 png, then you have your ai, set updates to 100, then just have it produce dust. Here's an example from my mod.

Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using Terraria;
using Terraria.ModLoader;

namespace COFP.Projectiles.NPCProj.Berramyr
{
    public class Berrabeam : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Berrabeam";
            projectile.width = 8;
            projectile.height = 8;
            projectile.timeLeft = 180;
            projectile.friendly = false;
            projectile.hostile = true;
            projectile.tileCollide = true;
            projectile.ignoreWater = true;
            projectile.extraUpdates = 5; //You can change this value to 100 to get a full laser effect
        }
        public override void AI()
        {
            //Projectile appears at 4 ticks
            if(projectile.ai[0] > 4f)
            {
                for(int i = 0; i < 4; i++)
                {
                    int DustID = Dust.NewDust(projectile.position, projectile.width + 2, projectile.height + 2, 6, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default(Color), 1f);
                    Main.dust[DustID].noGravity = true;
                    Main.dust[DustID].scale *= 1.75f;
                }
            }
            projectile.ai[0] += 1f;
        }
    }
}

For a channeled weapon, you might want to refer to this I made a long time ago, it should still be relevant.
Rainbow Devastation Weapon
Rainbow Devastation Weapon Projectile
Rainbow Devastation Projectile 1
Rainbow Devastation Projectile 2
 
Back
Top Bottom