Standalone [1.3] tModLoader - A Modding API

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

  1. direwolf420

    direwolf420 Terrarian

    did you set a projectile.timeLeft correctly?
    like here: https://github.com/blushiemagic/tMo...mpleMod/Projectiles/Minions/PurityWisp.cs#L34
     
    Last edited: Dec 31, 2018
  2. Chapface

    Chapface Terrarian

    I dont actually think I put "projectile.timeout" in it. I have "projectile.timeLeft" in it though.

    Here is the code just in case:

    Code:
    using Microsoft.Xna.Framework;
    using Terraria;
    using Terraria.ID;
    using Terraria.ModLoader;
    
    namespace BATIM.Projectiles.Minions
    {
        public class BabyBlob : ModProjectile
        {
            public override void SetStaticDefaults()
            {
                DisplayName.SetDefault("Baby Blob");
                Main.projFrames[projectile.type] = 6;
                ProjectileID.Sets.MinionSacrificable[projectile.type] = true;
                ProjectileID.Sets.Homing[projectile.type] = true;
                ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true;
            }
              
            public override void SetDefaults()
            {
                projectile.CloneDefaults(ProjectileID.BabySlime);
                aiType = ProjectileID.BabySlime;
                projectile.friendly = true;
                projectile.minion = true;
                projectile.minionSlots = 1;
                projectile.tileCollide = true;
                projectile.ignoreWater = true;
                projectile.alpha = 0;
                projectile.width = 30;
                projectile.height = 28;
                projectile.penetrate = -1;
                projectile.timeLeft = 18000;
            }
    
            public override bool PreAI()
            {
                Player player = Main.player[projectile.owner];
                return true;
            }
    
            public override void AI()
            {
                Player player = Main.player[projectile.owner];
                BATIMPlayer modPlayer = player.GetModPlayer<BATIMPlayer>(mod);
                if (player.dead)
                {
                    modPlayer.BabyBlob = false;
                }
                if (modPlayer.BabyBlob)
                {
                    projectile.timeLeft = 2;
                }
            }
          
          
            public override bool OnTileCollide(Vector2 oldVelocity)
            {
                if (projectile.penetrate == 0)
                {
                    projectile.Kill();
                }
                return false;
                }
        }
    }
    Edit: I didn't notice the link before, from the looks of it however I did do it correctly
    (I could be entirely wrong though)
     
  3. direwolf420

    direwolf420 Terrarian

    you need to reset modPlayer.BabyBlob in ResetEffects() in your player class
     
  4. Chapface

    Chapface Terrarian

    Ok, I added the reset thing, but now it says the following message:

    Code:
    c:\Users:owner\Documents\My Games\ Terraria\Modloader\Mod Sources\BATIM\ BatimPlayer.cs(26,1) : error CS1513:
    } expected
    this would be an easy fix but I did it properly from my understanding

    Code:
    using System;
    using System.Collections.Generic;
    using System.IO;
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;
    using Terraria;
    using Terraria.DataStructures;
    using Terraria.ID;
    using Terraria.ModLoader;
    using Terraria.ModLoader.IO;
    using Terraria.GameInput;
    
    namespace BATIM
    {
        public class BATIMPlayer : ModPlayer
        {
            public bool FlyingInkBlot = false;
            public bool BabyBlob = false;
          
            public override void ResetEffects()
            {
                public bool FlyingInkBlot = false;
                public bool BabyBlob = false;
            }
    
        }
    }
    
    Edit: I found my obvious mistake and fixed it. thanks for the previous help
     
    Last edited: Jan 1, 2019
  5. Yvori

    Yvori Terrarian

    An easy way to deal with this is to hold Shift before it gets to the mod loading. It will then automatically not load in your mods, just tModLoader, so you'll be able to disable them from the mods menu. Generally, too many mods will overload Terraria due to its nature as a 32 bit program, and therefore its 4GB memory limit.
    As has already been stated by others, you can also manually edit the enabled.json, or if you really want to, you can delete the .tmod files from your Mods folder to entirely uninstall them (usually Documents\My Games\Terraria\ModLoader\Mods, which if I recall, is also where enabled.json is located.)
     
  6. Niko 4

    Niko 4 Terrarian

    почему нет версии на windows
     
  7. Generic Name

    Generic Name Terrarian

    How do I find the .json file?
    --- Double Post Merged, Jan 3, 2019, Original Post Date: Jan 3, 2019 ---
    N
    Nevermind
     
  8. NKSHV

    NKSHV Terrarian

    when next version with fixed black screen on linux release?
     
  9. Sylent :^)

    Sylent :^) Plantera

    What are the ways to create an explosion? I want to make my NPC explode on death or if it is set on fire (I would assume for the explode when set on fire thing I would do that in the AI).
     
  10. Argh

    Argh Terrarian

    You'd just create a short-lived projectile with some dust for the explosion effect
     
  11. Kablamo

    Kablamo Terrarian

    Is GOG ever gonna get tModLoader support again?
     
  12. Lemon Pai

    Lemon Pai Terrarian

    how do you transfer player data to Tmod? Mac version
     
  13. unknown entity303

    unknown entity303 Terrarian

    please add a button for character missing mods to download them
     
  14. eRROR.PNG Can somebody help me? everytime I click on Singleplayer in the main menu my game crashes with this message
    --- Double Post Merged, Jan 13, 2019, Original Post Date: Jan 13, 2019 ---
    the letters outside of the white box are because I used snipping tool to capture the white box with discord behind it
     
    Insomniac likes this.
  15. Insomniac

    Insomniac Steampunker

    That's a problem with Terraria. Delete and reinstall Terraria, then redo tModLoader.
     
  16. that did not work
     
    Insomniac likes this.
  17. Insomniac

    Insomniac Steampunker

    What mods do you have installed?
     
  18. it varies, no matter what combination it still crashes with the exact same message, the least mods I used were 4, and only 1 of them added items in a count of only around 50 or less
     
    Insomniac likes this.
  19. Insomniac

    Insomniac Steampunker

    Try running the game with no mods on, if that does not work remove tModLoader. If neither of those things work than there will be something wrong with Terraria entirely
     
  20. Godley

    Godley Terrarian

    so, if i'm working with a pre-built csproj, do i just chuck it into a mod file? or do i remove the .txt then put it in?