Standalone [1.3] tModLoader - A Modding API

Discussion in 'Works-in-Progress' started by blushiemagic, Jul 7, 2015.

  1. Proxiehunter

    Proxiehunter Terrarian

    And it should be clarified that everyone has to have the mods being used installed and enabled. At least that's how I recall hearing it works, I haven't really done multiplayer personally.
     
  2. alexzhang05

    alexzhang05 Terrarian

    Every time I open Mod Browser it says Mod Browser offline (Unknown).
     
  3. Saobie

    Saobie Terrarian

    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
     
  4. rebeL

    rebeL Terrarian

    Aight, so the TModLoader download link works now, gentlemen, least for me.
     
    Jofairden likes this.
  5. Ronon Omega

    Ronon Omega Terrarian

    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
     
  6. Miristdasschnuppe

    Miristdasschnuppe Terrarian

    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: Jul 28, 2017
  7. heresyandtreachery

    heresyandtreachery Official Terrarian

    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
     
  8. Saobie

    Saobie Terrarian

    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
     
  9. Callum Johnson

    Callum Johnson Terrarian

    When will tmodloader be out for version 1.3.5.3??
     
  10. jopojelly

    jopojelly Retinazer

    That is not needed at all, and for all intents and purposes it already is.
     
  11. Jofairden

    Jofairden The Destroyer

    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.
     
  12. Callum Johnson

    Callum Johnson Terrarian

    Yeah but i cant play with people that dont have tmodloader.
     
  13. Jofairden

    Jofairden The Destroyer

    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;
                    }
                }
            }
        }
     
  14. Jofairden

    Jofairden The Destroyer

    And you will never. If you want to play with them they should either get tModLoader or you should revert to vanilla.
     
  15. Ronon Omega

    Ronon Omega Terrarian

    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
     
  16. Callum Johnson

    Callum Johnson Terrarian

    why will i never be able to?
     
  17. jopojelly

    jopojelly Retinazer

    We haven't programmed tmodloader to allow connecting to vanilla servers. That would just crash things.
     
  18. Callum Johnson

    Callum Johnson Terrarian

    ahhh ok i didnt know that but thanks for your help
     
  19. alexzhang05

    alexzhang05 Terrarian

    My mod browser is broken for some reason...
    It justs says Mod Browser Offline (UNKNOWN)
     
  20. SlippyCheeze

    SlippyCheeze Terrarian

    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.