BlueWaterMelon
Golem
how do you decompile and is it NPC.cs or NPCIt's one of Terraria's classes that you get when you decompile it. It's pretty hard to miss, really.
how do you decompile and is it NPC.cs or NPCIt's one of Terraria's classes that you get when you decompile it. It's pretty hard to miss, really.
how do you decompile and is it NPC.cs or NPC
where "mod.TileType("ExampleBlock")" is the tile, 6E-05 is a multiplier on the number of loops, and I forget all the parameters for TileRunner right now.Code:public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight) { int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); if (ShiniesIndex == -1) { // Shinies pass removed by some other mod. return; } tasks.Insert(ShiniesIndex + 1, new PassLegacy("Example Mod Ores", delegate (GenerationProgress progress) { progress.Message = "Example Mod Ores"; for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); k++) { WorldGen.TileRunner(WorldGen.genRand.Next(0, Main.maxTilesX), WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(2, 6), mod.TileType("ExampleBlock"), false, 0f, 0f, false, true); } })); }
using System.IO;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.World.Generation;
using Microsoft.Xna.Framework;
using System;
namespace EpicnessMod
{
public class EpicnessWorld : ModWorld
{
private const int saveVersion = 0;
public static bool downedDarkNebula = false;
public static int DarkNebulaDefeated;
public const int MSG_BLESS = 1;
//public struct EpicnessMsgs
//{
public static string[] misc = {"Your world has been infected with Corrupt Ore!"};
//}
public override void Initialize()
{
downedDarkNebula = false;
}
public override void SaveCustomData(BinaryWriter writer)
{
writer.Write(saveVersion);
byte flags = 0;
writer.Write(DarkNebulaDefeated);
if (downedDarkNebula)
{
flags |= 1;
}
writer.Write(flags);
}
public override void LoadCustomData(BinaryReader reader)
{
reader.ReadInt32();
DarkNebulaDefeated = reader.ReadInt32();
byte flags = reader.ReadByte();
downedDarkNebula = ((flags & 1) == 1);
}
public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight)
{
int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes"));
if (ShiniesIndex == -1)
{
// Shinies pass removed by some other mod.
return;
}
tasks.Insert(ShiniesIndex + 1, new PassLegacy("Corrupt Ore", delegate (GenerationProgress progress)
{
progress.Message = "Corrupt Ore";
for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); k++)
{
WorldGen.TileRunner(WorldGen.genRand.Next(0, Main.maxTilesX), WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(2, 6), mod.TileType("Corrupt Ore"), false, 0f, 0f, false, true);
}
}));
}
}
}
When I inserted that code into my world file I got this error
c:\Users\Julian Romero\Documents\My Games\Terraria\ModLoader\Mod Sources\EpicnessMod\EpicnessWorld.cs(55,48) : error CS0246: The type or namespace name 'PassLegacy' could not be found (are you missing a using directive or an assembly reference?)
Here is the code of the world file:
Code:using System.IO; using System.Collections.Generic; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.World.Generation; using Microsoft.Xna.Framework; using System; namespace EpicnessMod { public class EpicnessWorld : ModWorld { private const int saveVersion = 0; public static bool downedDarkNebula = false; public static int DarkNebulaDefeated; public const int MSG_BLESS = 1; //public struct EpicnessMsgs //{ public static string[] misc = {"Your world has been infected with Corrupt Ore!"}; //} public override void Initialize() { downedDarkNebula = false; } public override void SaveCustomData(BinaryWriter writer) { writer.Write(saveVersion); byte flags = 0; writer.Write(DarkNebulaDefeated); if (downedDarkNebula) { flags |= 1; } writer.Write(flags); } public override void LoadCustomData(BinaryReader reader) { reader.ReadInt32(); DarkNebulaDefeated = reader.ReadInt32(); byte flags = reader.ReadByte(); downedDarkNebula = ((flags & 1) == 1); } public override void ModifyWorldGenTasks(List<GenPass> tasks, ref float totalWeight) { int ShiniesIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); if (ShiniesIndex == -1) { // Shinies pass removed by some other mod. return; } tasks.Insert(ShiniesIndex + 1, new PassLegacy("Corrupt Ore", delegate (GenerationProgress progress) { progress.Message = "Corrupt Ore"; for (int k = 0; k < (int)((double)(Main.maxTilesX * Main.maxTilesY) * 6E-05); k++) { WorldGen.TileRunner(WorldGen.genRand.Next(0, Main.maxTilesX), WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY), (double)WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(2, 6), mod.TileType("Corrupt Ore"), false, 0f, 0f, false, true); } })); } } }
If you aren't using Visual Studio yet, you should really try.
Anyway, the using statement is "using Terraria.GameContent.Generation;"
If you aren't using Visual Studio yet, you should really try.
Anyway, the using statement is "using Terraria.GameContent.Generation;"
Here is the method signature.This might be a stupid question but where would the ore appear now that it is generates (so that I have a reference point to find it)
public override float CanSpawn(NPCSpawnInfo spawnInfo)
{
Player player = Main.player[Main.myPlayer];
int x = spawnInfo.spawnTileX;
int y = spawnInfo.spawnTileY;
int tile = (int)Main.tile[x, y].type;
return (ThoriumMod.NormalSpawn(spawnInfo)) && spawnInfo.spawnTileY < Main.worldSurface - 250 && (int)(player.position.Y / 16) < Main.maxTilesY - 200 && Main.evilTiles < 100 && Main.snowTiles < 100 && Main.sandTiles < 100 && Main.bloodTiles < 100 && Main.jungleTiles < 100 && Main.dungeonTiles < 100 ? 0.20f : 0f;
}
Could you explain a bit more?can some one help me i would like my Helmet to shoot a laser in a enemy direction but not going after it
The following is an example:How do I make custom wings (I would like to make infinite)?
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
equips.Add(EquipType.Wings);
return true;
}
public override void SetDefaults()
{
item.name = "ings";
item.width = 24;
item.height = 30;
item.toolTip = "Allows for infinite flight";
item.value = Item.sellPrice(5, 0, 0, 0);
item.rare = 10;
item.accessory = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.wingTimeMax = 18000; // 5 minutes flight.
}
public override void VerticalWingSpeeds(ref float ascentWhenFalling, ref float ascentWhenRising,
ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
{
ascentWhenFalling = 0.85f;
ascentWhenRising = 0.15f;
maxCanAscendMultiplier = 1f;
maxAscentMultiplier = 3f;
constantAscend = 0.135f;
}
public override void HorizontalWingSpeeds(ref float speed, ref float acceleration)
{
speed = 10f;
acceleration *= 3f;
}
// NOTE: The following function is used to allow for infinite flight. This is UNTESTED so keep that in mind.
// If you want to add effects when using your wings, this is also the place to do that.
public override void WingUpdate(Player player, bool inUse)
{
if (inUse)
{
player.wingTime = 10;
}
}
public override void AddCraftGroups()
{
AddCraftGroup("CraftGroupName", Lang.misc[37] + " " + "Craft Group Display Name",
ItemType("MyItem1"), ItemType("MyItem2"), ItemType("MyItem3"), ItemType("MyItem4"));
}
Where do I put the code for CraftGroups? And the parts of the wings code, VerticalWingSpeed and HorizontalWingSpeed, do them have to be in every wings?The following is an example:
I'm guessing a lot of the names of the used variables should explain what they do. If you're wondering what they do, just change their values and see what changes in-game.Code:public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips) { equips.Add(EquipType.Wings); return true; } public override void SetDefaults() { item.name = "ings"; item.width = 24; item.height = 30; item.toolTip = "Allows for infinite flight"; item.value = Item.sellPrice(5, 0, 0, 0); item.rare = 10; item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { player.wingTimeMax = 18000; // 5 minutes flight. } public override void VerticalWingSpeeds(ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) { ascentWhenFalling = 0.85f; ascentWhenRising = 0.15f; maxCanAscendMultiplier = 1f; maxAscentMultiplier = 3f; constantAscend = 0.135f; } public override void HorizontalWingSpeeds(ref float speed, ref float acceleration) { speed = 10f; acceleration *= 3f; } // NOTE: The following function is used to allow for infinite flight. This is UNTESTED so keep that in mind. // If you want to add effects when using your wings, this is also the place to do that. public override void WingUpdate(Player player, bool inUse) { if (inUse) { player.wingTime = 10; } }
As for the custom item groups (I'm guessing you're referring to CraftGroup?): There is a function you can override in your class that derives from Mod:
As you can see, the first parameter is the name you call the craft group with (when creating a recipe that uses this CraftGroup), the second is the name that is displayed to the player and then you can fill the rest of the function with the IDs of the items you want to include in this CraftGroup.Code:public override void AddCraftGroups() { AddCraftGroup("CraftGroupName", Lang.misc[37] + " " + "Craft Group Display Name", ItemType("MyItem1"), ItemType("MyItem2"), ItemType("MyItem3"), ItemType("MyItem4")); }
Hope this works for ya.
For your first question I quote myself:Where do I put the code for CraftGroups? And the parts of the wings code, VerticalWingSpeed and HorizontalWingSpeed, do them have to be in every wings?
Thank you for help!For your first question I quote myself:
'There is a function you can override in your class that derives from Mod'
Meaning you can put the function in the class that is (probably) named the same as your mods' root folder.
For your second question: yes.
No probs.Thank you for help!
no i have the armor done and i want it to shoot lasersCould you explain a bit more?
Are you already shooting the projectile? If so, could you show us the code where you spawn the projectile, as well as the code of the projectile in question?
Could you give some more details, then?no i have the armor done and i want it to shoot lasers