Modifying containers by script - adding/removing LVLI

Post » Sun Feb 06, 2011 1:29 am

Is there a way to use a script to add and remove LVLI records from a CONT?

What I want to be able to do:

- I have a respawning VendorCONT, a VanillaLVLI, and my own CustomLVLI
- I want to remove VanillaLVLI fron VendorCONT
- I want to add CustomLVLI to VendorCONT
- I want to leave VanillaLVLI untouched (as it is used in a lot of other places)
- I want to only modify VendorCONT by script (and avoid making an override of it, for compatability purposes)
- I want the changes to persist through respawns of VendorCONT

Is it possible to do what I want here? I know (Add|Remove)Item can be used with an FLST, but it won't add/remove the FLST entry itself, but rather remove each item in the list - which makes me think that it wouldn't do what I want if I used it with an LVLI. Am I wrong, and it is as simple as "VendorCONT.RemoveItem VanillaLVLI 1"? Or is there some other way to go about it?

Any help/advice for this learning scripter is much appreciated...

- DU
User avatar
Russell Davies
 
Posts: 3429
Joined: Wed Nov 07, 2007 5:01 am

Post » Sun Feb 06, 2011 5:50 am

This may or may not help you, but what I've been doing is creating a leveled list of the things I want to add, and adding it via script to the vendor container located in the vendor chest dummy cell. There's no way to remove that list except to wait for a respawn though (you might try passing the leveled list as a parameter to the removeitem function though, it may work). To ensure that the items are still available after respawns, I add a vendor token to the chest along with the leveled list - a piece of dummy armor flagged as unplayable so it won't show up on the list of goods for sale. My vendor script continuously checks to see if the token is in the vendor container, and if it's not, that means the container respawned and its time to re-add the leveled list (and vendor token).

My reason for doing this is so that I can control the availability of items - I'll usually make the leveled list addition contingent upon the status of a quest or dialog choice. I often have several levels of items that I'll add to a vendor's inventory as the quest progresses, so I have a different vendor token for each level.
User avatar
Matt Fletcher
 
Posts: 3355
Joined: Mon Sep 24, 2007 3:48 am

Post » Sun Feb 06, 2011 5:53 am

Interesting.

Check my understanding here...

So you're using AddItem to add the LVLI to the CONT -- and by doing so it does not actually add the LVLI to the CONT, but runs the LVLI and adds the ouput to the CONT... which will then be removed on respawn, which is why you check for the token to see if you need to re-run the AddItem function?

If that is the case, that suggests to me that running RemoveItem with a LVLI would do similiarly -- that is it would resolve the LVLI into something to remove, rather than removing the... for lack of a better term, the meta-LVLI from the meta-CONT (which is what I actually want to do).

While I understand where you're coming from with the need for control over different LVLI with use of different tokens, that's not a layer of control that I really need at this point -- though thank you for the explanation, as it helps my comprehension of what is going on here.

In the end, if I cannot do what I want "at the meta level", I may have to settle for something along the lines of what you're doing - although that still won't help me with the remove side of things (which right now the only option I see are to compromise one way or another - either dealing with the less precise control of removing items from the CONT in an attempt to nullify what the unwnated LVLI would add, or else bite the bullet and use an actual override for the VendorCONT).
User avatar
Victoria Bartel
 
Posts: 3325
Joined: Tue Apr 10, 2007 10:20 am

Post » Sun Feb 06, 2011 7:17 am

My guess is that yes, removing a leveled item would remove the items in the list from the container, but I haven't tried it. The only real drawback would be removing too many of something - if the container already contained an instance of combat armor, and your leveled list contained combat armor, and the player purchased a set of combat armor before you removed the leveled list, there'd be no combat armor left after removing the leveled list. Not a very major problem though. This also seems to be the only way the removal could work - even if you were able to add/remove a leveled item to/from the listed container contents, it wouldn't take effect until a container respawn anyway. Seems like this will do exactly what you're asking.
User avatar
[ becca ]
 
Posts: 3514
Joined: Wed Jun 21, 2006 12:59 pm

Post » Sun Feb 06, 2011 7:29 am

Not sure if this is relevent, but I had a problem doing a check on LVL Items. Say your level item has Combat Armor, Power Armor and a Merc Outfit. What spawns in the container is:
Combat Armor x2
Power Armor x3
Merc Outfit x4

Then you take all of the items out of the container in-game (now in PC inventory). GetItemCount will always return "1" for any item from the LVL Item list even though the container is empty. Even though there were more than "1" at spawn.
User avatar
Naughty not Nice
 
Posts: 3527
Joined: Sat Nov 04, 2006 6:14 am

Post » Sun Feb 06, 2011 12:11 pm

My guess is that yes, removing a leveled item would remove the items in the list from the container, but I haven't tried it. The only real drawback would be removing too many of something - if the container already contained an instance of combat armor, and your leveled list contained combat armor, and the player purchased a set of combat armor before you removed the leveled list, there'd be no combat armor left after removing the leveled list. Not a very major problem though. This also seems to be the only way the removal could work - even if you were able to add/remove a leveled item to/from the listed container contents, it wouldn't take effect until a container respawn anyway. Seems like this will do exactly what you're asking.

It sounds like it will do what I'm asking, but not as cleanly or with as much control as I'd really like (I'm dealing with currency here, so dealing with very random numbers coming from multiple LVLI's). Since the intent here is for the change to be made at game start, the respawning issue wouldn't be a problem as the changes would already be in effect before the initial spawn. That is, -if- I could do it the way that I'd prefer.


Not sure if this is relevent, but I had a problem doing a check on LVL Items. Say your level item has Combat Armor, Power Armor and a Merc Outfit. What spawns in the container is:
Combat Armor x2
Power Armor x3
Merc Outfit x4

Then you take all of the items out of the container in-game (now in PC inventory). GetItemCount will always return "1" for any item from the LVL Item list even though the container is empty. Even though there were more than "1" at spawn.

Interesting... and likely good information for me to know, as that may rule out one of the other work arounds that I was contemplating...
User avatar
Agnieszka Bak
 
Posts: 3540
Joined: Fri Jun 16, 2006 4:15 pm


Return to Fallout: New Vegas