HalcyonCashew24
Terrarian
Hi, I'm having trouble creating this tile that will hold a Water Bolt like an item frame or weapon rack. When the player right clicks on the Water Bolt Pedestal with a Water Bolt the style is supposed to change to an "active" Water Bolt Pedestal and, the Water Bolt is supposed to be taken from the player's hand. When the player right clicks on the active Water Bolt Pedestal with an empty hand the Water Bolt will be given back and the style will be changed to an "inactive" Water Bolt Pedestal. I don't know how to detect when a player clicks on the tile, how to change the style, and how to take the Water Bolt from the player, visa versa. I also can't get the correct items to drop. I can get the Water Bolt Pedestal to drop but when I try to get two items it drops 167 water Bolt Pedestals.
The code is as follows:
This is the texture:
The code is as follows:
C#:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ObjectData;
namespace LegendOfWaterbolt.Tiles
{
public class WaterBoltPedestal : ModTile
{
public override void SetDefaults()
{
Main.tileSolidTop[Type] = true;
Main.tileBlockLight[Type] = false;
Main.tileLighted[Type] = false;
Main.tileLavaDeath[Type] = true;
Main.tileWaterDeath[Type] = true;
Main.tileNoAttach[Type] = true;
Main.tileFrameImportant[Type] = true;
dustType = 279; ;
TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4);
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 18 };
TileObjectData.newTile.CoordinateWidth = 16;
TileObjectData.newTile.CoordinatePadding = 2;
TileObjectData.newTile.StyleHorizontal = true;
TileObjectData.addTile(Type);
ModTranslation name = CreateMapEntryName();
name.SetDefault("Water Bolt Pedistal");
AddMapEntry(new Color(67, 73, 62));
}
public override void KillMultiTile(int i, int j, int frameX, int frameY)
{
Item.NewItem(i * 16, j * 16, 48, 64, mod.ItemType("WaterBoltPedestal"));
Item.NewItem(i * 16, j * 16, 96, 64, mod.ItemType("WaterBoltPedestal"), ItemID.WaterBolt);
}
}
}
This is the texture: