tModLoader Official tModLoader Help Thread

using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace YourModName.Items
{
public class PetCall : ModItem
{
public override void SetDefaults()
{
item.CloneDefaults(ItemID.ZephyrFish);
item.name = "Cool Pet";
item.toolTip = "Summons a Cool Pet to follow you";
item.shoot = mod.ProjectileType("PetName");
item.buffType = mod.BuffType("PetBuff");
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.AddTile(null, "WBName");
recipe.SetResult(this);
recipe.AddRecipe();
}

public override void UseStyle(Player player)
{
if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
{
player.AddBuff(item.buffType, 3600, true);
}
}
}
}
 

Attachments

  • PetCall.txt
    1,013 bytes · Views: 152
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace YourModName.Items
{
public class PetCall : ModItem
{
public override void SetDefaults()
{
item.CloneDefaults(ItemID.ZephyrFish);
item.name = "Cool Pet";
item.toolTip = "Summons a Cool Pet to follow you";
item.shoot = mod.ProjectileType("PetName");
item.buffType = mod.BuffType("PetBuff");
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.DirtBlock, 1);
recipe.AddTile(null, "WBName");
recipe.SetResult(this);
recipe.AddRecipe();
}

public override void UseStyle(Player player)
{
if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
{
player.AddBuff(item.buffType, 3600, true);
}
}
}
}
The problem is a custom workbench tile, so if you want to use a custom workbench then change the name of WBName to the workbench name, if you don't want it crafted at a workbench then remove that line, or if you want to use regular workbenches, then add the line TileID.WorkBenches in place of 'null, "WBNAME"
 
Last edited:
Hi, i have a doubt, i want to make a mount of the creature of the file, i wanted to know where i can find the codes i need for the .cs files
 

Attachments

  • NPC_415.png
    NPC_415.png
    8.1 KB · Views: 175
I have a problem... I have tmodloader, but when I try to do modded multiplayer it gives me this error:
7/8/2011 8:30:43 PM
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Terraria.Main.DrawMenu()
at Terraria.Main.Draw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DrawFrame()
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameHost.OnIdle()
at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Terraria.Program.Main(String[] args)

same thing happened to a friend... me an him have a intel i3 core! is this a bug?
I tried to do it without mods and it worked fine
but when I try multiplayer with mods it crashes and the error above appears on screen

Aaron
 
I have a problem... I have tmodloader, but when I try to do modded multiplayer it gives me this error:
7/8/2011 8:30:43 PM
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Terraria.Main.DrawMenu()
at Terraria.Main.Draw(GameTime gameTime)
at Microsoft.Xna.Framework.Game.DrawFrame()
at Microsoft.Xna.Framework.Game.Tick()
at Microsoft.Xna.Framework.Game.HostIdle(Object sender, EventArgs e)
at Microsoft.Xna.Framework.GameHost.OnIdle()
at Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()
at Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(Object sender, EventArgs e)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Microsoft.Xna.Framework.WindowsGameHost.Run()
at Microsoft.Xna.Framework.Game.RunGame(Boolean useBlockingRun)
at Terraria.Program.Main(String[] args)

same thing happened to a friend... me an him have a intel i3 core! is this a bug?
I tried to do it without mods and it worked fine
but when I try multiplayer with mods it crashes and the error above appears on screen

Aaron
This looks like somehow you have an incomplete install. Are you sure you have tmodloaderserver.exe in the steam folder?
 
This looks like somehow you have an incomplete install. Are you sure you have tmodloaderserver.exe in the steam folder?
i did the cs files of the mount i said earlyer, when i build + reload this error apparears:
c:\Users\hp\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\Items\MountItem.cs(18,18) : error CS1061: 'Terraria.Item' doesnt contain any definition of 'useSound' or found any metod of extension 'useSound' that accepts a first argument of type 'Terraria.Item' (is a directive missing from an assembly reference?)
 
i did the cs files of the mount i said earlyer, when i build + reload this error apparears:
c:\Users\hp\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\Items\MountItem.cs(18,18) : error CS1061: 'Terraria.Item' doesnt contain any definition of 'useSound' or found any metod of extension 'useSound' that accepts a first argument of type 'Terraria.Item' (is a directive missing from an assembly reference?)
Can I look at your code for the MountItem.cs file?
 
i did the cs files of the mount i said earlyer, when i build + reload this error apparears:
c:\Users\hp\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\Items\MountItem.cs(18,18) : error CS1061: 'Terraria.Item' doesnt contain any definition of 'useSound' or found any metod of extension 'useSound' that accepts a first argument of type 'Terraria.Item' (is a directive missing from an assembly reference?)
Basically something is wrong in the whole line. Try UseSound or SoundID.Item1


Ps can I really please get help on how to make a worm enemy naturally spawn?
 
Back
Top Bottom