Standalone [1.3] tModLoader - A Modding API

Um one issue. I have this varible. But when I check the varible, I dont get affected by knockback, but I still take damage!

if(this.bubbleActive)
{
damage = 0;
player.noKnockback = true; // Will take 0 damage when the player is hurt when the bubble is active.
}
 
One last question (geez) How can I make it so when a varible is true the player glows purple?
 
o _ o

so, custom reforge slot..... can anyone help me or no?
It'd be really hard. Try going through the vanilla code and seeing how it works and seeing where the hooks are.
does anyone know if it is possible to have one mod sell items from another mod?
yeah
Code:
        public override void SetupShop(Chest shop, ref int nextSlot)
        {
            if (ModLoader.GetLoadedMods().Contains("SummonersAssociation"))
            {
                shop.item[nextSlot].SetDefaults(ModLoader.GetMod("SummonersAssociation").ItemType("BloodTalisman"));
                nextSlot++;
            }
.....
Um one issue. I have this varible. But when I check the varible, I dont get affected by knockback, but I still take damage!

if(this.bubbleActive)
{
damage = 0;
player.noKnockback = true; // Will take 0 damage when the player is hurt when the bubble is active.
}
I need more context, I don't even know what hook this is.
 
It'd be really hard. Try going through the vanilla code and seeing how it works and seeing where the hooks are.

yeah
Code:
        public override void SetupShop(Chest shop, ref int nextSlot)
        {
            if (ModLoader.GetLoadedMods().Contains("SummonersAssociation"))
            {
                shop.item[nextSlot].SetDefaults(ModLoader.GetMod("SummonersAssociation").ItemType("BloodTalisman"));
                nextSlot++;
            }
.....

I need more context, I don't even know what hook this is.
Prehurt
 
k, that should work. Not sure. Are you sure it's working at all that you have nothing else preventing the knockback?
I fixed that issue.
 
What I want is my character to glow purple while i get hit (prehurt)
 
Question about tModReader, When inputting the mods, do or do not use the .enabled file for that mod?
 
Is there any solution to the multiplayer bug?, that one when you hit an ennemy it dissapear:(
:srry for my bad english, i'm spanish native speaker
 
Seems my post had somehow been swallowed....:sigh:

Still having trouble with the item's stuff stuff...
So I spawned some items using NewItem on the position of certain player. But, maybe it's how it should be, the player would grab the item in no delay. Then I found that there is the bool noGrabDelay. I thought it would be the controller of whether an dropping item will have to wait for a while till it can be picked up by players. But whatever it is true or false, the generated item will be picked up instantly...
What's wrong in these steps? Maybe the method itself is OK, my fault. But, it doesn't work for me... Is there any way I can let an item created by NewItem have the Delay before it can be picked up, just like those items dropping from the mobs.

And codes here (if needed)
Code:
Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, mod.ItemType("IchorKnifeOnPickup"), item.stack, false, 0, false, false);
 
So, I know this is a super noob question, but I am a super noob, so it fits. :P
When I'm building my mod I get this error:
Items\Weapons\RainBow.cs(26,13) : error CS0118: 'Terraria.ModLoader.ModItem.item' is a 'property' but is used like a 'type'
My code being:
Code:
using Terraria;
using System;
using Terraria.ID;
using System.Diagnostics;
using Microsoft.Xna.Framework;
using Terraria.ModLoader;

namespace XMod.Items.Weapons
{

    public class RainBow : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Rain Bow";
            item.damage = 47;
            item.noMelee = true;
            item.ranged = true;
            item.width = 24;
            item.height = 52;
            item.toolTip = "Transforms Wooden Arrows into Frostburn Arrows";
            item.useTime = 30;
            item.useAnimation = 30;
            item.useStyle = 5;
            item.shoot = 3;
            item useAmmo = 1;
            item.knockBack = 1;
            item.value = 100000;
            item.rare = 8;
            item.useSound = 5;
            item.autoReuse = true;
            item.shootSpeed = 10f;

        }
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.FrostburnArrow, damage, knockBack, player.whoAmI, 0f, 0f);
            return false;
        }
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 1);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Line 26 is item.useAmmo = 1;

I've probably just misstyped something or forgotten something important, but any help would be appreciated.
 
So, I know this is a super noob question, but I am a super noob, so it fits. :p
When I'm building my mod I get this error:
Items\Weapons\RainBow.cs(26,13) : error CS0118: 'Terraria.ModLoader.ModItem.item' is a 'property' but is used like a 'type'
My code being:
Code:
using Terraria;
using System;
using Terraria.ID;
using System.Diagnostics;
using Microsoft.Xna.Framework;
using Terraria.ModLoader;

namespace XMod.Items.Weapons
{

    public class RainBow : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Rain Bow";
            item.damage = 47;
            item.noMelee = true;
            item.ranged = true;
            item.width = 24;
            item.height = 52;
            item.toolTip = "Transforms Wooden Arrows into Frostburn Arrows";
            item.useTime = 30;
            item.useAnimation = 30;
            item.useStyle = 5;
            item.shoot = 3;
            item useAmmo = 1;
            item.knockBack = 1;
            item.value = 100000;
            item.rare = 8;
            item.useSound = 5;
            item.autoReuse = true;
            item.shootSpeed = 10f;

        }
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ProjectileID.FrostburnArrow, damage, knockBack, player.whoAmI, 0f, 0f);
            return false;
        }
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.DirtBlock, 1);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

Line 26 is item.useAmmo = 1;

I've probably just misstyped something or forgotten something important, but any help would be appreciated.
Your code says item useAmmo = 1; not item.useAmmo = 1;....is that a typo?
 
Your code says item useAmmo = 1; not item.useAmmo = 1;....is that a typo?
oh... oh god i'm an idiot. I'm so sorry. That probably hurt you to read... aye... Again sorry ;-; XD
 
Alright, so I want to use this method
public virtual void ModifyDrawLayers(List<PlayerLayer> layers)

So i want it to make it so if a certain varible is true...

public virtual void ModifyDrawLayers(List<PlayerLayer> layers)
}

if bubbleArmor = false;

I want it to add a full player overlay. The variable is only active when the player is still so it doesnt need a sheet... but how do I add it? and how can I make it face both ways? (if facing left sprite flips on y axis)
 
does anyone know how to read terrarias source code
 
How to publish your mod?
 
Help! I need to know how to fix this error.
Insufficient memory to continue the execution of the program.
at Microsoft.Xna.Framework.Helpers.GetExceptionFromResult(UInt32 result)
at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Stream stream, Int32 width, Int32 height, XnaImageOperation operation)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)
 
How to publish your mod?
Go to Mod Sources in your client and make sure your mod is built, then click publish on the far right.
 
Back
Top Bottom