Chest Loot - Terraria Modding Tutorial (1.4)
Вставка
- Опубліковано 19 гру 2024
- Hi everyone! Today we talk about chests and how you can make your own chest loot on world generation. For the chest PNG file, check the "Tiles21.png" in the github linked below.
Support my game development on Patreon! www.patreon.co...
Discord: / discord
Terraria Project Files: github.com/Rip...
Visual Studio: docs.microsoft...
Piskel: www.piskelapp....
You my friend, are such an absolute GOAT! I really believe adding items to chest makes a mod so much more enjoyable
Dang that was fast. I asked for this three days ago and you already made it? Thanks man
Man this is awesome also man your new channel icon is actually so swick!
Ooh
Two uploads so close to each other
Literally just found you lol. Great videos, keep it up!
For a suggestion, perhaps making an enemy shoot a projectile? I've been struggling with it few a few days now.
I would love to see world gen next
Hey I was wondering if you could make a tutorial for a summoner weapon because I'm planning on making a mod based off of summoners and that's the one class you have not done a tutorial on
You are an invaluable source of information. Please keep going!! ❤
your getting better and better overtime! i hope your not losing motivation to actually teach others some complicated things tho...
Hope you can make more tutorials like this, I love your videos, there're very helpful!
Nice work! Also, can you make a tutorial on how to make an UI? It's kind hard.
Something to add onto this for anyone looking!
If you want a rare modded chest drop, something that only spawns in the chest sometimes, like the magic mirror for example, what I managed to do is:
for (int chestIndex = 0; chestIndex < 1000; chestIndex++)
{
Chest chest = Main.chest[chestIndex];
int[] itemsToPlaceInChests4 = { Mod.Find("YourItem").Type };
int yourItemNum = 1;
if (chest != null && Main.tile[chest.x, chest.y].TileType == TileID.Containers && Main.tile[chest.x, chest.y].TileFrameX == 0 * 36)
{
int yourItemSpawnRate = Main.rand.Next(1, 100); //creating an integer from 1-100 whenever the game detects a chest
if (yourItemSpawnRate > 90) //if the integer generated is above this number [90 in this case], your item will spawn in the
//chest [if the rest of the code to make that happen is there of course]. so a lower number is a more common item
{
for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++)
{
if (chest.item[inventoryIndex].type == 0)
{
chest.item[inventoryIndex].SetDefaults(itemsToPlaceInChests4[0]); //Fills the empty slot with item
chest.item[inventoryIndex].stack = yourItemNum; //Sets the amount of item in that slot
break;
}
}
}
}
}
Note that due to youtube stuff the formatting is all messed up, but you can figure that out!
This is the important bit:
int yourItemSpawnRate = Main.rand.Next(1, 100); //creating an integer from 1-100 whenever the game detects a chest
if (yourItemSpawnRate > 90) //if the integer generated is above this number [90 in this case], your item will spawn in the chest [if the rest of the code to make that happen is there of course]. so a lower number is a more common item.
{
*other code goes here*
}
Hope this helps someone
hi riptide, can you please make a tutorial on throwable weapons (like shurikens) and summoner weapons?
Can you make a video about how to make a boss ? With a summon item and custom attacks ? Anyways, your videos are great ! Please keep on doing tutorials !
its very complicated, too much variety. you would be mostly confined to what he makes until you learn how to code properly. Only if he does do it.
Great video! Also can you make a tutorial on how to make a custom boss?
Hey Riptide! Thanks a lot for this tutorial, I have a quick question about loot in the chest. I am basically making a randomizer and I want to be able to define types of loot, like all building blocks, all furniture, ores, lootbags etc. etc.
I have everything working where the code adds randomized loot to the chest, but I want to change the amount of loot based on the type, because I want more than 10 platforms if they happen to drop but not more than 10 lootbags. How can I use the item type in a "if" statement?
Can you do a video on how to modify the drops of pre-existing enemies/bosses
This will be very handy, in case I ever make anything drop from chest loot. I do have to say though, how do you do it for modded chests?
Next vid can you go over ore generation? B/c I cant figure it out
I have a few questions, if u want to change a vanilla boss that shoots projectiles how do u change the damage of the projectiles. Also how do you make an enemy only spawn after defeating Golem
Can you tell us about making weapons with multiple modes?
how to treat when hit? i write Item.damage = -50; but still not working
Can you make a video about player and world properties?
Yes, that sounds like a good topic!
WOW One week two videos?? 😮😮😮
can we get a tutorial on crafting tho ?
where is this file?
People need to recognize this guy better in the space. Other people are getting more recognition for worse content (and annoying voices, this guy has such a calming voice).
Sub to RiptideDev!
also, can you do something on boss/enemy ai? I don't know if the 1.3 version changed at all, but if it did, i'd like to see how to make my mod even more amazing.
cool
how do you change the chance of the item spawning?
if you want a rare modded chest drop, something that only spawns in the chest sometimes, like the magic mirror for example, what I managed to do is:
for (int chestIndex = 0; chestIndex < 1000; chestIndex++)
{
Chest chest = Main.chest[chestIndex];
int[] itemsToPlaceInChests4 = { Mod.Find("YourItem").Type };
int yourItemNum = 1;
if (chest != null && Main.tile[chest.x, chest.y].TileType == TileID.Containers && Main.tile[chest.x, chest.y].TileFrameX == 0 * 36)
{
int yourItemSpawnRate = Main.rand.Next(1, 100); //creating an integer from 1-100 whenever the game detects a chest
if (yourItemSpawnRate > 90) //if the integer generated is above this number [90 in this case], your item will spawn in the
//chest [if the rest of the code to make that happen is there of course]. so a lower number is a more common item
{
for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++)
{
if (chest.item[inventoryIndex].type == 0)
{
chest.item[inventoryIndex].SetDefaults(itemsToPlaceInChests4[0]); //Fills the empty slot with item
chest.item[inventoryIndex].stack = yourItemNum; //Sets the amount of item in that slot
break;
}
}
}
}
}
Note that due to youtube stuff the formatting is all messed up, but you can figure that out!
This is the important bit:
int yourItemSpawnRate = Main.rand.Next(1, 100); //creating an integer from 1-100 whenever the game detects a chest
if (yourItemSpawnRate > 90) //if the integer generated is above this number [90 in this case], your item will spawn in the chest [if the rest of the code to make that happen is there of course]. so a lower number is a more common item.
{
other code goes here
}
sorry im 8 months late lmao
How do you get it to only have a chance to contain the item?
if you want a rare modded chest drop, something that only spawns in the chest sometimes, like the magic mirror for example, what I managed to do is:
for (int chestIndex = 0; chestIndex < 1000; chestIndex++)
{
Chest chest = Main.chest[chestIndex];
int[] itemsToPlaceInChests4 = { Mod.Find("YourItem").Type };
int yourItemNum = 1;
if (chest != null && Main.tile[chest.x, chest.y].TileType == TileID.Containers && Main.tile[chest.x, chest.y].TileFrameX == 0 * 36)
{
int yourItemSpawnRate = Main.rand.Next(1, 100); //creating an integer from 1-100 whenever the game detects a chest
if (yourItemSpawnRate > 90) //if the integer generated is above this number [90 in this case], your item will spawn in the
//chest [if the rest of the code to make that happen is there of course]. so a lower number is a more common item
{
for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++)
{
if (chest.item[inventoryIndex].type == 0)
{
chest.item[inventoryIndex].SetDefaults(itemsToPlaceInChests4[0]); //Fills the empty slot with item
chest.item[inventoryIndex].stack = yourItemNum; //Sets the amount of item in that slot
break;
}
}
}
}
}
Note that due to youtube stuff the formatting is all messed up, but you can figure that out!
This is the important bit:
int yourItemSpawnRate = Main.rand.Next(1, 100); //creating an integer from 1-100 whenever the game detects a chest
if (yourItemSpawnRate > 90) //if the integer generated is above this number [90 in this case], your item will spawn in the chest [if the rest of the code to make that happen is there of course]. so a lower number is a more common item.
{
other code goes here
}
sorry that i'm a year late lmao