Alright, so does anyone know any fancy ways of doing this? I did it through an NPC scanner, to add some minor items, but I don't want to resort to making a scanner that checks NPCs all the time to add a few items. I can imagine that will start to cause lagging if there's too many scripts constantly checking NPCs.
Adding items to NPCs through scripts without AddItemToLeveledList
-
ArgusMercenary
- Posts: 54
- Joined: Sun Sep 08, 2013 9:24 pm
Adding items to NPCs through scripts without AddItemToLeveledList
-
retlaw83
- Posts: 279
- Joined: Sun Mar 17, 2013 8:40 pm
Yeah, the way you do it is to
Yeah, the way you do it is to NOT DO IT. This makes permanent changes to the formlists that stay even after your mod is uninstalled - so either the formlist will return a null value for modded items, or keep using vanilla items. Seriously. DO NOT USE AddItemToLeveledList. That command is specifically for the game developers to add DLC or patch items into leveled list.
The proper way to do this is to modify the leveled list directly in the GECK.
For more information on DO NOT USE THIS, check the GECK: wiki http://geck.bethsoft.com/index.php?title=AddItemToLeveledList
Now, if you're looking to add something to a class of NPCs, best thing to do is build a scanner, assign a ref variable to who it picks up, and use additem. But you're probably better off directly manipulating the leveled lists they use in the GECK or directly adding to their inventory.
30 Helens agree that I am, pound for pound, the strongest man in a group of ducks.
-
ArgusMercenary
- Posts: 54
- Joined: Sun Sep 08, 2013 9:24 pm
I don't actually use
I don't actually use AddItemToLeveledLists, I use a scanner with additem, but that still has its limitations, for one it won't eliminate an armor an NPC might be using, second running to much of that will undoubtedly cause problems, especially if you start checking in a lot of places at the same time.
The mod I'm working with will add armor items to NPCs, but I don't want to have it looking every single time for specifics like Veteran Legionary or NCR Trooper. I know about GECK but I'm choosing not to use it that way because, this will conflict with some big mods with which I want to make my mod as compatible as I possibly can.
If there is no other way, then I'll have to think of using one of those two options.
-
JaxFirehart
- Posts: 3003
- Joined: Wed Sep 12, 2012 12:33 am
Ret didn't notice you had
Ret didn't notice you had already said WITHOUT AddItemToLeveledList, but his advice is sound; add them to the NPC or to the proper leveled lists and, so long as the user makes a merged patch, all will be well. Another option is ListAddForm which is NVSE and DOES NOT PERSIST ACROSS SAVE GAMES. Meaning that each time your mod is loaded it needs to re-do all of its changes, but that also prevents the issues Retlaw was describing.
-
retlaw83
- Posts: 279
- Joined: Sun Mar 17, 2013 8:40 pm
Yeah, my bad - saw
Yeah, my bad - saw AddItemToLevelList and went into doom crier mode.
30 Helens agree that I am, pound for pound, the strongest man in a group of ducks.
-
ArgusMercenary
- Posts: 54
- Joined: Sun Sep 08, 2013 9:24 pm
JaxFirehart wrote:
[quote=JaxFirehart]
Ret didn't notice you had already said WITHOUT AddItemToLeveledList, but his advice is sound; add them to the NPC or to the proper leveled lists and, so long as the user makes a merged patch, all will be well. Another option is ListAddForm which is NVSE and DOES NOT PERSIST ACROSS SAVE GAMES. Meaning that each time your mod is loaded it needs to re-do all of its changes, but that also prevents the issues Retlaw was describing.
[/quote]
Interesting, I'll look up ListAddForm then, I assume that like everything else, it also has its drawbacks.
-
Gribbleshnibit8
- Posts: 481
- Joined: Sun Nov 04, 2012 2:06 am
I would like to point out
I would like to point out that this was exactly the thing that the Inventory Access.esm was for, a central resource for a lot of mods to use to add items to NPCs without every one of them having to run ref-walking scripts and do their own thing. I believe I pointed this out when you first asked me about its use and necessity.
-
ArgusMercenary
- Posts: 54
- Joined: Sun Sep 08, 2013 9:24 pm
Gribbleshnibit8 wrote:
[quote=Gribbleshnibit8]
I would like to point out that this was exactly the thing that the Inventory Access.esm was for, a central resource for a lot of mods to use to add items to NPCs without every one of them having to run ref-walking scripts and do their own thing. I believe I pointed this out when you first asked me about its use and necessity.
[/quote]
I know what it was used for, regardless. The script is done and Inventory Access was axed, it was either using that thing or doing things this way. I don't like having to scan everything all the time, but so far it hasn't caused any issues, well not anymore now that it works better. All I know is that Inventory Access had custome LeveledItem to which some tokens were added and then distributed to NPCs, I tried to understand what it was doing. Besides, it used two scripts to do its job, while my approach uses one. Is it heavier than both combined? Maybe, it certainly looks like it is bigger and more complex.
There was some stuff about Inventory Access that I didn't like, for instance, it was too random and very few times did I ever find NPCs using the PA mods, most times the Legion NPCs were the only ones who used it. I for one can't remember any BoS NPCs every having any PA mods. The Enclave ocasionally had some. With what I'm doing now, every important faction has a list of mods they can use, within reason of course, for instance the Legion won't get the nice toys, they'll the mods which consider the least advanced. The NCR gets better and so on, until the Enclave. If it turns out to be an issue, I'll figure out something else. So far, all my tests have gone well.
I guess we'll see later on what happens when other mods are on. Either way PPA has to stand on its own, no more extra plugins like Inventory Access. However, the items I'm trying to add have nothing to do with that, as part of the update I've added a special power armor for the Legion and I want to distribute it without scanning anything, if ListAddForm will do that, then I intend to use it. I'm planning to leave this open so that if any future power armors I add can easily be added and distributed.
This is my script:
http://pastebin.com/esszdV4f
These are the two scripts that IA used:
IAWalkerScript
http://pastebin.com/aNQr9CwU
IAPiggyBackScript
http://pastebin.com/WxiBezkX
I don't know about you but the walker script does scan things, its comments say so themselves and the use of GetFirstRef and GetNextRef is also a good indication. My script does all that in one place, does it need more leveled items, yes. Am I entirely satisfied with it, no, in my opinion I have too many ifs but I don't know how I should check factions without using that. Last but not least, and I really hate myself for saying this, I generally don't like criticizing modders that have done way more than I have, but I think it is a lot easier to understand my script than it is to understand those two.
Feel free to say what's on your mind, I'm always open to suggestions.