tModLoader Cloning Magic Weapon Issue Help.

adg155

Terrarian
I need help, I'm making a Lunar Flare Clone using tModLoader, by raising its stats, and then this happens
Instead of Firing as 3 raining projectile, it fires as a projectile from book.
How do I fix this?
Do I need to clone a Lunar Flare Projectile and change it's ai?
Or put a code like a Star Wrath?
I don't know...

sorry for bad english,
thanks for reading my issue...
 
You didn't post your code, also, hardly anyone comes here, so I suggest coming to the tmodloader discord: discord.me/tModLoader.
 
...
On my first thoughts, It doesn't need to put a code, just adding another code.
Ok, here's my code, about Celestial Flare
Here ya' go:

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

namespace VanillaUpgrade.Items
{
public class CelestialFlare : ModItem
{

public override void SetStaticDefaults()
{
DisplayName.SetDefault("Celestial Flare");
Tooltip.SetDefault("Rapidly rain down celestial flares.");
}

public override void SetDefaults()
{
item.CloneDefaults(ItemID.LunarFlareBook);
item.damage = 175;
item.value = 850000;
item.useTime = 3;
item.useAnimation = 3;
item.knockBack = 3;
item.mana = 16;
item.shootSpeed = 13;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.LunarFlareBook);
recipe.AddTile(TileID.CrystalBall);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}

and there no special code on it.
[doublepost=1523088063,1523087811][/doublepost]Oh, I'm making a mod that I'll post it on Mod Browser if this bug fixed. :D
 
So I'll only need to change the Projectile ID but how to change the Fired Projectile Number?
Then I'll change some math there to be same as lunar flare.
Edit: I already decompiled Terraria, so I'll just find Projectile.cs and open it.
Thank you, anyway.

// See Source code for Star Wrath projectile to see how it passes through tiles.
/* The following changes to SetDefaults
item.shoot = 503; (change to 645 for Lunar Flare)
item.shootSpeed = 8f; (change to Original Projectile Speed)
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Vector2 target = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY);
float ceilingLimit = target.Y;
if (ceilingLimit > player.Center.Y - 200f)
{
ceilingLimit = player.Center.Y - 200f;
}
for (int i = 0; i < 3; i++)
{
position = player.Center + new Vector2((-(float)Main.rand.Next(0, 401) * player.direction), -600f);
position.Y -= (100 * i);
Vector2 heading = target - position;
if (heading.Y < 0f)
{
heading.Y *= -1f;
}
if (heading.Y < 20f)
{
heading.Y = 20f;
}
heading.Normalize();
heading *= new Vector2(speedX, speedY).Length();
speedX = heading.X;
speedY = heading.Y + Main.rand.Next(-40, 41) * 0.02f;
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage * 2, knockBack, player.whoAmI, 0f, ceilingLimit);
return false;
}*/
}
}
}
 
Edit Edit: These codes are not located in Projectile.cs and Item.cs
Where should I find them?
 
3:53 AM? Last Night we lost connection and repaid around 12:00 PM so
Ok, I'll check it.

Edit: Wait, What? What file is these Player.ItemCheck contained?
 
Last edited:
Hello, and Good Evening (Because 7:25 PM there is night.)
I searched on the internet and found out that Lunar Flare and Star Wrath has the same special projectile code...
So I don't need to change the math code.
But When I started to put these code into my modded Lunar Flare...


AN ERROR HAPPENED:
c:\Users\Microsoft™\Documents\My Games\Terraria\ModLoader\Mod Sources\VanillaUpgrade\Items\CelestialFlare.cs(29,49) : error CS0246: The type or namespace name 'Vector2' could not be found (are you missing a using directive or an assembly reference?)

I'll highlight the error namespace as green

This time, I'll put my Dimensional Flare code there...

This is my code:

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

namespace VanillaUpgrade.Items
{
public class DimensionalFlare : ModItem
{

public override void SetStaticDefaults()
{
DisplayName.SetDefault("Dimensional Flare");
Tooltip.SetDefault("Rapidly rain down very slow dimensional flares.");
}

public override void SetDefaults()
{
item.CloneDefaults(ItemID.LunarFlareBook);
item.damage = 550;
item.shoot = 645;
item.value = 990000;
item.useTime = 4;
item.useAnimation = 4;
item.knockBack = 8;
item.mana = 20;
item.shootSpeed = 1;
}

public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Vector2 target = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY);
float ceilingLimit = target.Y;
if (ceilingLimit > player.Center.Y - 200f)
{
ceilingLimit = player.Center.Y - 200f;
}
for (int i = 0; i < 3; i++)
{
position = player.Center + new Vector2((-(float)Main.rand.Next(0, 401) * player.direction), -600f);
position.Y -= (100 * i);
Vector2 heading = target - position;
if (heading.Y < 0f)
{
heading.Y *= -1f;
}
if (heading.Y < 20f)
{
heading.Y = 20f;
}
heading.Normalize();
heading *= new Vector2(speedX, speedY).Length();
speedX = heading.X;
speedY = heading.Y + Main.rand.Next(-40, 41) * 0.02f;
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage * 2, knockBack, player.whoAmI, 0f, ceilingLimit);
}
return false;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.LunarFlareBook);
recipe.AddTile(TileID.CrystalBall);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}

I hope someone is able to fix this 'cause I don't know anything about it.

sorry for little bad english (I'm reading about english yesterday)
and long post.
 
Last edited:
You need to add
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; at the top above using terraria.
 
Back
Top Bottom