Advertisement
GraceCB

S6S Weapon Integration Tutorial

Oct 22nd, 2021 (edited)
1,903
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.53 KB | None | 0 0
  1. S6S Modding Tutorials
  2.  
  3. Prerequisites:
  4. You'll need to have installed:
  5. New Vegas
  6. JohnnyGuitar NVSE
  7. JIP LN NVSE
  8. GECK
  9. GECK Extender
  10. -The GECK must be set up to run NVSE. You do this by creating an NVSE shortcut, then putting -editor in it's launch argument.
  11. -Example: https://i.imgur.com/AlxrSO7.png
  12. FNVEdit
  13. Notepad++
  14.  
  15. Optional, but highly recommended:
  16. Hot Reload (Allows you to reload your script and check updates while the game is loaded, saving *tons* of debug time)
  17. Improved Console (It's usually pretty quick to use a console command to test things, but sometimes the useful info is too long for you to scroll back up to in the in game console, and Improved Console will print the console log in your base game folder, so that you can check it there)
  18.  
  19.  
  20. WEAPON INTEGRATION
  21. Starting Criteria:
  22. This weapon integration tutorial covers the scripted integration of a mod, and some other secondary things. This does not cover making your weapon, or it's animations, or sounds work.
  23. For this tutorial, you need to already have an existing, fully functional weapon entry in a plugin.
  24.  
  25. To start things off, open your plugin. I prefer doing pretty much all non-script work in FNVEdit, because it lets me see overwrites, and provides a much clearer UI that I find more comprehensible, but the GECK can of course do just about everything you need, other than plugin cleaning.
  26.  
  27. STEP 1: What is a leveled item, and what do it's flags do?
  28. A leveled item (hereafter referred to as a lvli) is an "item" that will provide the game world one of a selection of the possible items included inside of it.
  29. Take a look at a base game lvli whose editor id contains "cond" in it. You'll see a set of entries of all the same weapon, at different health values. Health values are a percentage out of 1: 0.35 equals 35% health, .71 means 71% health, etc.
  30.  
  31. The "level" of a lvli entry dictates at what level the player/npc has to be for that item entry to potentially be spawned.
  32. In loot and vendor lists, the *player's* level is checked. For NPCs, the NPC holding the leveled item's level is checked.
  33. Some condition lists (mostly NPC condition lists) have all their entries at the same level.
  34. However, some set their higher condition entries to higher levels. This means that generally, at lower levels, since the NPCs' level scaling hasn't taken much effect, their weapons will be low health, making it more difficult for enemies to kill you incredibly quickly, and preventing you from getting rich too quickly by finding high health weapons to resell.
  35.  
  36. NPC condition lists generally have higher overall condition, and are mostly given to non-hostile NPCs, so that their weapons deal enough damage for them to have a fighting chance when attacked, Since the player is generally disincentivized from killing many non hostile npcs, this doesn't affect economy balance nearly as much as high condition weapons in raider lists tend to.
  37. Brotherhood/Enclave/other faction condition lists often have higher or lower overall condition levels, to represent the quality of weapon being maintained by members of certain factions.
  38.  
  39. Loot lists belong in loot lvlis. They show up in containers and such, and generally not on NPCs.
  40.  
  41. Lvlis can contain other leveled items. For example, you could make a leveled item that has throwing spears as it's main weapon, then a backup lvli included as well, so that the npc doesn't have no weapon left once they've thrown all their projectiles.
  42.  
  43. The "Calculate for each" lvli flag determines whether the game will roll for one entry in a lvli, then duplicate it as many times as the count it's being asked for, or, if it will instead roll for each count it's being asked for individually.
  44. For example: You have a container called SchoolDesk. It has Apple x1 and the leveled item "PencilLoot" x3 in it.
  45. https://i.imgur.com/1VYkZ0B.png
  46. PencilLoot contains 3 entries: Pencil x1, Pencil x2, and Pencil x3.
  47. https://i.imgur.com/tjvyhKa.png
  48. Wherever this desk is placed, it will always have a single apple in it when the player finds it for the first time. However, the amount of pencils will be different each time the player finds this container.
  49. The container currently might
  50. Choose 1 pencil from the lvli, then duplicate it 3 times, providing 3 pencils.
  51. Choose 2 pencils from the lvil, then duplicate them 3 times, providing 6 pencils.
  52. Or choose 3 pencils, providing a total of 9 pencils.
  53. If the "Calculate for Each" flag is set, the game could provide 3, 4, 5, 6, 7, 8, or 9 pencils, based on whether it grabbed one, two, or three pencils each time it rolled the dice for one of it's counts.
  54.  
  55. The "Chance None" value dictates how likely it will be that the game *will not* give that lvli's item when requested.
  56. https://i.imgur.com/KewpY5b.png
  57. In this SchoolDeskChanced container, the container might now have *0*, 3, 6, or 9 pencils. This is because the game might roll the dice and determine that it will not provide the item, based on the chance none, and then it will "duplicate" that lack of an item three times, since that's the count in the container, and it will result in 0.
  58. Adding the "Calculate for Each" flag would mean that the possible pencil count would be 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9, since the game might roll the chance none for each count individually.
  59.  
  60. The "Calculate for all levels <= player's level" flag is not as straightforward. It checks the player's level for loot, vendor, and container lists, but it checks the holding NPC's level, if this leveled item is placed in an npc's inventory.
  61. If you were to set the 3 pencil entry to level 5, the player would only be able to find 3 or 6 pencils in the container, until they reach level 5, at which point the *only* possibility would become 3 pencils, multiplied by the count of the lvli in it's container.
  62. https://i.imgur.com/d5Qa57G.png
  63. Adding the "Calculate for Each" flag would mean that the possible loot would, instead of changing to *only* the highest level that the player/npc has reached, *expand* to have the potential to grant three pencils per count of lvli in a container instead.
  64.  
  65. The "Use All" flag overrides all other flags, and ensures that the game provides all included items for every single count of the lvli.
  66. https://i.imgur.com/UDSeFp3.png
  67. https://i.imgur.com/ZHanMEU.png
  68. You would find exactly 1 pencil, 2 apples, and 3 carrots in this desk everywhere it was placed.
  69. However, with this count, you would always find exactly 4 pencils, 8 apples, and 12 pencils.
  70. https://i.imgur.com/bmDBJ6w.png
  71. The use all flag is often used for WithAmmo lists, and for general loadouts in some cases.
  72. An NPC must have *at least* one round of the ammo that their weapon has, to fire it. With a single bullet, they will be able to fire and reload infinitely. WithAmmo lists contain a guaranteed ammo round, a chanced amount of additional rounds, a chanced amount of hulls/cases/drained cells, and a weapon condition lists, with the Use All flag set.
  73.  
  74. The base game uses "75" lists for a lot of leveled items. A "75" list generally contains a single entry for an item with it's Chance None set to 25, and the calculate for each flag set, meaning that when the game asks for that lvli, it will provide up to a maximum of the count it asks for, but each individual item will roll a 25% chance to not be provided. A container with a count of 8 of the Ammo10mm75 lvli will have up to a *max* of 8 ammo to spawn with it, but it may have as low as 0.
  75.  
  76. STEP 2: Your weapon needs a condition list.
  77. Start by either making a new lvli if you're in the GECK, or "copy as new record" a base game lvli in the FalloutNV.esm into your plugin in FNVEdit.
  78. I generally start the condition entries at about .2 health, generally extending them up to a max of .55, at .05 condition thresholds, and I set the max 4 conditions to higher levels. If you copied an existing record, change all the items to your new weapon.
  79. Syntax: (Weapon Level Count Condition)
  80. Example:
  81. Weap10mmPistol 1 1 0.2
  82. Weap10mmPistol 1 1 0.25
  83. Weap10mmPistol 1 1 0.3
  84. Weap10mmPistol 3 1 0.35
  85. Weap10mmPistol 5 1 0.4
  86. Weap10mmPistol 8 1 0.45
  87. Weap10mmPistol 11 1 0.5
  88. Weap10mmPistol 13 1 0.55
  89.  
  90.  
  91. If you're *just* doing a non-ranged weapon, you're done making lvlis here. Non-ranged weapon cond lists are placed in loot/npc/container lists, as all they need to do is provide a variable conditioned weapon, since they don't use ammo.
  92. If you're doing a ranged weapon, you will need a WithAmmo lvli:
  93. A withammo lvli is what will actually be integrated into places in the base game and it's DLCs. It contains a single, 1-count weapon condition lvli entry, such as Cond10mmPistolLoot, a single, 1-count entry of the weapon's regular ammo type, such as Ammo10mm, an ammo 75 list entry, such as Ammo10mm75, set at the max potential ammo to be found with that weapon, and an casing/hull/drained cell 75 entry, such as Case10mm75, set at the max amount of casings/hulls/drained cells to be potentially found with the ammo.
  94.  
  95. Adding the condition list to the WithAmmo lvli means that a weapon of variable condition will be found in it's integration locations. The single 1-count ammo entry guarantees that any npcs it's provided to will be able to "load" their gun, allowing them to fire and reload forever. The Ammo75 entry (example: Ammo10mm75) provides a maximum amount of ammo for the player to find when they open that container or NPC. The Casing75 entry determines how many potential casings or drained cells will be found with the weapon. Casings/drained cells don't need the guaranteed entry like ammo does, because they're not crucial to the functioning of NPC weapons, so it's fine if they don't show up every time.
  96. Explosives don't have hulls/casings generally, so they don't need those in their withammo lists.
  97.  
  98. Step 3: Scripted Integration
  99. Once you've got your Cond list (in the case of melee weapons) or WithAmmo list (for ranged weapons), you can get started on the actual scripted integration:
  100. In the GECK, make a new quest entry. Set it's ID, (name doesn't matter), priority to 55, tick the start game enabled box, and set the processing delay to .1. Close the quest, and save your plugin.
  101. This has set up this quest to automatically start when a new game is started or the mod is loaded for the first time, which will automatically run your startup script each time the game runs.
  102.  
  103. Next, make a new script. Right away, *set the script type to QUEST* up at the top of the script window. If you don't, the script won't be visible when you go to attach it to your quest.
  104.  
  105. Now, we're going to start your integration script using the template below. This includes the formatting needed for naming your script, making sure it does it's commands at the right time, and just about all of the formlists you're likely to need to add an item to. This includes things like Shotgun Surgeon weapons, Grunt weapons, legion banned chems, casino weapon removal lists, and so on.
  106.  
  107. Open the integration script template, and copy and paste everything into your new script.
  108. https://pastebin.com/ZAbw0dfZ
  109. Change the script name to something of your own. I strongly recommend *against* starting your script name (or any editor ID) with a number, as it can cause problems.
  110.  
  111. Lines which start with a ; are commented out and not read when compiling your script. The notes in the integration template script are there to help inform you about what each section does. Feel free to remove them once you remember what each list is for.
  112.  
  113. Replace the qqq with the Editor ID of any of your weapons or other items that qualify for each list. Do this for every version of your weapon, if you have variants.
  114. Make sure to find and add to any base game repair lists that your item might qualify for. You more than likely *don't* want to put any unique items in repair lists, as that will allow the player to accidentally (or purposefully) repair a generic version of a weapon with it's uniques.
  115.  
  116. Now you're at the leveled list choice part of the script.
  117. There is an example of how the format works directly under a template line, filled with placeholder letters.
  118. However, for the bulk of this, you'll want to be copy pasting from the leveled list compilation instead of duplicating that line.
  119. https://pastebin.com/Z4h708r8
  120. The lvli compilation is formatted for JIP leveled list and formlist additions. These are ListAddForm (replaces AddItemToFormlist) and LListAddForm (replaces AddItemToLeveledList). These are arguably superior replacements, because they don't bake into your save, allowing you to make each weapon/item optional, and able to be toggled at anytime, users won't experience *as much* of an issue if they remove your mod, and most importantly, YOU CAN UPDATE THE INTEGRATION SCRIPT ON EXISTING SAVES. The old command use method involved setting a DoOnce and stopping the startup quest, meaning that you can't update the script *literally at all* on existing saves. Using the JIP method bypasses all of those issues.
  121. They're ready for you to copy paste into your script, then use Notepad++'s Find and Replace feature to replace all the instances of qqq in your new script with your Cond or WithAmmo list.
  122. From here, you will generally need to use your intuition when deciding where to place your weapon. Feel free to ask questions about certain leveled lists and what should go in them, but the most independent thing to do will always be to just look at what's in the leveled list yourself.
  123.  
  124. There is one "editorial" factor due to *me* making this compilation, and not someone else:
  125. I filled out the energy weapons sections with some lvlis which don't /always/ contain energy weapons in the base game. I chose relatively general lists, to expand the saturation of energy weapons in the game, since they're much less common than other weapon types. Simply avoid lists which don't say energy in them when copying from that list, and you should avoid that little flavoring choice by me, and your energy weapons will be much rarer, like in the base game.
  126.  
  127. The Gun Runner leveled lists are formatted differently than the rest, and their Editor ID spot has yyy instead of qqq:
  128. The Gun Runners leveled lists don't use WithAmmo or condition lists, they get a direct entry of the weapon itself, set to 0.99 condition. This is the behavior in the base game. If you use a WithAmmo list there, the weapon will show up at noticeably lower condition than the other weapons provided by the Vendortron.
  129.  
  130. TTW entries are listed at the bottom.
  131.  
  132. * entries:
  133. Any lists marked with a * do not have the "Calculate from all levels =< player's level" flag set, which means that they will provide any item in them, regardless of whether the player is fresh out of the vault at level 1, or at the end game and max level.
  134. Use the following command on any lists marked with * to allow them to change their provided contents based on the player's progression:
  135. LListSetFlags qq 1
  136.  
  137. Example:
  138. LeveledListAddForm 188NCRArmsMerchantWeap WithAmmoSniperRifle* 18 1 1.0
  139. If you're using this line, you want your weapon to only show up at a higher level; therefore you should also include the line
  140. LListSetFlags 188NCRArmsMerchantWeap 1
  141. to ensure that the sniper rifle is *not* the *only* candidate for spawning once the player hits that level.
  142.  
  143. My procedure is:
  144. Copy my integration script into Notepad++
  145. Copy and paste in all my leveled list choices, then at the end, use this tool to remove all lines NOT containing *
  146. https://bedan.ir/modules/Tools/Remove-Lines-Containing.html
  147. Copy the remaining lines back into a blank notepad++ file
  148. Select LeveledListAddForm and find and replace LeveledListAddForm with nothing (Just click in the second box and backspace)
  149. Do the same for the 1 1 1.0 parts and all their different leveled variants
  150. One by one, find and replace all the withammo and cond list editor ids with nothing
  151. Take the remaining lines, then find a remove duplicate lines tool
  152. https://www.textfixer.com/tools/remove-duplicate-lines.php
  153. Take the output text from that and go to this tool
  154. https://pinetools.com/add-text-each-line
  155. Paste your duplicates-removed text in the box on the left, select add text at the beginning of lines, put "LListSetFlags " in it, select add text after, and put " 1" in it, hit execute, then you have a block of commands that will set the flag appropriately on all the lists you chose that could use it.
  156. Now, just paste those lines in at the end of your script, and use Find and Replace on * to delete all of them from earlier in the script.
  157. You should probably make sure that your script is indented properly, for readability. Those lines won't be, once you process them with all those tools. Fortunately, you can paste your script into this tool
  158. http://www.cipscis.com/fallout/utilities/validator.aspx
  159. And it will auto indent it for you. (This tool will show you little error messages if you hover over them with the mouse; the tool hasn't been updated for years, so it doesn't know that the newer script commands are valid. You can ignore them)
  160.  
  161. Now, just copy paste that all back into your script, and hit save. If everything is valid, the little * next to the name of the script at the top of the script window will disappear, and the script will save. If not, you should have the GECK Extender installed, which will *actually tell you*, either via a pop-up or in the message log, what the problem with your script is. It may be a typo, or you may have forgotten to remove the *s from the earlier lines; I often do. That's why they're there, to make sure to remind you to set the flags on lists that need it.
  162.  
  163.  
  164. You're done with most of the work now.
  165. Go back to the quest you made earlier and open it. As long as you remembered to save your script as a quest script, you'll be able to select it in the script menu and attach your script. You can type "scpt" for the menu to automatically take you to the first script that starts with that.
  166. Select it, then hit okay, and save your file.
  167.  
  168. Now to test!
  169. Load up your file in the game. I suggest that when you load it for the first time, you uncomment the printc lines at the start and finish of the file, (and change what they say in the quotes to refer to your mod, for clarity) so that you can open the console and verify that your startup script started and finished successfully. There are cases where misuse of commands may lead to the script starting, but not finishing.
  170.  
  171. The easiest way to test your integration is with two commands:
  172. DumpLevList xxx
  173. DumpFormList xxx
  174.  
  175. Simply select one of the formlists or leveled lists that you added to, type the relevant command above, then the Editor ID that you're checking after it, hit enter, and the console will print all the items contained in that list. It may be long, but if you check it in the console log provided by Improved Console, and it has your item, you're good to go! It got added.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement