Standalone [1.3] tModLoader - A Modding API

Where do I put my mod sources on linux? I can't find the correct directory! (All I can find on google is 'My Documents/My Games' etc.
 
I have a bit of a problem, might just be my computer or something, but when i put on armor of any type it makes my fps shoot from 60 to 20, with one piece. then from 20 to 10, then from 10 to 2. I literally cannot wear armor because of this. please help!
 
I have a bit of a problem, might just be my computer or something, but when i put on armor of any type it makes my fps shoot from 60 to 20, with one piece. then from 20 to 10, then from 10 to 2. I literally cannot wear armor because of this. please help!
its a tremor mod thing. it actively tries to find a set bonus for the armor, but cant find it, so it keeps searching. this causes lag.
 
its a tremor mod thing. it actively tries to find a set bonus for the armor, but cant find it, so it keeps searching. this causes lag.
Is there any way to fix this? or do i have to wait until they release a patch for this bug? It confuses me because vanilla armor seems to be effected as well...
 
The culprit seems to be the MaxStack plus mod, as soon as I enabled it the lag kicked in full force. I might do some tests with only that mod enabled to failsafe it. Edit: it hugely seems to be the case. With only it enabled, I top my FPS at 8 and get a solid 5 FPS most of the time.
I will test this a whole lot. I might take down the mod if it is lagging the game a whole lot.
 
So I got some problems about the conditions of equipping accessories.
Since 0.7 has fixed the hotkey issue, I start to get my hands on sheild limit stuff. Basically I made lots of shields, dozens of it, and what I want is to make a player only equip one shield at the same time.
First there're only WoodShield and IronShield, it actually works fine:
Code:
       public override bool CanEquipAccessory(Player player, int slot)
        {
            return player.HasItem(mod.ItemType("IronShield"));
        }
Code:
        public override bool CanEquipAccessory(Player player, int slot)
        {
            return player.HasItem(mod.ItemType("WoodShield"));
        }
I put these two snippets of codes into WoodShield and IronShield discretely. Then I won't be able to equip WoodShield when I already equipped IronShield, vice versa.
Then I guess if I put all the shields existed in WoodShield than it will not be able to be equipped whenever there is a shield:
Code:
       public override bool CanEquipAccessory(Player player, int slot)
        {
            return player.HasItem(mod.ItemType("AdamantiteShield"))
                        && player.HasItem(mod.ItemType("BorealWoodShield"))
                        && player.HasItem(mod.ItemType("Buckler"))
                        && player.HasItem(mod.ItemType("CactusShield"))
                        && player.HasItem(mod.ItemType("CopperShield"))
                        && player.HasItem(mod.ItemType("EbonwoodShield"))
                        && player.HasItem(mod.ItemType("IronShield"))
                        && player.HasItem(mod.ItemType("LavaShield"))
                        && player.HasItem(mod.ItemType("MoltenShield"))
                        && player.HasItem(mod.ItemType("MythrilShield"))
                        && player.HasItem(mod.ItemType("OrichalcumShield"))
                        && player.HasItem(mod.ItemType("PalladiumShield"))
                        && player.HasItem(mod.ItemType("PalmWoodShield"))
                        && player.HasItem(mod.ItemType("PlatinumShield"))
                        && player.HasItem(mod.ItemType("ShadewoodShield"))
                        && player.HasItem(mod.ItemType("ShadowShield"))
                        && player.HasItem(mod.ItemType("ShieldofAegis"))
                        && player.HasItem(mod.ItemType("SilverShield"))
                        && player.HasItem(mod.ItemType("TinShield"))
                        && player.HasItem(mod.ItemType("TitaniumShield"))
                        && player.HasItem(mod.ItemType("TungstenShield"));
        }
But it turned out that I can never equip it, whether there is a shield in my accessory slots or not.
About this player.HasItem, when a player truly has, it returns false right? This is why it will work when there is only one type of shield to judge. In this way, I think the codes I write to judge multiple shields are supposed to work too, since once there is a shield being equipped, there will be a false bool and contribute to making the whole chunk of codes return false.
Anyways, what's wrong here?
 
So I got some problems about the conditions of equipping accessories.
Since 0.7 has fixed the hotkey issue, I start to get my hands on sheild limit stuff. Basically I made lots of shields, dozens of it, and what I want is to make a player only equip one shield at the same time.
First there're only WoodShield and IronShield, it actually works fine:
Code:
       public override bool CanEquipAccessory(Player player, int slot)
        {
            return player.HasItem(mod.ItemType("IronShield"));
        }
Code:
        public override bool CanEquipAccessory(Player player, int slot)
        {
            return player.HasItem(mod.ItemType("WoodShield"));
        }
I put these two snippets of codes into WoodShield and IronShield discretely. Then I won't be able to equip WoodShield when I already equipped IronShield, vice versa.
Then I guess if I put all the shields existed in WoodShield than it will not be able to be equipped whenever there is a shield:
Code:
       public override bool CanEquipAccessory(Player player, int slot)
        {
            return player.HasItem(mod.ItemType("AdamantiteShield"))
                        && player.HasItem(mod.ItemType("BorealWoodShield"))
                        && player.HasItem(mod.ItemType("Buckler"))
                        && player.HasItem(mod.ItemType("CactusShield"))
                        && player.HasItem(mod.ItemType("CopperShield"))
                        && player.HasItem(mod.ItemType("EbonwoodShield"))
                        && player.HasItem(mod.ItemType("IronShield"))
                        && player.HasItem(mod.ItemType("LavaShield"))
                        && player.HasItem(mod.ItemType("MoltenShield"))
                        && player.HasItem(mod.ItemType("MythrilShield"))
                        && player.HasItem(mod.ItemType("OrichalcumShield"))
                        && player.HasItem(mod.ItemType("PalladiumShield"))
                        && player.HasItem(mod.ItemType("PalmWoodShield"))
                        && player.HasItem(mod.ItemType("PlatinumShield"))
                        && player.HasItem(mod.ItemType("ShadewoodShield"))
                        && player.HasItem(mod.ItemType("ShadowShield"))
                        && player.HasItem(mod.ItemType("ShieldofAegis"))
                        && player.HasItem(mod.ItemType("SilverShield"))
                        && player.HasItem(mod.ItemType("TinShield"))
                        && player.HasItem(mod.ItemType("TitaniumShield"))
                        && player.HasItem(mod.ItemType("TungstenShield"));
        }
But it turned out that I can never equip it, whether there is a shield in my accessory slots or not.
About this player.HasItem, when a player truly has, it returns false right? This is why it will work when there is only one type of shield to judge. In this way, I think the codes I write to judge multiple shields are supposed to work too, since once there is a shield being equipped, there will be a false bool and contribute to making the whole chunk of codes return false.
Anyways, what's wrong here?
Your logic is backwards, and you are checking the player inventory, not the equipment. The way you have it now, the player would only be able to equip a shield if they happen to have every single shield in the inventory.

What you want is to iterate over the armor slots.

Code:
        using System.Collections.Generic; // At top


        public override bool CanEquipAccessory(Player player, int slot)
        {
            List<int> others = new List<int> { mod.ItemType("Item2"), mod.ItemType("Item2") };
            for (int j = 0; j < player.armor.Length; j++)
            {
                if (others.Contains(player.armor[j].type))
                {
                    return false;
                }
            }
            return true;
        }
 
Hi there,

Is it just me or is the Example Mod v0.7 link faulty? It says ' permission denied' on my end. http://prntscr.com/9rktxh
Try manually putting in the URL, it seems to fix the problem.
Unable to update to 0.7. Still says i'm on 0.6 even when I re-installed Tmodloader.
Re-installed? There's no installer for v0.7. Read the README.txt in the zip file you downloaded to see which steps to complete.
Why custom minions are destroyed during collision with blocks? projectile.tileCollide= false...
Care to show us your code? ;)
 
Care to show us your code? ;)

public class CreeperStaffPro : Minion
{
public override void SetDefaults()
{
projectile.netImportant = true;
projectile.name = "CreeperStaff";
projectile.width = 24;
projectile.height = 32;
projectile.CloneDefaults(533);
aiType = 533;
Main.projFrames[projectile.type] = 1;
projectile.friendly = true;
projectile.minion = true;
projectile.minionSlots = 1;
projectile.penetrate = -1;
projectile.timeLeft = 18000;
projectile.tileCollide = false;
projectile.ignoreWater = true;
}

public override void CheckActive()
{
Player player = Main.player[projectile.owner];
TremorPlayer modPlayer = (TremorPlayer)player.GetModPlayer(mod, "TremorPlayer");
if (player.dead)
{
modPlayer.creeperMinion = false;
}
if (modPlayer.creeperMinion)
{
projectile.timeLeft = 2;
}
}
 
@Eldrazi, nevermind haha i got it off github.

I tried putting the tmodloader-master example code into D: > Documents > My Games> Terraria > ModLoader > ModSources folder: http://prntscr.com/9rlrp4
but i am getting this error when trying to build + reload :

http://prntscr.com/9rlqlx

Any idea what the problem is? Thanks!
What you placed in there was all the code for tModLoader, not just Example Mod. Delete it all and download from this alternate, and only copy in the ExampleMod folder: https://dl.dropboxusercontent.com/u/41490830/TerrariaModding/ExampleMod v0.7.zip
 
How to add several custom items on the start? (in SetupStartInventory method)
You could put this anywhere in your mod:
Code:
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;

namespace YourMod
{
    public class YourModPlayer : ModPlayer
    {
        public override void SetupStartInventory(IList<Item> items)
        {
            Item item = new Item();
            item.SetDefaults(mod.ItemType("Item1"));
            item.stack = 5;
            items.Add(item);

            item = new Item();
            item.SetDefaults(mod.ItemType("Item2"));
            item.stack = 96;
            items.Add(item);

            item = new Item();
            item.SetDefaults(mod.ItemType("Item3"));
            item.stack = 666;
            items.Add(item);
        }
    }
}
Notice how the 1st item code is slightly different from the rest.
 
You could put this anywhere in your mod:
Code:
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;

namespace YourMod
{
    public class YourModPlayer : ModPlayer
    {
        public override void SetupStartInventory(IList<Item> items)
        {
            Item item = new Item();
            item.SetDefaults(mod.ItemType("Item1"));
            item.stack = 5;
            items.Add(item);

            item = new Item();
            item.SetDefaults(mod.ItemType("Item2"));
            item.stack = 96;
            items.Add(item);

            item = new Item();
            item.SetDefaults(mod.ItemType("Item3"));
            item.stack = 666;
            items.Add(item);
        }
    }
}
Notice how the 1st item code is slightly different from the rest.
public override void SetupStartInventory(IList<Item> items)
{
items.RemoveAt(2);
items.RemoveAt(1);
items.RemoveAt(0);


Item item = new Item();
item.SetDefaults(mod.ItemType("Item1"));
item.stack = 1;
items.Add(item);

item = new Item();
item.SetDefaults(mod.ItemType("Item2"));
item.stack = 10;
items.Add(item);

}
It's creates only first item without second
 
Back
Top Bottom