• For issues you find with the Switch and Console releases, please follow this link and give as much detail as possible. This is the speediest way to get info to Pipeworks and get a hotfix in the works.
  • 1.4 will bring many changes to the PC version. We strongly advise making plans to back up your worlds and players prior to updating your game. More details here.
  • Begin your search for Journey's End information here and here. Please report bugs and issues for Journey's End here.
  • For issues you find with the Mobile 1.4 update, please follow this link and give as much detail as possible. This is the speediest way to get info to DR Studios to look at your issue. Also, some troubleshooting hints here.

Standalone [1.3] tModLoader - A Modding API

Hek

Eye of Cthulhu
Could you show me your code?
oh ok nvm. I just changed the 0.4 to 0.15
projectile.velocity.Y = projectile.velocity.Y + 0.15f;

Easier than what I would code ^^
[doublepost=1461608823,1461608690][/doublepost]
Could you show me your code?
Is it possible to let the projectile hit 3 times? The projetile are 3 shurikens, but when hitting enemies they are getting only damage by one source, e.g. one shuriken not 3
 

Eldrazi

Eater of Worlds
oh ok nvm. I just changed the 0.4 to 0.15
projectile.velocity.Y = projectile.velocity.Y + 0.15f;

Easier than what I would code ^^
[doublepost=1461608823,1461608690][/doublepost]
Is it possible to let the projectile hit 3 times? The projetile are 3 shurikens, but when hitting enemies they are getting only damage by one source, e.g. one shuriken not 3
Your best bet is to have the projectile fire slower after one another.
 

RotMGRooey

Skeletron Prime
Hey guys, I have a bug to report in the server. Everytime I try to spawn a boss so me and my friends can fight it, the summon gets used up but the boss doesn't spawn. I don't know if this is a bug with Thorium or the tmodloader, but if there's a fix could you let me know?

Thanks
 

Zero-Exodus

Pixel Pirate
to the best of my knowledge, spawning something, without going through its proper channels, doesn't work. a workaround (assuming you have the source) is to make the npc's canspawn to return 10 when the item is used. something like

public override float CanSpawn(NPCSpawnInfo s)
{
Player p = s.player;
if(p.inventory[p.selectedItem].type == mod.ItemType("SummonItem")) return 10;

probably not the best solution, but i just came up with it off the top of my head lol

OH RIGHT now i remember what i came for.

does anyone know how to make a properly functioning right-click item? using
AltFunctionUse(Player player) gets me weird results

edit: nevermind i figured it out. to use it properly i needed to add if(player.altFunctionUse != 2) to what i didnt want to get activated in UseItem. otherwise it activated it
 
Last edited:
Yeah... As its been asked a million times on the thread, would the issue with multiplayer boss spawning be the problem of the item used to summon it, or the ai of the boss itself wigging out with multiple players on screen? and to add onto that question, do the tModLoader guys know exactly what were doing wrong that makes our modded enemies disappear when hit? Is it our fault?
 

Flamingfury56

Terrarian
I need help, i am trying to make it so that if you are within a certain radius (about 10 to 20 blocks) of this projectile then you will get the regen buff. However it gives you regen if you are anywhere while the projectile is out. Anyone know how to do that or know what i'm doing wrong? Help would be much appreciated
Thank you in advance
Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using System;

namespace RCT.Projectiles
{
    public class MedicSphereBallProj : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Guardian Sphere Projectile";
            projectile.width = 20;
            projectile.height = 20;
            projectile.aiStyle = 47;
            projectile.ranged = true;
            projectile.penetrate = 2;
            projectile.timeLeft = 1800;
            projectile.ignoreWater = true;
            projectile.friendly = true;
            projectile.hostile = false;
            projectile.tileCollide = false;
           
        }
        public override void AI()
        {
            projectile.rotation += (float)projectile.direction * 0.8f;
           
                
            projectile.light = 1;
            Player owner = Main.player[projectile.owner];
            if (owner.position.X - projectile.position.X <= 10f && owner.position.Y - projectile.position.Y <= 10f || owner.position.X - projectile.position.X >= 10f && owner.position.Y - projectile.position.Y >= 10f || owner.position.X - projectile.position.X <= 10f && owner.position.Y - projectile.position.Y >= 10f || owner.position.X - projectile.position.X >= 10f && owner.position.Y - projectile.position.Y <= 10f)
            {
           
                    owner.AddBuff(2, 1800);

            }
        }
    }
}
 

jopojelly

Retinazer
tModLoader
I need help, i am trying to make it so that if you are within a certain radius (about 10 to 20 blocks) of this projectile then you will get the regen buff. However it gives you regen if you are anywhere while the projectile is out. Anyone know how to do that or know what i'm doing wrong? Help would be much appreciated
Thank you in advance
Code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using System;

namespace RCT.Projectiles
{
    public class MedicSphereBallProj : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Guardian Sphere Projectile";
            projectile.width = 20;
            projectile.height = 20;
            projectile.aiStyle = 47;
            projectile.ranged = true;
            projectile.penetrate = 2;
            projectile.timeLeft = 1800;
            projectile.ignoreWater = true;
            projectile.friendly = true;
            projectile.hostile = false;
            projectile.tileCollide = false;
         
        }
        public override void AI()
        {
            projectile.rotation += (float)projectile.direction * 0.8f;
         
              
            projectile.light = 1;
            Player owner = Main.player[projectile.owner];
            if (owner.position.X - projectile.position.X <= 10f && owner.position.Y - projectile.position.Y <= 10f || owner.position.X - projectile.position.X >= 10f && owner.position.Y - projectile.position.Y >= 10f || owner.position.X - projectile.position.X <= 10f && owner.position.Y - projectile.position.Y >= 10f || owner.position.X - projectile.position.X >= 10f && owner.position.Y - projectile.position.Y <= 10f)
            {
         
                    owner.AddBuff(2, 1800);

            }
        }
    }
}
Well, your logic is off. Just do this: (10 is pretty small though)

Code:
            Player owner = Main.player[projectile.owner];
            float distance = Vector2.Distance(owner.Center, projectile.Center);

            if (distance < 10f)
            {
                owner.AddBuff(2, 1800);
            }
 

blushiemagic

Retinazer
tModLoader
Yeah... As its been asked a million times on the thread, would the issue with multiplayer boss spawning be the problem of the item used to summon it, or the ai of the boss itself wigging out with multiple players on screen? and to add onto that question, do the tModLoader guys know exactly what were doing wrong that makes our modded enemies disappear when hit? Is it our fault?
The multiplayer bosses could be a problem with the item and/or the boss's AI; that would depend on the boss.

We still can't really decide what's causing modded enemies to disappear on hit. I think we're going to see if making servers sync mods with the clients helps anything first.
 

Flamingfury56

Terrarian
How come when i mine with my modded pickaxe that it mines so slowly compared to the Pickaxe Axe of vanilla terraria? Is there extra code to make it so that the actual mining if faster than the swing or am i just doing something wrong? If there is extra code to make it mine faster then some incite on how to do so would be very helpful.
Code:
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace RCT.Items.Tools
{
    public class DivineConversionPickaxeAxe : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Divine Conversion - Pickaxe-Axe";
            item.damage = 30;
            item.melee = true;
            item.width = 60;
            item.height = 60;
            item.useTime = 25;
            item.useAnimation = 25;
            item.axe = 23;
            item.pick = 205;
            item.useStyle = 1;
            item.knockBack = 6;
            item.value = 600000;
            item.rare = 5;
            item.useSound = 1;
            item.autoReuse = true;
          
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(null, "DivineConversionBlade", 1);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
     
    }
}
 

wch

Terrarian
EM... ambiguous again, sorry.
OnPickup is not suitable for my aim. Making OnPickup return false only stop the item appearing in the inventory, but I need to entirely ban a player from picking the item under certain circumstance. Something like... say, when a player's inventory was full, he can't even pick any items he doesn't have, right?
Since I resupply the durability of my throwing knife upon picking up the dropping items, I need to make sure that a player without relative throwing knife won't grab the dropping throwing knife accidentally. This will disappoint the player who is ready to grab his knives!
Still having a hard time denying a certain item from being picked.... Seems I cannot find how vanilla codes deny player from picking items when his inventory is full. So gotta have to ask again. Little help?
 

Eldrazi

Eater of Worlds
Still having a hard time denying a certain item from being picked.... Seems I cannot find how vanilla codes deny player from picking items when his inventory is full. So gotta have to ask again. Little help?
You can use this function to determine wether or not the item can be picked up. This does not apply to items being picked up from chests, so keep that in mind.
 

Zero-Exodus

Pixel Pirate
how do I use this?
public virtual bool CanExplode(int i, int j)
The int i and int j are the tile location. U can do things like
if(tile.type == ItemID.Anvils) return false;
if(Main.player[Main.myPlayer].position.X < i) return false;
and all kinds of trickery like that.
Personally I use it to prevent my house tiles from getting accidentally blown up when someone forgets they got stickybombs equipped

Edit: not to rush or anything, but i've kinda hit a roadblock in my modding.

i need some item related stuff, namely saving and loading (for GlobalItem). i would also like to make prefixes/suffixes, but the main thing i need is save/load.
also this is additional but i want to be able to
Code:
                if (tile.inActive())
                {
                    Wiring.ReActive(i, j);
                }
                else
                {
                    Wiring.DeActive(i, j);
                }
but i can't since its private
 
Last edited:

Eldrazi

Eater of Worlds
It is, with a bit of (I guess you could say) 'hacky' code.
You can override the Pre/PostDraw function on a class that derives from GlobalItem, which will make it so your UI is persistent.
Do note, however, that this is (like mentioned before) a 'hacky' approach, since offocial UI draw hooks have not been implemented in tModLoader as of yet.
 
Top Bottom