Standalone [1.3] tModLoader - A Modding API

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

  1. Darkninja

    Darkninja Spazmatism

    sorry to bother you guys again
    but what does this (projectile.alpha) do?
     
  2. Eldrazi

    Eldrazi Eater of Worlds

    Do you know what alpha is? Alpha determines the transparancy of an image (more specifically a pixel, but...).
    Now normally an alpha of 0 would result in total transparancy and an alpha of 255 would be no transparancy at all, but it's quite the other way around when you're modding Terraria.
     
  3. Darkninja

    Darkninja Spazmatism

    i see now. tnx
    --- Double Post Merged, Dec 22, 2015, Original Post Date: Dec 22, 2015 ---
    also what determines how fast the projectile falls
    i tried decreasing the item.shootSpeed but didn't work
     
  4. Eldrazi

    Eldrazi Eater of Worlds

    This line:
    Code:
    float SpeedY = num17 + (float) Main.rand.Next(-40, 41) * 0.02f;
    
    You'll want to change the '0.02f' value for a different falling speed (the higher the value, the faster it'll fall).
     
  5. Darkninja

    Darkninja Spazmatism

    Btw here's how it looks
    Screenshot (14).png
     
    TMC likes this.
  6. wch

    wch Terrarian

    Em... there seems not to be a place where I can find all my references that easily. Form the first place this is a question about experience and knowledge which I need to learn, trying my best.
    So, yeah, really happy to hear that I can ask my silly little questions without limits:)
    Let me ask then.

    I've made myself an AWP, and it's really a huge weapon compared to the other items in the game, hence it really looks odd - it has a 107x32 size. Fortunately I got "item.scale" to solve this problem and it looks just perfect. But item.scale only defines the size of its using texture, by which I mean the size when using. The dropping texture remains surprisingly large. And the demon altar I've made actually has the same question. How should I adjust this?
     
  7. jopojelly

    jopojelly Retinazer

    Did you try this?
    https://github.com/bluemagic123/tMo...alphacolor-ref-float-rotation-ref-float-scale
    I think you should be able to change scale however you like. Try .5.
     
  8. raptor722

    raptor722 Terrarian

    jopojelly your tile help i super usefull aill use it ty and do you know how to make projectile that i gave extraupdates visible ?
    someone sais something about preAI and postAI but noone helped me with that :/
     
  9. wch

    wch Terrarian

    So I add it:
    Code:
            public virtual bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale)
            {
                scale = 0.5f;
            }
    Seems I got some usings missing, it says it can't find "SpriteBatch".
     
  10. blushiemagic

    blushiemagic Retinazer

    You'll need to add "using Microsoft.Xna.Framework.Graphics;" to the top.
     
  11. wch

    wch Terrarian

    Oh yeah. And now my AWP's dropping texture looks fine!
    Another thing... when I'm making a shield, I can set like the examplemod:
    Code:
            public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
            {
                equips.Add(EquipType.Shield);
                return true;
            }
    Then I'm now making a glove, what should I fill in the EquipType?
     
  12. jopojelly

    jopojelly Retinazer

    I think this will help: https://github.com/bluemagic123/tModLoader/wiki/EquipType

    I don't see how changing "projectile.extraUpdates;" would make your projectile invisible. Did it work with "projectile.extraUpdates = 0;"? Chances are you set "projectile.extraUpdates" so high the projectile flies off the screen before you even see it. Just post your code and we'll see the problem.
     
  13. wch

    wch Terrarian

    Now another questions appears agian!
    I'm making a NPC, some sorta knight type NPC. So ofc. it uses melee weapon.
    Then I set it up like this:
    Code:
                npc.name = "Guard";
                npc.townNPC = true;
                npc.friendly = true;
                npc.width = 18;
                npc.height = 40;
                npc.aiStyle = 7;
                npc.damage = 10;
                npc.defense = 45;
                npc.lifeMax = 250;
                npc.soundHit = 1;
                npc.soundKilled = 1;
                npc.knockBackResist = 0.5f;
                Main.npcFrameCount[npc.type] = 26;
                NPCID.Sets.ExtraFramesCount[npc.type] = 9;
                NPCID.Sets.AttackFrameCount[npc.type] = 4;
                NPCID.Sets.DangerDetectRange[npc.type] = 200;
                NPCID.Sets.AttackType[npc.type] = 207;
                NPCID.Sets.AttackTime[npc.type] = 20;
                NPCID.Sets.AttackAverageChance[npc.type] = 25;
                animationType = NPCID.Guide;
            }
    
    I think attack type is the same as the Dye Trader, who also uses melee weapon. But this Guard just won't attack whatever. What's wrong?
     
  14. jopojelly

    jopojelly Retinazer

    I think this should be 3, not 207.
     
  15. raptor722

    raptor722 Terrarian

    using System;
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;
    using Terraria;
    using Terraria.ID;
    using Terraria.ModLoader;

    namespace :red:.Projectiles //that face i just named that testing mod shiit wihout one i
    {
    public class LaserCartrige : ModProjectile
    {
    public override void SetDefaults()
    {
    projectile.name = "LaserCartrige";
    projectile.width = 10;
    projectile.height = 4;
    projectile.friendly = true;
    projectile.penetrate = 4;
    projectile.timeLeft = 99;
    projectile.tileCollide = true;
    projectile.ignoreWater = false;
    projectile.extraUpdates = 20;
    }
    public override void AI()
    {
    projectile.velocity.Y += projectile.ai[0];
    projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X);
    }
    }
    }

    This is it but someone sais that if i want to make look like laser i hae to make slow shootspeed and extraupdates about 10 or 20 and to make it look like line of laser add something to postAI or preAI
    --- Double Post Merged, Dec 22, 2015, Original Post Date: Dec 22, 2015 ---
    It should looks like shadowbeam staff projectile but in red
     
  16. blushiemagic

    blushiemagic Retinazer

    AttackType is a vanilla thing; it won't let you copy stuff that already exists. For this, you'll pretty much have to take a very thorough look at the documentation (and have a good understanding of how to override methods).

    Yeah, if you're not calling Dust.NewDust in your AI then 20 extra updates is way too fast.
     
  17. raptor722

    raptor722 Terrarian

    and how is the code looks like ?
     
  18. samufinland

    samufinland Terrarian

    Hey, what is the "installation resource file" the installer can't find?
    --- Double Post Merged, Dec 22, 2015, Original Post Date: Dec 22, 2015 ---
    Nevermind, just forgot to unzip the file
     
  19. psyryse

    psyryse Terrarian

    it said on on my download it can harm my computer
     
  20. blushiemagic

    blushiemagic Retinazer

    It will say that literally anything downloaded from the Internet can harm your computer. If you'll listen to that all the time, might as well not download anything from the Internet at all.
     
    goldenapple likes this.