Standalone [1.3] tModLoader - A Modding API

tModLoader does not support custom projectiles yet
But it can fire Terraria projetiles.

item.shoot = 116; // Projectile for beam sword
item.shootSpeed = 12f; // Float value for speed
[DOUBLEPOST=1437568277,1437567921][/DOUBLEPOST]
Code:
    {
        player.movementSpeed += 10;
    }
How i can increase movement speed? This is not work
 
But it can fire Terraria projetiles.

item.shoot = 116; // Projectile for beam sword
item.shootSpeed = 12f; // Float value for speed
[DOUBLEPOST=1437568277,1437567921][/DOUBLEPOST]
Code:
    {
        player.movementSpeed += 10;
    }
How i can increase movement speed? This is not work
use Visual Studio, it tells you all the values you can use
 
Trying to get into modding, one thing I do want to try is custom banners, I want to be able to change their effects as well, so either I'm blind or there isn't an example in the exampleMod.
Thanks!
 
But it can fire Terraria projetiles.

item.shoot = 116; // Projectile for beam sword
item.shootSpeed = 12f; // Float value for speed
[DOUBLEPOST=1437568277,1437567921][/DOUBLEPOST]
Code:
    {
        player.movementSpeed += 10;
    }
How i can increase movement speed? This is not work

Use this:
Code:
        public override void UpdateEquip(Player player)
        {
            player.moveSpeed += 0.15f; //adds 15% movement speed
        }
 
Is there any way to speed up the animation of an item? I am trying to animate my own souls but their animation is much slower than the animation the vanilla souls use.
 
Is there any way to speed up the animation of an item? I am trying to animate my own souls but their animation is much slower than the animation the vanilla souls use.

Use this for the animation:

Code:
        public override DrawAnimation GetAnimation()
        {
            return new DrawAnimationVertical(5, 4);
        }

Then set this in your SetDefaults:

Code:
ItemID.Sets.AnimatesAsSoul[item.type] = true;

You'll obviously need a vertical png image that it can animate, and then the height of the soul should also be the height of the frame that it takes.
 
Use this for the animation:

Code:
        public override DrawAnimation GetAnimation()
        {
            return new DrawAnimationVertical(5, 4);
        }

Then set this in your SetDefaults:

Code:
ItemID.Sets.AnimatesAsSoul[item.type] = true;

You'll obviously need a vertical png image that it can animate, and then the height of the soul should also be the height of the frame that it takes.
Aha, yea I already had that but I had not (5, 4). I thought the five meant something else than the speed. Thanks for the help!
 
return new DrawAnimationVertical(int ticksperframe, int animationcount);

I set my ticksperframe to 5, it's pretty close to vanilla if not even like vanilla. My png file has 4 frames vertical, so I set animationcount to 4.
Here's how my souls look in-game:
[DOUBLEPOST=1437575980,1437575440][/DOUBLEPOST]@bluemagic123 I think there's a bug. Everytime I'm in corruption zone randomly Queen Bee spawns. Happened to me yesterday, 2 spawned right after each other out of nowhere. Just had it again now, went to Corruption: poof, Queen Bee apppears (with message in chat)
 
a thing i just noticed about my problem: it has no problem building the mod it seems but it crashes when i try and reload it :p
That's what we already knew. It's hard to tell what's happening without the full code and file structure of the mod.

Is there any posibility of adding drops to vanilla mobs?
That will be possible once I add GlobalNPC, hopefully in a few weeks.

But I need percents...
The crit values are treated as percentages in integers.

Code:
    {
        player.movementSpeed += 10;
    }
How i can increase movement speed? This is not work
Try moveSpeed instead of movementSpeed.

Err... Does axe power increases fivefold?

item.axe = 45 in code, but 225 ingame...
Yes, it does get multiplied by 5. I remember a similar thing happened when I was making a mod for tAPI.

return new DrawAnimationVertical(int ticksperframe, int animationcount);

I set my ticksperframe to 5, it's pretty close to vanilla if not even like vanilla. My png file has 4 frames vertical, so I set animationcount to 4.
Here's how my souls look in-game:
[DOUBLEPOST=1437575980,1437575440][/DOUBLEPOST]@bluemagic123 I think there's a bug. Everytime I'm in corruption zone randomly Queen Bee spawns. Happened to me yesterday, 2 spawned right after each other out of nowhere. Just had it again now, went to Corruption: poof, Queen Bee apppears (with message in chat)
Hm, it shouldn't be necessary to set AnimatesAsSoul to true; I didn't need that for the face item.
For the Queen Bee bug, do you think maybe the larva tiles (or whatever they're called) got destroyed naturally? I remember that on reddit there's often posts of Queen Bee spawning right at spawn or at some other random times.
 
Hm, it shouldn't be necessary to set AnimatesAsSoul to true; I didn't need that for the face item.

If you don't the animation gets pretty screwed, for me at least.

For the Queen Bee bug, do you think maybe the larva tiles (or whatever they're called) got destroyed naturally? I remember that on reddit there's often posts of Queen Bee spawning right at spawn or at some other random times.

No it happens in any world I create (vanilla world into tModLoader folder) and I believe only in corruption. I don't even do anything, Queen Bee just suddenly spawns.
 
If you don't the animation gets pretty screwed, for me at least.



No it happens in any world I create (vanilla world into tModLoader folder) and I believe only in corruption. I don't even do anything, Queen Bee just suddenly spawns.
Hm, that's pretty weird. Does the face item in the example mod also go all weird for you?

Also, I'm not able to duplicate the Queen Bee spawning. This happens for multiple different corruption worlds?
 
No not weird, but I mean.. The animation will be insanely fast in my inventory. Now it is the same in both my inventory and in the world.
Also, I'm not able to duplicate the Queen Bee spawning. This happens for multiple different corruption worlds?

Yes I made a new 1.3.0.6 vanilla world today and converted it. Already had explored quite a bit and killed all the queen bees that I could find before converting it, still it happened. I fly into the corruption poof, suddenly there's queen bee again.
 
No not weird, but I mean.. The animation will be insanely fast in my inventory. Now it is the same in both my inventory and in the world.


Yes I made a new 1.3.0.6 vanilla world today and converted it. Already had explored quite a bit and killed all the queen bees that I could find before converting it, still it happened. I fly into the corruption poof, suddenly there's queen bee again.
That's weird. It's even fast for very long frame durations? The face item works fine for me. The problem with AnimatesAsSoul is that it doesn't allow you to customize your animations.

I'll attempt to replicate the Queen Bee bug. (Heh, a bug involving a bug.) I've already tried with one vanilla corruption world, but that was generated in 1.3.0.1. If it really is a bug and if I had to guess I bet it would be another decompile bug with casting shorts >.<
 
That's weird. It's even fast for very long frame durations? The face item works fine for me. The problem with AnimatesAsSoul is that it doesn't allow you to customize your animations.

I don't know. It was insanely fast in my inventory, but how I wanted it when I dropped a soul. When I set AnimatesAsSoul it was also fine in my inventory. And what do you mean with customize?

I'll attempt to replicate the Queen Bee bug. (Heh, a bug involving a bug.) I've already tried with one vanilla corruption world, but that was generated in 1.3.0.1. If it really is a bug and if I had to guess I bet it would be another decompile bug with casting shorts >.<

Might it be because of my custom scythe? You remember it shoots around 8 demon scythes, and I set tileCollide to false.. Seeing as demon scythes are supposed to stop when hitting a tile and I disabled that, they go all across the map and might destroy a queen bee tile? Thing is, I want the demon scythes to shoot further for a certain length, and then make them come back again (like a sort of boomerang effect) and when they return they'll disappear.
 
I don't know. It was insanely fast in my inventory, but how I wanted it when I dropped a soul. When I set AnimatesAsSoul it was also fine in my inventory. And what do you mean with customize?



Might it be because of my custom scythe? You remember it shoots around 8 demon scythes, and I set tileCollide to false.. Seeing as demon scythes are supposed to stop when hitting a tile and I disabled that, they go all across the map and might destroy a queen bee tile? Thing is, I want the demon scythes to shoot further for a certain length, and then make them come back again (like a sort of boomerang effect) and when they return they'll disappear.
By customize, I mean with your own number of frames and with your own frame durations. (Note that lower frame durations mean a faster animation.)

Hm, it's possible that your scythes are causing that, but it's highly unlikely. First of all, when you close a world, projectiles aren't saved. So that means the scythes would have to be used every time this happens. Second of all, with the accuracy that would be required, that means you would be hitting a larva every time you use the scythes after you open a world.
Edit: Although it's more likely if you're just spamming the scythe as you move.

Code:
player.QuickSpawnItem(null, "Copper Ring");
How i can spawn mod items? This one not works
QuickSpawnItem is a method from the vanilla source code. So you'll have to use player.QuickSpawnItem(ModLoader.GetMod("ModName").ItemType("ItemName"));
 
QuickSpawnItem is a method from the vanilla source code. So you'll have to use player.QuickSpawnItem(ModLoader.GetMod("ModName").ItemType("ItemName"));

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

namespace AccessoryPlus.Items {
public class RingBag : ModItem
{
    public override void SetDefaults()
    {
        item.width = 20;
        item.height = 20;
        item.toolTip = "Right click for goodies!";
        item.rare = 2;
    }

    public override bool CanRightClick()
    {
        return true;
    }

    public override void RightClick(Player player)
    {
       
     player.QuickSpawnItem(ModLoader.GetMod("AccessoryPlus").ItemType("Copper Ring"));
    }
}}

So, i added this, but in game nothing happens. When i right click Ring bag, interface lagging for a second and bag is not dissapear.
 
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace AccessoryPlus.Items {
public class RingBag : ModItem
{
    public override void SetDefaults()
    {
        item.width = 20;
        item.height = 20;
        item.toolTip = "Right click for goodies!";
        item.rare = 2;
    }

    public override bool CanRightClick()
    {
        return true;
    }

    public override void RightClick(Player player)
    {
      
     player.QuickSpawnItem(ModLoader.GetMod("AccessoryPlus").ItemType("Copper Ring"));
    }
}}

So, i added this, but in game nothing happens. When i right click Ring bag, interface lagging for a second and bag is not dissapear.
If that's happening, that means that an item called "Copper Ring" does not exist. Did you give the item an internal name (then name when you're adding the item) of "CopperRing"? If so, use that.
 
Back
Top Bottom