Standalone [1.3] tModLoader - A Modding API

But I don't want to fall victim to Works4Me-ism, so I can't guarantee that this will work on the Mac. There's no reason I can see that it shouldn't, though, unless Steam does some sort of mysterious .dylib balancing-act behind the scenes. Which it could, I guess. I dunno. Let us know!
This method of launching Terraria via the command line works perfectly. Granted, I have to navigate into common/Terraria/Terraria.app/Contents/MacOS instead of common/Terraria, but the procedure is exactly the same. I'll report back on my findings.

EDIT: Yep, I have the exact same results. Sounds started disappearing when the "SOURCE WAS NOT AVAILABLE" messages began to spam. Snippet of the end of the log (all previous messages are the "WARNING"s, and the technical part at the beginning, which I can provide upon request):
Code:
WARNING: AL SOURCE WAS NOT AVAILABLE. SKIPPING.
WARNING: AL SOURCE WAS NOT AVAILABLE. SKIPPING.
WARNING: AL SOURCE WAS NOT AVAILABLE. SKIPPING.
WARNING: AL SOURCE WAS NOT AVAILABLE. SKIPPING.
WARNING: AL SOURCE WAS NOT AVAILABLE. SKIPPING.
WARNING: AL SOURCE WAS NOT AVAILABLE. SKIPPING.
WARNING: AL SOURCE WAS NOT AVAILABLE. SKIPPING.
WARNING: AL SOURCE WAS NOT AVAILABLE. SKIPPING.
AL lib: (WW) FreeContext: (0x797433a0) Deleting 256 Source(s)
AL lib: (WW) FreeDevice: (0x79bb0e00) Deleting 109 Buffer(s)
AL lib: (WW) FreeDevice: (0x79bb0e00) Deleting 1 Filter(s)

EDIT: Here's the issue I posted on GitHub. I figured it would be good to post it here.
https://github.com/bluemagic123/tModLoader/issues/28
 
Last edited:
Kind of... unnecesary? But, everytime i get to open my TmodLoader, my sound gets cut. I've replaced the wavebanks more than once, but it just doesn't want to display the sound.
 
When I equip a full set of armour from my mod the damage of ranged weapons (a weapon that deals 40 damage with a set of vanilla armour deals 1 damage with a set of armour from my mod). When I equip a full set of either vanilla armour or vanity armour from my mod, the damage is correct. The damage is correct when I don't have a full set of armour from my mod on.

A download: https://www.dropbox.com/s/y2jl99lkvaiq5cf/CakeMod.zip?dl=0


BTW
How do I make a recipe require a certain sized stack of mod items? I can do stacks of vanilla items and a stack of 1 modded item.
 
not too sure if this has already been answered, but it seems that either a mod, or tmod itself has removed aglets, anklets of the wind, and spectre boots as materials, if this is indeed a tmod bug, could it possibly be looked at?
 
not too sure if this has already been answered, but it seems that either a mod, or tmod itself has removed aglets, anklets of the wind, and spectre boots as materials, if this is indeed a tmod bug, could it possibly be looked at?
Hm, they appear as materials normally for me, and I'm able to craft the Lightning Boots. What mods are you using?
 
How do I make a recipe require a certain sized stack of mod items? I can do stacks of vanilla items and a stack of 1 modded item.

I think you are asking about requireing more than 1 of an item in a recipe? The docs are helpful:https://github.com/bluemagic123/tMo...lic-void-addingredientint-itemid-int-stack--1

You can see that an optional parameter called stack can be used. "recipe.AddIngredient(ItemID.Acorn, 10);"

When I equip a full set of armour from my mod the damage of ranged weapons (a weapon that deals 40 damage with a set of vanilla armour deals 1 damage with a set of armour from my mod). When I equip a full set of either vanilla armour or vanity armour from my mod, the damage is correct. The damage is correct when I don't have a full set of armour from my mod on.

A download: https://www.dropbox.com/s/y2jl99lkvaiq5cf/CakeMod.zip?dl=0
Your armor set bonus is this:
player.rangedDamage *= 0.10f;
This will cause a 90% reduction in rangedDamage. Vanilla exaple: player.rangedDamage += 0.1f;
 
Does anybody know how I would create an Arkhalis like weapon?
I can not seem to put any code together that works
Arkhalis is basically a projectile that moves with the player and points towards the cursor. The most important part is item.channel = true;. If you have decompiled terraria, you can look in AI_075() and type == 595 and see how it checks things like player.channel to know that the left mouse is still being held down. Let me know where you are at.
 
Arkhalis is basically a projectile that moves with the player and points towards the cursor. The most important part is item.channel = true;. If you have decompiled terraria, you can look in AI_075() and type == 595 and see how it checks things like player.channel to know that the left mouse is still being held down. Let me know where you are at.
How would I get the item done?
I want the weapon while in use to make the player move in the direction the arkhalis projectile is pointed at
 
How can I make an enemy spawn only in the dungeon. I've tried:

spawnInfo.dungeon
spawnInfo.worldDungeon
spawnInfo.Main.dungeon
spawnInfo.Main.Dungeon
etc.
etc.

and nothing seems to work.

I also have a problem when one of my enemy npcs jumps or turns or gets hit its texture becomes a 4 pixel wide grayish tan pillar that is as tall as the frames are and then when the npc hits the ground or starts to move in one direction or isn't being hit, the texture returns to how it's supposed to look.

help me please
spawnInfo.player.ZoneDungeon

You might not have the right amount of frames for the animationType you are using.

How would I make an ore only spawn in ash blocks? Or to just get an ore to spawn in the Underworld layer in general?
If you are using the ExampleWorld example, change the
WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY),
to
WorldGen.genRand.Next(Main.maxTilesY - 200, Main.maxTilesY),

Or, for ash blocks, you can bring out those random numbers to variables, then check Main.tile[x,y].type == TileID.Ash in that for loop.

How do i add Custom Boss Music to a Boss?
In the npc's SetDefaults: music = this.GetSoundSlot(SoundType.Music, "Sounds/Music/DriveMusic");
[doublepost=1465024767,1465024651][/doublepost]
How would I get the item done?
I want the weapon while in use to make the player move in the direction the arkhalis projectile is pointed at
I'm not really sure about the moving the player, maybe change player.Velocity. Anyway, I'd start out by copying all the parameters for the arkhalis projectile and item from the spreadsheets on the github wiki, see what you can get working.
 

spawnInfo.player.ZoneDungeon

You might not have the right amount of frames for the animationType you are using.


If you are using the ExampleWorld example, change the
WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY),
to
WorldGen.genRand.Next(Main.maxTilesY - 200, Main.maxTilesY),

Or, for ash blocks, you can bring out those random numbers to variables, then check Main.tile[x,y].type == TileID.Ash in that for loop.


In the npc's SetDefaults: music = this.GetSoundSlot(SoundType.Music, "Sounds/Music/DriveMusic");
[doublepost=1465024767,1465024651][/doublepost]
I'm not really sure about the moving the player, maybe change player.Velocity. Anyway, I'd start out by copying all the parameters for the arkhalis projectile and item from the spreadsheets on the github wiki, see what you can get working.
I could possibly get the weapon to act the way I want it to by making velocity go towards the cursor
 
spawnInfo.player.ZoneDungeon

You might not have the right amount of frames for the animationType you are using.


If you are using the ExampleWorld example, change the
WorldGen.genRand.Next((int)WorldGen.worldSurfaceLow, Main.maxTilesY),
to
WorldGen.genRand.Next(Main.maxTilesY - 200, Main.maxTilesY),

Or, for ash blocks, you can bring out those random numbers to variables, then check Main.tile[x,y].type == TileID.Ash in that for loop.


In the npc's SetDefaults: music = this.GetSoundSlot(SoundType.Music, "Sounds/Music/DriveMusic");
[doublepost=1465024767,1465024651][/doublepost]
I'm not really sure about the moving the player, maybe change player.Velocity. Anyway, I'd start out by copying all the parameters for the arkhalis projectile and item from the spreadsheets on the github wiki, see what you can get working.


Im Getting these Error

Code:
c:\Users\lukas\Documents\My Games\Terraria\ModLoader\Mod Sources\BossTest\NPCs\Boss\EyeOfCthulhuV2.cs(35,26) : error CS1061: 'BossTest.NPCs.Boss.EyeOfCthulhuV2' enthält keine Definition für 'GetSoundSlot', und es konnte keine Erweiterungsmethode 'GetSoundSlot' gefunden werden, die ein erstes Argument vom Typ 'BossTest.NPCs.Boss.EyeOfCthulhuV2' akzeptiert (Fehlt eine Using-Direktive oder ein Assemblyverweis?).

what should i add to the Refference part to make it work?
 
I have a new error.

The weapon:
Code:
namespace CakeMod.Items.Weapons
{
    public class R20S : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "RIA 20 Striker"; 
            item.damage = 40; 
            item.ranged = true;  
            item.width = 33;    
            item.height = 20;  
            item.toolTip = "";  
            item.useTime = 25; 
            item.useAnimation = 25;
            item.useStyle = 5;   
            item.noMelee = true;
            item.knockBack = 4;
            item.value = 10000;
            item.rare = 2;
            item.useSound = 11;
            item.autoReuse = false;
            item.shoot = 10;
            item.shootSpeed = 16f;
            item.useAmmo = ProjectileID.Bullet;
        }

        public override void AddRecipes() 
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.HellstoneBar, 30);
            recipe.AddIngredient(mod.ItemType("R20DSC"));
            recipe.AddTile(TileID.Hellforge);  
            recipe.SetResult(this);
            recipe.AddRecipe();
        }

    public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
    {
        target.AddBuff(BuffID.OnFire, 5);
    }
    }
}


The error:
c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\Weapons\R20S.cs(40,32) : error CS0246: The type or namespace name 'Player' could not be found (are you missing a using directive or an assembly reference?)

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\Weapons\R20S.cs(40,47) : error CS0246: The type or namespace name 'NPC' could not be found (are you missing a using directive or an assembly reference?)



The bit in the weapon code that causes the On Fire debuff was copied from the example mod.
 
I have a new error.

The weapon:
Code:
namespace CakeMod.Items.Weapons
{
    public class R20S : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "RIA 20 Striker";
            item.damage = 40;
            item.ranged = true; 
            item.width = 33;   
            item.height = 20; 
            item.toolTip = ""; 
            item.useTime = 25;
            item.useAnimation = 25;
            item.useStyle = 5;  
            item.noMelee = true;
            item.knockBack = 4;
            item.value = 10000;
            item.rare = 2;
            item.useSound = 11;
            item.autoReuse = false;
            item.shoot = 10;
            item.shootSpeed = 16f;
            item.useAmmo = ProjectileID.Bullet;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.HellstoneBar, 30);
            recipe.AddIngredient(mod.ItemType("R20DSC"));
            recipe.AddTile(TileID.Hellforge); 
            recipe.SetResult(this);
            recipe.AddRecipe();
        }

    public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
    {
        target.AddBuff(BuffID.OnFire, 5);
    }
    }
}


The error:
c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\Weapons\R20S.cs(40,32) : error CS0246: The type or namespace name 'Player' could not be found (are you missing a using directive or an assembly reference?)

c:\Users\Administrator\Documents\My Games\Terraria\ModLoader\Mod Sources\CakeMod\Items\Weapons\R20S.cs(40,47) : error CS0246: The type or namespace name 'NPC' could not be found (are you missing a using directive or an assembly reference?)



The bit in the weapon code that causes the On Fire debuff was copied from the example mod.

Is that your entire code? Do you have any using directives at all?
 
It's the entire code of that specific weapon.
BTW what is a directive?

Add "using Terraria;" to your Using Part and it should work
[doublepost=1465040017,1465039888][/doublepost]The Most Minimalistic Using Part whould look so
for your Code

Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

I think these Codw wil work
Code:
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;


namespace CakeMod.Items.Weapons
{
    public class R20S : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "RIA 20 Striker";
            item.damage = 40;
            item.ranged = true;
            item.width = 33;
            item.height = 20;
            item.toolTip = "";
            item.useTime = 25;
            item.useAnimation = 25;
            item.useStyle = 5;
            item.noMelee = true;
            item.knockBack = 4;
            item.value = 10000;
            item.rare = 2;
            item.useSound = 11;
            item.autoReuse = false;
            item.shoot = 10;
            item.shootSpeed = 16f;
            item.useAmmo = ProjectileID.Bullet;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.HellstoneBar, 30);
            recipe.AddIngredient(mod.ItemType("R20DSC"));
            recipe.AddTile(TileID.Hellforge);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }

        public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
        {
            target.AddBuff(BuffID.OnFire, 5);
        }
    }
}
 
Im Getting these Error

Code:
c:\Users\lukas\Documents\My Games\Terraria\ModLoader\Mod Sources\BossTest\NPCs\Boss\EyeOfCthulhuV2.cs(35,26) : error CS1061: 'BossTest.NPCs.Boss.EyeOfCthulhuV2' enthält keine Definition für 'GetSoundSlot', und es konnte keine Erweiterungsmethode 'GetSoundSlot' gefunden werden, die ein erstes Argument vom Typ 'BossTest.NPCs.Boss.EyeOfCthulhuV2' akzeptiert (Fehlt eine Using-Direktive oder ein Assemblyverweis?).

what should i add to the Refference part to make it work?
try
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
 
Back
Top Bottom