Jump to content

Leveled items in NPC inventory respawn when player levels up?


Belthan

Recommended Posts

I have an NPC, initially disabled, with PC Level Mult checked and a leveled list (WithAmmoChineseAssaultRifleNPC) in her inventory. When the player performs certain actions she is enabled via a script. When enabled, her stats and the health % of her weapon vary based on the player's level as intended.

 

However, when the player levels up, another rifle (in better condition) is added to her inventory, which is not intended. I could remove the leveled list from her inventory, and then calculate the appropriate weapon health and add a WeapChineseAssaultRifle to her inventory in the script that enables her, but that seems overly complicated. If it comes down to that, I'll probably just put one rifle with an arbitrary health % in her inventory. Is there an easier way to give her a weapon whose condition is based on the player's level when she is enabled, without having her become a walking weapon factory?

Link to comment
Share on other sites

I hadn't noticed that, but it does look weird. The really strange thing is that vanilla NPCs use the same list and it works, even though it seems like it shouldn't (and they don't spawn extra rifles when I level, either). At any rate, I'll see if a custom list solves the problem. Thanks for the help!

Link to comment
Share on other sites

Most vendor inventories respawn twice a week (if their vendor chest has "respawn" checked). Say the % chance for an item is 100%. If you add the list to their inventory once, then every few days there will be a new item from your list in their inventory and the old one (if any) will be gone. If you add the list to their inventory multiple times, they will have as many items from your list as there are instances of the list in their inventory. So, if you add your list to their inventory twice a week, I think (although I haven't actually tried it) they will have one item the first time their inventory respawns, two items the second time, and so forth.

Link to comment
Share on other sites

Just a little uptade, I'm currently testing this out .

 

Since I frequently added the leveled item to the vendor box, I wrote a script to move the said vendor box to the player, then I used the console commands "scof" and "inv" on the vendor box to print the content to a text file.

 

Here's what I got:

 

 

SetConsoleOutputFilename >> 'box inv.txt'

inv

Ralphs Händlerbehälter (00113215) has 22 items:

5 - Altmetall (00031944)

676 - Korken (0000000F)

1 - Großer Löffel (0005B640)

2 - Leguanbissen (0001519A)

2 - Leguan am Stiel (0001519B)

1 - Eichhörncheneintopf (0003194A)

1 - Gegrillte Schrecke (000E2F64)

1 - Junkfood (0003359C)

1 - Sunset Sarsaparilla (00103B1E)

2 - Schmutziges Wasser (000151A4)

1 - Scotch (000151A1)

1 - Toaster (0009A808)

1 - Brahmin-Schädel (0003405E)

1 - Mentats (00015165)

1 - Jet (00015164)

1 - Ruhige Hand (000CED8C)

1 - Med-X (00050F8F)

5 - Terpentin (00022105)

1 - Stachelschlagring (00004354) (135,45.00%)

  ===  (0001BCC2) ===

  ---> ARMASpikedKnuckles (0009FB06)

1 - Polizeiknüppel (00004345) (138,55.00%)

1 - Umherziehender im Ödland-Outfit (0001BA00) (40,40.00%)

  ===  (0001D4C8) ===

  ---> BrahminGloveRight (00029397)

  ---> BrahminGloveLeft (00029396)

1 - A Cigarette (0D003D54) (100,100.00%)

  ===  (0D005E97) ===

  ---> smoke effect for cig (0D005E98)

 

 

 

The leveled item clearly is not there. Maybe they are not stored in the inventory?

Hmm, makes me still wonder.

 

I try to set the leveled item to respawn, lets see what happens next.

 

 

Edit

Well, respawn on the vendor box base object already was checked, the leveled items however do not respawn.

I figure this has something to do that I didn't edit the vendor box's base object by adding the leveled item there. I chose to go the script road and made a quest that adds the said leveled item every sunday and wednesday to the reference in the game world by using the "AddItem" function.

 

Looks like, if added via script, the leveled item gets destroyed?

 

Edit*

Edited by tortured Tomato
Link to comment
Share on other sites

So after testing a bit I'm quite certain that leveled items only are remembered by the engine if they actually have been added to a base object in the editor. (This has it's logic. If the base object is set to respawn its inventory, the entire "base content" gets refreshed.)

 

Otherwhise leveled items just don't exis't and immediately "transform" to an actual item which was in the list. (Also the inv command wont show leveled items, since it doesn't show the content of the base object, which can't be found in the game world anyway.)

 

 

The script line

ContainerRef.AddItem SomeLeveledItem 1

works. But doesn't actually add a leveled item itself to the reference, it only adds the item which has been defined (or better said calculated in its leveled list).

 

 

This are such tiny details one just doesn't know by default. ^^

 

 

Edit:

Am I the only one who can follow my explainations? ;-D

 

dl;dr

However, turned out that adding a leveled item to a container (world object reference thing) via script, will not cause save game bloat.

Edited by tortured Tomato
Link to comment
Share on other sites

I actually add my list to one of the vendor chest lists, rather than adding it to the vendor chest object directly, like so:

AddItemToLeveledList VendorChestGeneralStore MyItemList 1 1 1

VendorChestGeneralStore is used by Moira, Lydia Montenegro, Seagrave Holmes, Karl and miscellaneous scavengers. There are a bunch of VendorChest* lists and they are pretty heavily nested, so you might need to do some poking around to figure out which one to use so that your items show up in the inventories of the vendors you want.

 

The first parameter is the minimum player level at which your items will appear, the second is the number to add, and the last one is the health percentage (from 0 to 1).

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...