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....

КОМЕНТАРІ • 36

  • @GentleGorillas
    @GentleGorillas Рік тому

    You my friend, are such an absolute GOAT! I really believe adding items to chest makes a mod so much more enjoyable

  • @carby6831
    @carby6831 Рік тому

    Dang that was fast. I asked for this three days ago and you already made it? Thanks man

  • @Limestoneowl
    @Limestoneowl Рік тому

    Man this is awesome also man your new channel icon is actually so swick!

  • @RoundedPotato
    @RoundedPotato Рік тому +1

    Ooh
    Two uploads so close to each other

  • @bunchiralOfficial
    @bunchiralOfficial Рік тому +1

    Literally just found you lol. Great videos, keep it up!

  • @TheSoundOfAStar
    @TheSoundOfAStar Рік тому +2

    For a suggestion, perhaps making an enemy shoot a projectile? I've been struggling with it few a few days now.

  • @afishperson
    @afishperson Рік тому

    I would love to see world gen next

  • @Pokeman328
    @Pokeman328 Рік тому +1

    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

  • @cryopyrogenetics
    @cryopyrogenetics Рік тому

    You are an invaluable source of information. Please keep going!! ❤

  • @soperion
    @soperion Рік тому +2

    your getting better and better overtime! i hope your not losing motivation to actually teach others some complicated things tho...

  • @suzuki750
    @suzuki750 Рік тому

    Hope you can make more tutorials like this, I love your videos, there're very helpful!

  • @SKXZA
    @SKXZA Рік тому

    Nice work! Also, can you make a tutorial on how to make an UI? It's kind hard.

  • @KETYBAUOARDSMMAS
    @KETYBAUOARDSMMAS 3 місяці тому

    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

  • @soperion
    @soperion Рік тому

    hi riptide, can you please make a tutorial on throwable weapons (like shurikens) and summoner weapons?

  • @alexislvt7122
    @alexislvt7122 Рік тому

    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 !

    • @cabbagerat5645
      @cabbagerat5645 Рік тому

      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.

  • @taoishere555
    @taoishere555 Рік тому

    Great video! Also can you make a tutorial on how to make a custom boss?

  • @yeye1600
    @yeye1600 Рік тому

    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?

  • @angry_volbonan7805
    @angry_volbonan7805 Рік тому

    Can you do a video on how to modify the drops of pre-existing enemies/bosses

  • @PKPlaguebringer
    @PKPlaguebringer Рік тому

    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?

  • @bigtimegamer8959
    @bigtimegamer8959 Рік тому

    Next vid can you go over ore generation? B/c I cant figure it out

  • @patyas4577
    @patyas4577 Рік тому

    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

  • @WryAres
    @WryAres Рік тому

    Can you tell us about making weapons with multiple modes?

  • @vanoo4815
    @vanoo4815 Рік тому

    how to treat when hit? i write Item.damage = -50; but still not working

  • @firelogarithm
    @firelogarithm Рік тому

    Can you make a video about player and world properties?

    • @RiptideDev_
      @RiptideDev_  Рік тому +1

      Yes, that sounds like a good topic!

  • @luviho
    @luviho Рік тому

    WOW One week two videos?? 😮😮😮

  • @PowerAids
    @PowerAids Рік тому

    can we get a tutorial on crafting tho ?

  • @the_crusader_8883
    @the_crusader_8883 Рік тому

    where is this file?

  • @sierra121cyan
    @sierra121cyan Рік тому

    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.

  • @josiahlute7808
    @josiahlute7808 Рік тому

    cool

  • @-PulseGTC-
    @-PulseGTC- 11 місяців тому

    how do you change the chance of the item spawning?

    • @KETYBAUOARDSMMAS
      @KETYBAUOARDSMMAS 3 місяці тому

      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

  • @WillStuff1111
    @WillStuff1111 Рік тому

    How do you get it to only have a chance to contain the item?

    • @KETYBAUOARDSMMAS
      @KETYBAUOARDSMMAS 3 місяці тому

      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