Standalone [1.3] tModLoader - A Modding API

Getting an error while trying to add a projectile attack to my boss

Error: c:\Users\Hailey\Documents\My Games\Terraria\ModLoader\Mod Sources\SaobiesMod\NPCs\Boss\MindBreaker.cs(47,14) : error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)

Code (line 47 and below):

npc.ai [1]++;
if (npc.ai[1] >= 230)
{
float Speed = 20f
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc/height / 2));
int damage = 14;
int type = mod.ProjectileType("BreakerBolt");
Main.PlaySound(23, (int)npc.position.X, (int)npc.position.Y, 17);
float rotation = (float)Math.Atan2(vector8.Y - (P.position.Y + (P.height * 0.5f)), vector8.X - (P.position.X + (P.width * 0.5f)));
int num54 = Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) = Speed) * -1), (float)((Math.Sin(rotation) = Speed) = -1), type, damage, 0f, 0);
npc.ai[1] = 0;
}

-----------------------

Kindly PM me any details that may help fix this, or PM me if more details pertaining to the issue are needed
 
Anyone know how to change vanilla tooltips now?
I was useing
Code:
public class ModedItem : GlobalItem{
public override void SetDefaults(Item item){
            switch(item.type)
            {
                case ItemID.DaedalusStormbow:
                    item.UseSound = null;
                    return;
                case ItemID.Grenade:
                case ItemID.StickyGrenade:
                case ItemID.BouncyGrenade:
                case ItemID.Beenade:
                case ItemID.PartyGirlGrenade:
                    item.ammo = 168;
                    return;
                case ItemID.UmbrellaHat:
                    item.vanity = false;
                    item.toolTip = "Slow falling speed";
                    item.defense = 1;
                    return;
}}}
But this just results in failure to compile
it tried
Code:
public override void SetStaticDefaults(Item item){
        switch(item.type)
            {
            case ItemID.UmbrellaHat
            //DisplayName.SetDefault("xxx");
            Tooltip.SetDefault("Slow falling speed");
            return;
            }
        }
But no dice

Can anyone help with this it would be much appreciated
 
The mp3 of the big mods like Calamity, Tremor, Thorium and Spirit are not loading so I am not able to play them. Please tell me how to fix this issue.


The mp3 sound file at Sounds/Music/CaveStoryBossBattle.mp3 failed to load
bei Terraria.ModLoader.Mod.Autoload()
bei Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Inner Exception:
Ensure that the specified stream contains valid PCM mono or stereo wave data.
bei Microsoft.Xna.Framework.Audio.WavFile..ctor(Stream source)
bei Microsoft.Xna.Framework.Audio.WavFile.Open(Stream stream)
bei Microsoft.Xna.Framework.Audio.SoundEffect..ctor(Stream stream)
bei Microsoft.Xna.Framework.Audio.SoundEffect.FromStream(Stream stream)
bei Terraria.ModLoader.Mod.Autoload()
 
Last edited:
The mp3 of the big mods like Calamity, Tremor, Thorium and Spirit are not loading so I am not able to play them. Please tell me how to fix this issue.


The mp3 sound file at Sounds/Music/CaveStoryBossBattle.mp3 failed to load
bei Terraria.ModLoader.Mod.Autoload()
bei Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Inner Exception:
Ensure that the specified stream contains valid PCM mono or stereo wave data.
bei Microsoft.Xna.Framework.Audio.WavFile..ctor(Stream source)
bei Microsoft.Xna.Framework.Audio.WavFile.Open(Stream stream)
bei Microsoft.Xna.Framework.Audio.SoundEffect..ctor(Stream stream)
bei Microsoft.Xna.Framework.Audio.SoundEffect.FromStream(Stream stream)
bei Terraria.ModLoader.Mod.Autoload()
So im not the only one with this problem...
seems like all the big mods seem to fail at random places like sound or images
 
I got this too. I was making my own mod at the time so i ignored it and was going to deal with it later. Guess a redownload wouldnt have fixed it huh
So im not the only one with this problem...
seems like all the big mods seem to fail at random places like sound or images
The mp3 of the big mods like Calamity, Tremor, Thorium and Spirit are not loading so I am not able to play them. Please tell me how to fix this issue.


The mp3 sound file at Sounds/Music/CaveStoryBossBattle.mp3 failed to load
bei Terraria.ModLoader.Mod.Autoload()
bei Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Inner Exception:
Ensure that the specified stream contains valid PCM mono or stereo wave data.
bei Microsoft.Xna.Framework.Audio.WavFile..ctor(Stream source)
bei Microsoft.Xna.Framework.Audio.WavFile.Open(Stream stream)
bei Microsoft.Xna.Framework.Audio.SoundEffect..ctor(Stream stream)
bei Microsoft.Xna.Framework.Audio.SoundEffect.FromStream(Stream stream)
bei Terraria.ModLoader.Mod.Autoload()
Set the mods you want enabled/disabled, don't click reload but restart the game instead. Hopefully this issue is resolved in the next release.
 
Anyone know how to change vanilla tooltips now?
I was useing
Code:
public class ModedItem : GlobalItem{
public override void SetDefaults(Item item){
            switch(item.type)
            {
                case ItemID.DaedalusStormbow:
                    item.UseSound = null;
                    return;
                case ItemID.Grenade:
                case ItemID.StickyGrenade:
                case ItemID.BouncyGrenade:
                case ItemID.Beenade:
                case ItemID.PartyGirlGrenade:
                    item.ammo = 168;
                    return;
                case ItemID.UmbrellaHat:
                    item.vanity = false;
                    item.toolTip = "Slow falling speed";
                    item.defense = 1;
                    return;
}}}
But this just results in failure to compile
it tried
Code:
public override void SetStaticDefaults(Item item){
        switch(item.type)
            {
            case ItemID.UmbrellaHat
            //DisplayName.SetDefault("xxx");
            Tooltip.SetDefault("Slow falling speed");
            return;
            }
        }
But no dice

Can anyone help with this it would be much appreciated
Try using the ModifyTooltips() hook for this, it's intended for this stuff.
Code:
    public class MyGlobalItem : GlobalItem
    {
        public override void ModifyTooltips(Item item, List<TooltipLine> tooltips)
        {
            TooltipLine line = tooltips.FirstOrDefault(tooltip => // FirstOrDefault means we will get this tooltip line, or it will be null if it can't be found
                tooltip.mod == "Terraria" // Checks if the line comes from vanilla Terraria
                && tooltip.Name == "Tooltip0"); // Checks if the line is the tooltip line, first line

            if (line != null) // if the line is not null, it means we found it
            {
                switch (item.type) // switch on our item type
                {
                    case ItemID.UmbrellaHat:
                        line.text = "Slow falling speed"; // Set the line to something new
                        return;
                }
            }
        }
    }
 
Try using the ModifyTooltips() hook for this, it's intended for this stuff.
Code:
    public class MyGlobalItem : GlobalItem
    {
        public override void ModifyTooltips(Item item, List<TooltipLine> tooltips)
        {
            TooltipLine line = tooltips.FirstOrDefault(tooltip => // FirstOrDefault means we will get this tooltip line, or it will be null if it can't be found
                tooltip.mod == "Terraria" // Checks if the line comes from vanilla Terraria
                && tooltip.Name == "Tooltip0"); // Checks if the line is the tooltip line, first line

            if (line != null) // if the line is not null, it means we found it
            {
                switch (item.type) // switch on our item type
                {
                    case ItemID.UmbrellaHat:
                        line.text = "Slow falling speed"; // Set the line to something new
                        return;
                }
            }
        }
    }
Thanks for responding, Im a c# noob unfortunately..
Im getting a missing namespace or assembly reference now

Code:
\ModedItem.cs(27,56) : error CS0246: The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)
c script
Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Terraria.Localization;

namespace mymod
{
    public class ModedItem : GlobalItem
    {
        public override void ModifyTooltips(Item item, List<TooltipLine> tooltips)
        {
            TooltipLine line = tooltips.FirstOrDefault(tooltip => // FirstOrDefault means we will get this tooltip line, or it will be null if it can't be found
                tooltip.mod == "Terraria" // Checks if the line comes from vanilla Terraria
                && tooltip.Name == "Tooltip0"); // Checks if the line is the tooltip line, first line

            if (line != null) // if the line is not null, it means we found it
            {
                switch (item.type) // switch on our item type
                {
                    case ItemID.UmbrellaHat:
                        line.text = "Slow falling speed"; // Set the line to something new
                        return;
                }
            }
        }
I deleted some clutter from there but 27,56 was the first mention of List<>

Thankyou very much for your time, sorry for noob questions
 
My mod browser is broken for some reason...
It justs says Mod Browser Offline (UNKNOWN)

It is highly likely something is blocking the website that it needs to fetch data from. Try visiting the "manual browsing" link in the first post in your web browser, and see if you can figure out what.
 
It is highly likely something is blocking the website that it needs to fetch data from. Try visiting the "manual browsing" link in the first post in your web browser, and see if you can figure out what.
Ahhh I am currently in China so the website must be blocked here... Thanks!
 
Anyone know how to make can run in Windows 10 visual studio 2017? Can't find any posts that actually work??
[doublepost=1501297811,1501297774][/doublepost]Xna not can
[doublepost=1501297935][/doublepost]I got some code working with that monogame ###$#$$$ but?? XNA would be so much easier
 
Back
Top Bottom