Jump to content

Invisible Item

Closed 1.3.5 1.3.7

JustANoob
JustANoob

Posted (edited)

When you kill the Huntsman, he has invisible Scientist Suit that shows up in the inventory that you can't move around or see or remove. Also when you go to recycle it turns it into raw items forever.

InvisbleSuitIssue.png

Edited by Flechen
Left out words...
JustANoob

Posted

{
  "Use Debug": false,
  "BotRespawn Settings": {
    "Use BotReSpawn": false,
    "BotReSpawn profile name": "huntsman"
  },
  "Animals to trigger HuntsMan": {
    "Alpha Animal": true,
    "Omega Animal": true,
    "Bear": true,
    "Boar": true,
    "Chicken": true,
    "Horse": true,
    "Stag": true,
    "Wolf": true
  },
  "Hunter Settings": {
    "Custom Hunter Name": "HuntsMan",
    "spawn chance (1-100%)": 100.0,
    "Spawn Amount": 1,
    "spawn radius": 10,
    "Health": 250,
    "Max Roam Distance": 20,
    "Damage multiplier": 0.6,
    "Lifetime (minutes)": 10.0,
    "Use kit (clothing)": false,
    "Kit ID": [
      "HuntsMan"
    ],
    "Show messages": true,
    "Hunters drop a Backpack with loot": true,
    "Use Random Skins": true,
    "Spawn Min Amount Items": 6,
    "Spawn Max Amount Items": 10,
    "Loot Table": [
      {
        "shortname": "ammo.pistol",
        "amount": 5,
        "skin": 0,
        "amountMin": 5
      },
      {
        "shortname": "ammo.pistol.fire",
        "amount": 5,
        "skin": 0,
        "amountMin": 5
      },
      {
        "shortname": "ammo.pistol.hv",
        "amount": 5,
        "skin": 0,
        "amountMin": 5
      },
      {
        "shortname": "ammo.rifle",
        "amount": 5,
        "skin": 0,
        "amountMin": 5
      },
      {
        "shortname": "ammo.rifle.explosive",
        "amount": 5,
        "skin": 0,
        "amountMin": 5
      },
      {
        "shortname": "ammo.rifle.hv",
        "amount": 5,
        "skin": 0,
        "amountMin": 5
      },
      {
        "shortname": "ammo.rifle.incendiary",
        "amount": 5,
        "skin": 0,
        "amountMin": 5
      },
      {
        "shortname": "ammo.shotgun",
        "amount": 12,
        "skin": 0,
        "amountMin": 8
      },
      {
        "shortname": "explosive.timed",
        "amount": 1,
        "skin": 0,
        "amountMin": 1
      },
      {
        "shortname": "explosives",
        "amount": 1,
        "skin": 0,
        "amountMin": 1
      },
      {
        "shortname": "pistol.m92",
        "amount": 1,
        "skin": 0,
        "amountMin": 1
      },
      {
        "shortname": "shotgun.spas12",
        "amount": 1,
        "skin": 0,
        "amountMin": 1
      },
      {
        "shortname": "pickaxe",
        "amount": 1,
        "skin": 0,
        "amountMin": 1
      },
      {
        "shortname": "hatchet",
        "amount": 1,
        "skin": 0,
        "amountMin": 1
      },
      {
        "shortname": "can.beans",
        "amount": 3,
        "skin": 0,
        "amountMin": 1
      },
      {
        "shortname": "can.tuna",
        "amount": 3,
        "skin": 0,
        "amountMin": 1
      },
      {
        "shortname": "black.raspberries",
        "amount": 5,
        "skin": 0,
        "amountMin": 3
      }
    ]
  }
}

 

JustANoob

Posted (edited)

Any Fix Yet, or ideas?

Edited by Flechen
JustANoob

Posted

I fixed the code, I have no coding skills and used ChatGPT to figure it out.

Your Welcome!

private void GiveLoadout(ScientistNPC npc)
        {
            if (npc != null)
            {
                /*
                var inv_main = npc.inventory.containerMain;
                */
                var inv_belt = npc.inventory.containerBelt;
                var inv_wear = npc.inventory.containerWear;

                /*
                Item pooky = ItemManager.CreateByName("pookie.bear", 1, 0);
                */
                Item hat = ItemManager.CreateByName("hat.boonie", 1, 841998387);
                Item hoodie = ItemManager.CreateByName("hoodie", 1, 852449747);
                Item pants = ItemManager.CreateByName("pants", 1, 1464539276);
                Item boots = ItemManager.CreateByName("shoes.boots", 1, 839852365);
                Item weapon1 = ItemManager.CreateByName("shotgun.pump", 1, 0);

                inv_wear.Clear();
                /*
                if (pooky != null) pooky.MoveToContainer(inv_main);
                */
                if (hat != null) hat.MoveToContainer(inv_wear);
                if (hoodie != null) hoodie.MoveToContainer(inv_wear);
                if (pants != null) pants.MoveToContainer(inv_wear);
                if (boots != null) boots.MoveToContainer(inv_wear);
                if (weapon1 != null) weapon1.MoveToContainer(inv_belt);
				
                string scientistSuitShortname = "hazmatsuit_scientist";

                // Find the "Scientist Suit" item in the NPC's inventory
                Item scientistSuitItem = npc.inventory.containerMain.itemList.FirstOrDefault(item => item.info.shortname == scientistSuitShortname);

                // Remove the "Scientist Suit" item if found
                if (scientistSuitItem != null)
                {
                    scientistSuitItem.RemoveFromContainer();
                    PrintToChat(npc, "The Scientist Suit has been removed from the NPC's inventory.");
                }
            }
            else
            {
                Puts("Huntsman was not fully spawned yet skipping [GiveLoadout]");
            }
        }

 

 

JustANoob

Posted

Nikedemos — Today at 8:11 PM
you don't have to do that

Nikedemos — Today at 8:11 PM
inventories have a method to find by itemid/shortname I think

Nikedemos — Today at 8:13 PM
Item scientistSuitItem = npc.inventory.containerMain.FindItemsByItemName(scientistSuitShortname);

Krungh Crow

Posted

Changed Status from Pending to Closed

Changed Fixed In to 1.3.7

1.4m

Downloads

Total number of downloads.

6.9k

Customers

Total customers served.

102.2k

Files Sold

Total number of files sold.

2m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.