FrostedBison Posted May 7, 2024 Share Posted May 7, 2024 Let's say I have 30 of something, like books or gems or other random junk. If I want to add a single (randomized!) book to every NPC, I could have a SPID line for each book at 1%, but that means some NPCs will roll and have many books, and it's just clunky and bad and if you have a ton of items, it falls apart fast. Is there a way with SPID, or another way, to make the NPCs only get 1 of an item, while the item is also random? I know there's leveled list, but I'm only finding guides to make them in the creation kit, not how to implement them. Note: I'm not a modder at all, so if there's tutorials to link I would appreciate it! Link to comment Share on other sites More sharing options...
anjenthedog Posted May 7, 2024 Share Posted May 7, 2024 If this is a once-and-done sort of script, ie, it runs and distributes to the intended NPC pool, then perhaps a check of their inventory with a little iterated "if they got it already, don't do this" logic applied as part of the pre-distribution step (check for potential duplication), As follows (In plain english. you'll have to code it) Get NPC inventory (store to a temporary array or hash) Iterate over inventory array or hash in an if-then loop with the action being store one to NPC and the condition being, tested array/hash item is NOT a "thing" Just a rough sketch... I'm sure some can be condensed (like iterating directly over a call to whatever could get an array or hash of inventory, rather than using a dummy var intermediate) ftr, I'm not a modder (presumably you mean mod author) either, which is why I didn't just provide code. I don't speaka da language... or at least too little to be offered Link to comment Share on other sites More sharing options...
scorrp10 Posted May 8, 2024 Share Posted May 8, 2024 Yeah, you create a plugin containing a 'Levelled Item' form set to randomly produce a single item from a list of possibles. Then you make SPID distribute that LevelledItem to everyone. 1 Link to comment Share on other sites More sharing options...
Recommended Posts