Standalone [1.3] tModLoader - A Modding API

I wanted to add a new kind of boots, but my game is crashing, and I made probably huge mistakes in my code
Code:
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terranova;
using Terranova.Items;

namespace Terranova.Items
{
    public class FiresparkBoots : ModItem
    {
        public override bool Autoload(ref string name, ref string texture, ref EquipType? equip)
        {
            equip = EquipType.Shoes;
            return true;
        }
        public override void SetDefaults()
        {
            item.name = "Firespark Boots";
            item.width = 32;
            item.height = 32;
            item.accessory = true;
            item.rare = 8;
            item.toolTip = "Allows flight, super fast running, extra mobility on ice and provides the ability to walk on liquids";
            item.toolTip = "12% increased movement speed and grants immunity to fire blocks and 7 seconds of immunity to lava";
            item.value = 400000;
            item.shoeSlot = 9;
        }
        public override void UpdateAccessory(Player player)
        {         
                player.moveSpeed *= 0.12f;
                player.iceSkate = true;
                player.waterWalk = true;
                player.waterWalk2 = true;
                player.lavaTime = 7;
                player.fireWalk = true;
                player.rocketBoots = 5;
                player.maxRunSpeed *= 0.12f;     
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(ItemID.FrostsparkBoots, 1);
            recipe.AddIngredient(ItemID.LavaWaders, 1);
            recipe.AddTile(TileID.TinkerersWorkbench);
            recipe.SetResult(mod.ItemType("FiresparkBoots"));
            recipe.AddRecipe();
        }
    }
}
you're modifying item.toolTip twice. use item.toolTip2 for the second tooltip
also, what Gorateon said
It seems fine to me.
Only thing I notice is:
recipe.SetResult(mod.ItemType("FiresparkBoots"));

You can just replace
'mod.ItemType("FiresparkBoots")'
for:
'this'

Are you sure texture name is correct and in the same folder? Since you're not overriding it..
[DOUBLEPOST=1438514024,1438513893][/DOUBLEPOST]If it still crashes try replacing UpdateAccessory(Player player) with UpdateEquip(Player player)
 
you're modifying item.toolTip twice. use item.toolTip2 for the second tooltip
also, what Gorateon said

Or you can use AddTooltip, that will work :D

There is still something causing the problem, I tried UpdateAccessory and UpdateEquip and also changed item.toolTip2

Maybe in this part of the code?
Code:
               player.moveSpeed *= 1.12f;
                player.iceSkate = true;
                player.waterWalk = true;
                player.waterWalk2 = true;
                player.lavaTime = 7;
                player.fireWalk = true;
                player.rocketBoots = 5;
                player.maxRunSpeed *= 1.12f;
 
I want to trigger an event in the mod which is basically like what happens when you defeat the WoF for the first time. How do I do so?
 
I want to trigger an event in the mod which is basically like what happens when you defeat the WoF for the first time. How do I do so?
I'm not sure that you can do it right now, you should be able to do it when you have access to the world update method (in the near future I think).
 
How do I use the xyz_Shoes.png? When the player is wearing my mod boots it displays the frostspark boots texture, not my actual one.
 
Please can u guys help me im having a terrible problem :(
With my healing sword here is the code
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace ExampleMod.Items {
public class HealingSword : ModItem
{
public override void SetDefaults()
{
item.name = "Healing Sword";
item.damage = 100;
item.melee = true;
item.width = 60;
item.height = 70;
item.toolTip = "This Heals even the mighest of men.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 1;
item.knockBack = 6;
item.value = 10000;
item.rare = 10;
item.useSound = 1;
item.autoReuse = true;
item.shoot = 304;
item.shootSpeed = 11f;
}

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

public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
float spread = 45f * 0.0174f;
float baseSpeed = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
double startAngle = Math.Atan2(speedX, speedY) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
int i;
for (i = 0; i < 6; i++)
{
offsetAngle = startAngle + deltaAngle * i;
Projectile.NewProjectile(position.X, position.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), item.shoot, damage, knockBack, item.owner);
}
return false;
}
}}
But i can craft it for nothing in game
terrariapic.png


Please help :)
 
Please can u guys help me im having a terrible problem :(
With my healing sword here is the code
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;

namespace ExampleMod.Items {
public class HealingSword : ModItem
{
public override void SetDefaults()
{
item.name = "Healing Sword";
item.damage = 100;
item.melee = true;
item.width = 60;
item.height = 70;
item.toolTip = "This Heals even the mighest of men.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 1;
item.knockBack = 6;
item.value = 10000;
item.rare = 10;
item.useSound = 1;
item.autoReuse = true;
item.shoot = 304;
item.shootSpeed = 11f;
}

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

public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
float spread = 45f * 0.0174f;
float baseSpeed = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
double startAngle = Math.Atan2(speedX, speedY) - spread / 2;
double deltaAngle = spread / 8f;
double offsetAngle;
int i;
for (i = 0; i < 6; i++)
{
offsetAngle = startAngle + deltaAngle * i;
Projectile.NewProjectile(position.X, position.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), item.shoot, damage, knockBack, item.owner);
}
return false;
}
}}
But i can craft it for nothing in game
index.php


Please help :)
For future: While writing code in post, use code feature in insert button.
Also: recipe.AddIngredient(ItemID.LuminiteBar, 20);
DoubleAlso: imbalaaaance
 
Thank you so much and ... ive been doing testing and its very strong i have 2 testers and they both said its too op but thanks anyways
 
Cant u already do that with item.magic or item.melee or item.ranged ?
[DOUBLEPOST=1438535125,1438535057][/DOUBLEPOST]Cant you already do that with item.magic = true or item.melee = true ?
 
This is not working
For future: While writing code in post, use code feature in insert button.
Also: recipe.AddIngredient(ItemID.LuminiteBar, 20);
DoubleAlso: imbalaaaance
Here is the log :
c:\Users\Zane McGinn\Documents\My Games\Terraria\ModLoader\Mod Sources\ExampleMod\Items\HealingSword.cs(32,30) : error CS0103: The name 'ItemID' does not exist in the current context
Please help :)
 
Here is the log :
c:\Users\Zane McGinn\Documents\My Games\Terraria\ModLoader\Mod Sources\ExampleMod\Items\HealingSword.cs(32,30) : error CS0103: The name 'ItemID' does not exist in the current context
Please help :)
Code, please. And don't forgot past it in spoiler.
 
This is not working

Here is the log :
c:\Users\Zane McGinn\Documents\My Games\Terraria\ModLoader\Mod Sources\ExampleMod\Items\HealingSword.cs(32,30) : error CS0103: The name 'ItemID' does not exist in the current context
Please help :)
add "using Terraria.ID" at the top of the file (without the quotes, case sensitive)
 
Back
Top Bottom