songsnax.blogg.se

How to put tmodloader on terraria
How to put tmodloader on terraria













We then set some default variables for our pet variable. What we do here is create our player class which extends from the default ModPlayer. In the root of your mod directory create a file called MyPlayer.cs with the following content using Terraria.ModLoader Projectile.NewProjectile( + (float)(player.width / 2), + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("CustomPet"), 0, 0f, player.whoAmI, 0f, 0f) įor the CustomBuff.png we use the following imageĪs you might have noticed, we referred to a class called MyPlayer This one doesn’t exist yet so let’s make it. If (petProjectileNotSpawned & player.whoAmI = Main.myPlayer) Public override void Update(Player player, ref int buffIndex)īool petProjectileNotSpawned = player.ownedProjectileCounts <= 0 The contents of CustomBuff.cs are as followed using Terraria ĭescription.SetDefault("Our own cool cat!") Create this directory and create two files for it CustomBuff.cs and CustomBuff.png After that, we declare two other variables, namely item.shoot and item.buffType We will be making two different files which will be the referenced values of these two lines. We do this so we inherit the default values and don’t have to assign them by ourselves. In the SetDefaults() method we tell our custom pet item to become a clone of the UnluckyYarn which is an already existing item. Looking at the code above a couple of things are worth mentioning. Player.AddBuff(item.buffTime, 3600, true) įor CustomPet.png we will use the following image If (player.whoAmI = Main.myPlayer & emTime = 0) Public override void UseStyle(Player player) Recipe.AddIngredient(ItemID.DirtBlock, 10) Item.buffType = mod.BuffType("CustomBuff") Item.shoot = mod.ProjectileType("CustomPet") Tooltip.SetDefault("Summon a cat to your side") Paste the following code inside a file called CustomPet.cs using Terraria ĭisplayName.SetDefault("Modded Cat Key") For our items we will be creating two files, one being our C# script and the other being our item image. To get started, let’s tackle our necessary Items files first. Remember the Items folder we needed the last times when we made our LaserSword and TestSword? We will be using that folder again for our pet together with two new folders, Buffs, and Projectiles. Open up tModLoader and your Visual Studio project. This time, we will be creating a custom pet that will follow the player around. If you haven’t read that one yet, you can find it here Custom pet in Terraria In this part, we will continue where we left off in the previous part. Modding Terraria is a fun way to add and adjust features in a playful way and learn more about programming. Modding Terraria – Part 3 Adding a custom pet















How to put tmodloader on terraria