❓ Making a new item

Posts 1–3 of 3 · Page 1 of 1
❓ Making a new item
Hi! Since Terraria code is too annoying, I just CAN'T figure out how to properly create a new item.

Inspired by MrBlueSL, I want to make a item that switch between day and night.

What I have right now:

Item.cs
Code:
else if (this.type == 1966)
            {
                this.channel = true;
                this.damage = 0;
                this.useStyle = 4;
                this.name = "Day Orb";
                this.shoot = 18;
                this.width = 24;
                this.height = 24;
                this.useSound = 8;
                this.useAnimation = 20;
                this.useTime = 20;
                this.rare = 1;
                this.noMelee = true;
                this.toolTip = "Summons the day";
                this.value = Item.sellPrice(1, 0, 0, 0);
                this.color = new Color(189, 173, 23, 200);
            }
Player.cs
Code:
if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1966)
                {
                    Main.dayTime = true;
                    Main.time = 0.0;
                }
aaand I put it to sell at the merchant.

What I have to do now? I am doing right until here?

Thanks!
yess, you are doing it right, where did you put the second code, does it show up at the merchant?
I put my code right after this:

Code:
if (this.whoAmi == Main.myPlayer && this.inventory[this.selectedItem].type == 1959)
                {
                    this.AddBuff(this.inventory[this.selectedItem].buffType, 3600, true);
                }
I don't know where I can edit how an item works, but I found this.. looks like when item type 1959 is used, a buff is added to the player.

So I just create my own line, but changing Main.dayTime to true and Main.time to 0.0

Another thing: I've changed all variables that put a limit on how many items the game can have (added 1) AND I created a texture for my item, exported it to .xnb, but nothing happens

And no, the item doesn't show up at the merchant..
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us