Annoying Meower
Steampunker
I'm making a custom biome, but the background is black and I'm getting "Index was outside the bounds of the array". Help!
I'm not the best when it comes to coding, sorry.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Terraria.Main.DrawBackground()
at Terraria.Main.RenderBackground()
at Terraria.Main.DoDraw(GameTime gameTime)
at Terraria.Main.Draw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DrawFrame()
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameHost.OnIdle()
at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Terraria.Program.LaunchGame_()
at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
at Terraria.WindowsLaunch.Main(String[] args)
at Terraria.Main.DrawBackground()
at Terraria.Main.RenderBackground()
at Terraria.Main.DoDraw(GameTime gameTime)
at Terraria.Main.Draw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DrawFrame()
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameHost.OnIdle()
at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Terraria.Program.LaunchGame_()
at Terraria.Program.LaunchGame(String[] args, Boolean monoArgs)
at Terraria.WindowsLaunch.Main(String[] args)
using Terraria;
using Terraria.ModLoader;
namespace Scifi.Backgrounds
{
public class UgBgStyle : ModUgBgStyle
{
public override bool ChooseBgStyle() {
return Main.LocalPlayer.GetModPlayer<ScifiPlayer>().ZoneVoid;
}
public override void FillTextureArray(int[] textureSlots) {
textureSlots[0] = mod.GetBackgroundSlot("Backgrounds/VoidBiomeUG0");
textureSlots[1] = mod.GetBackgroundSlot("Backgrounds/VoidBiomeUG1");
textureSlots[2] = mod.GetBackgroundSlot("Backgrounds/VoidBiomeUG2");
textureSlots[3] = mod.GetBackgroundSlot("Backgrounds/VoidBiomeUG3");
}
}
}
using Terraria.ModLoader;
namespace Scifi.Backgrounds
{
public class UgBgStyle : ModUgBgStyle
{
public override bool ChooseBgStyle() {
return Main.LocalPlayer.GetModPlayer<ScifiPlayer>().ZoneVoid;
}
public override void FillTextureArray(int[] textureSlots) {
textureSlots[0] = mod.GetBackgroundSlot("Backgrounds/VoidBiomeUG0");
textureSlots[1] = mod.GetBackgroundSlot("Backgrounds/VoidBiomeUG1");
textureSlots[2] = mod.GetBackgroundSlot("Backgrounds/VoidBiomeUG2");
textureSlots[3] = mod.GetBackgroundSlot("Backgrounds/VoidBiomeUG3");
}
}
}