RadioctiveTaco
Terrarian
I want it too! So make it public.I've asked this last week, but I really would like an answer so,
Can anyone supply me with a skeleton/code of a custom solar eruption? As I would like to make one. Thanks in advance
I want it too! So make it public.I've asked this last week, but I really would like an answer so,
Can anyone supply me with a skeleton/code of a custom solar eruption? As I would like to make one. Thanks in advance
I have no idea why you are looping 400 times there. Anyway, DownedAbaddon will always be false when ModTile.SetDefaults runs, since that is when mods are loading. Doing something dynamic like this, I'd suggest putting that particular adjtile logic in GlobalTile.AdjTiles. Doing it in ModTile would be hard to manage since it only happens once.I have an issue regarding weakReferences and bools.
In my mod, I have it so that when a certain mod is loaded, some tiles from that mod are added to the adjTiles list. This works fine.
However, I can't get one mod's tiles to work (SacredTools); Unlike the other mods I'm including, ST has both a check to see if it's loaded and a check to see if a certain boss is downed. The mod loads fine, but when the bool activates, the tile(s) aren't added to the list. Any idea how I could fix this?
The code in question (snipped):
Hastebin: https://hastebin.com/lecozuzato.csCode:using Terraria.DataStructures; using Terraria.Enums; using System; using System.Linq; using System.Text; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; namespace UniversalCraft.Tiles { public class UniversalCrafter : ModTile { public override void SetDefaults() { List<int> adjTile = new List<int>(); for (int runs = 0; runs < 400; runs++) { <vanilla crafting stations> } if (ModLoader.GetLoadedMods().Contains("AlchemistNPC")) //This bit works. { Mod alchemistNPC = ModLoader.GetMod("AlchemistNPC"); for (int runs = 0; runs < 400; runs++) { adjTile.Add(alchemistNPC.TileType("WingoftheWorld")); adjTile.Add(alchemistNPC.TileType("MateriaTransmutator")); } } if (ModLoader.GetLoadedMods().Contains("SacredTools")) //This bit doesn't. { Mod sacredTools = ModLoader.GetMod("SacredTools"); if (DownedAbaddon == true) { for (int runs = 0; runs < 400; runs++) { adjTile.Add(sacredTools.TileType("OblivionForge")); } } } adjTiles = adjTile.ToArray(); } public bool DownedAbaddon { get { return SacredTools.ModdedWorld.OblivionSpawns; } } } }
Build.txt file:
Code:author = Creeper Da Snek version = 1.2.0.1 displayName = Universal Crafter hideCode = false hideResources = false homepage = https://forums.terraria.org/index.php?threads/universal-crafter.62025/ includeSource = true weakReferences = CalamityMod, SacredTools
Alright. I've moved all the adjTiles code to a GlobalTile file. How would I add all the list items to the tile? I've tried "ModTile.adjTiles = adjTile.ToArray" inside the "if (type == [...] ))" bracket, which gave me this error:I have no idea why you are looping 400 times there. Anyway, DownedAbaddon will always be false when ModTile.SetDefaults runs, since that is when mods are loading. Doing something dynamic like this, I'd suggest putting that particular adjtile logic in GlobalTile.AdjTiles. Doing it in ModTile would be hard to manage since it only happens once.
error CS0120: An object reference is required for the non-static field, method, or property 'Terraria.ModLoader.ModTile.adjTiles'
I didn't say to move it all, just the dynamic stuff. And the documentation says to return an int array, not sure what you are doing with ModTile.adjTiles there....maybe just come to the discord chat, this might take a while to explain.Alright. I've moved all the adjTiles code to a GlobalTile file. How would I add all the list items to the tile? I've tried "ModTile.adjTiles = adjTile.ToArray" inside the "if (type == [...] ))" bracket, which gave me this error:
Code:error CS0120: An object reference is required for the non-static field, method, or property 'Terraria.ModLoader.ModTile.adjTiles'
Inside the newProjectile bit, replace velocity.X and velocity.Y with 0 and a negative number of your choice. The bigger the number, the faster it will shoot.How do I make a boss only shoot up
here is some code:
if (projectileTimer++ == 100) // EVERY 60 TICKS EQUALS TO 1 SECOND
{
Main.PlaySound(SoundID.NPCHit52, npc.position); // plays a sound
Player player = Main.player[npc.target];
float projectileSpeed = 12f;
int damage = 200; // The damage your projectile deals.
float knockBack = 3;
int type = mod.ProjectileType("laser5");
Vector2 velocity = Vector2.Normalize(new Vector2(player.position.X + player.width / 2, player.position.Y + player.height / 2) -
new Vector2(npc.position.X + npc.width / 2, npc.position.Y + npc.height / 2)) * projectileSpeed;
Projectile.NewProjectile(npc.position.X + npc.width / 2, npc.position.Y + npc.height / 2, velocity.X, velocity.Y, type, damage, knockBack, Main.myPlayer);
projectileTimer = 0;
}
I think you will just have to wait till the remainder of the mods update.Hi guys, I've got a problem after updating tmodloader to the newest version (I'll refer to it as the .3). I have some mods downloaded, and everything was going fine till I had the .1 version. However, after i updated to .3, like a half of my mods stopped working - the game logs told me that the mods that are not working are for older versions only (.1,.2). So I decided to swap back to the .1 version, but then the other half of the mods stopped working because they are for the .3 version. Those mods are like alchemistnpc, recipebrowser, luiafk.. And now I don't know what to do. I thought about downloading older versions of those mods but I cannot find them anywhere. Any help appreciated
.1 mods should have no trouble loading on .3, if you mention the actual errors you get while loading .1 mods on .3, we can probably help.Hi guys, I've got a problem after updating tmodloader to the newest version (I'll refer to it as the .3). I have some mods downloaded, and everything was going fine till I had the .1 version. However, after i updated to .3, like a half of my mods stopped working - the game logs told me that the mods that are not working are for older versions only (.1,.2). So I decided to swap back to the .1 version, but then the other half of the mods stopped working because they are for the .3 version. Those mods are like alchemistnpc, recipebrowser, luiafk.. And now I don't know what to do. I thought about downloading older versions of those mods but I cannot find them anywhere. Any help appreciated
'NPCBehavior.CanBeHitByItem(NPC, Player, Item)': return type must be 'bool?' to match overridden member 'GlobalNPC.CanBeHitByItem(NPC, Player, Item)' [RedParty]'
public override bool CanBeHitByItem(NPC npc, Player player, Item item)
{
return (npc.Equals("Merchant") && item.netID.Equals("3509"));
}
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace swordmod.Items.Weapons
{
public class UnholyGenesis : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Unholy Genesis");
Tooltip.SetDefault("Inflicts the fire of the elements and impedes enemy abilities");
}
public override void SetDefaults()
{
item.damage = 200;
item.melee = true;
item.width = 80;
item.height = 80;
item.useTime = 18;
item.useAnimation = 15;
item.useStyle = 1;
item.knockBack = 5;
item.value = 10000;
item.rare = 7;
item.UseSound = SoundID.Item20;
item.autoReuse = true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "BiomeCatalyst", 1);
recipe.AddIngredient(null, "soulblade", 1);
recipe.AddIngredient(null, "lightblade", 1);
recipe.AddIngredient(ItemID.SoulofLight, 5);
recipe.AddIngredient(ItemID.SoulofNight, 5);
recipe.AddIngredient(ItemID.Ectoplasm, 5);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.BrokenArmor, 540);
target.AddBuff(BuffID.Daybreak, 540);
target.AddBuff(BuffID.Burning, 540);
}
}
}
for (int index = 0; index < numberProjectiles; ++index)
{
Vector2 vector2_1 = new Vector2((float)((double)player.position.X + (double)player.width * 0.5 + (double)(Main.rand.Next(100) * -player.direction) + ((double)Main.mouseX + (double)Main.screenPosition.X - (double)player.position.X)), (float)((double)player.position.Y + (double)player.height * 0.5 - 600.0)); //This defines the projectile width, direction and position.
vector2_1.X = (float)(((double)vector2_1.X + (double)player.Center.X) / 2.0) + (float)Main.rand.Next(-100, 100);
vector2_1.Y -= (float)(100 * index);
float num12 = (float)Main.mouseX + Main.screenPosition.X - vector2_1.X;
float num13 = (float)Main.mouseY + Main.screenPosition.Y - vector2_1.Y;
if ((double)num13 < 0.0) num13 *= -1f;
if ((double)num13 < 20.0) num13 = 20f;
float num14 = (float)Math.Sqrt((double)num12 * (double)num12 + (double)num13 * (double)num13);
float num15 = item.shootSpeed / num14;
float num16 = num12 * num15;
float num17 = num13 * num15;
float SpeedX = num16 + (float)Main.rand.Next(-12, 10) * 0.160f; //This defines the projectile X position speed and randomness.
float SpeedY = num17 + (float)Main.rand.Next(-12, 10) * 0.160f; //This defines the projectile Y position speed and randomness.
Projectile.NewProjectile(vector2_1.X, vector2_1.Y, SpeedX * 1.50f, SpeedY * 0.65f, ProjectileID.StarWrath, damage * 1, knockBack, Main.myPlayer, 0.0f, (float)Main.rand.Next(5)); //The "Star Wrath" projectile's velocity is 35% less than the original projectile's speed (0.65f).
}
return false;
place zip files in Documents\My Games\Terraria\ModLoader\TexturePacks我想知道是安装了Terraria的tModLoader如何使用Texture Pack
[doublepost=1520761676,1520761612][/doublepost]我想知道是安装了Terraria的tModLoader如何使用Texture Pack
[doublepost=1520761768][/doublepost]I want to know is installed tModLoader of Terraria how to use Texture PackI