Serious Sam 4

Serious Sam 4

Not enough ratings
How to add your Weapon/Upgrade/Gadget to the NRM Database
By NSKuber
It's easier and faster than it looks, I promise!
   
Award
Favorite
Favorited
Unfavorite
Preliminaries
Check out this videoversion of the guide to see how fast and easy this process is. The text guide contains more detailed information.

I assume, that, since you have already created your weapon/upgrade/gadget resource, you are somewhat able with the SED.
The following steps might take a bit of your time for the first time, but really it's just 1-2 minutes of work if you know what you are doing (more if you haven't created an icon yet).

Aside from creating a weapon/upgrade/gadget resource, you have to create a 256x512 icon texture for it. It will be used in the menu. It should have transparent background and I advise to leave the top/bottom ~20 pixels blank, otherwise it may not look good in the menu (clip because of the UV offset). Here is an example icon made by Croteam for their weapon wheel, it fits nicely (red lines represent the borders and those 20-pixels zones, actual icon doesn't have them):



It is important that the .tex texture which you create for the Database icon does not belong to an atlas. So if you have already created a 256x512 icon for your weapon for the weapon wheel and the texture is in the atlas "HUD", create another copy of it which doesn't belong to an atlas and use it in this process instead.

If you don't know how to make such an icon, I prepared a special "green screen" setup for myself and others to use - see instructions in the next section.
Shooting the icon
If you wish to create an icon for your weapon using my setup, launch SED (being subscribed to the NSKuber's Resource Manager mod) and open the level
Content/SeriousSam4/Levels/132_NSKubersTestbed/01_DatabaseLevel.wld
or, for Siberian Mayhem,
Content/SeriousSamSM/Levels/1_NSKuber/01_DatabaseLevel.wld

Navigate to this area of the level marked by an arrow:


(in Siberian Mayhem, you should already see the setup for icon shooting upon opening the level).

In there you can find a setup for "shooting" icons. Select the model and plug in your weapon's "for item" .mdl. Press "A" to center on the model, press Numpad 6 to enter in-game rendering mode, "~" (tilda) to deselect the model and then switch viewport to the mode "Left" (as on screenshot below)



After that, navigate around and zoom in/out by holding space and dragging with LMB/RMB to get the best angle, and shoot. Remove the "green screen" and add a touch of smooth outline in any graphical editing software. You can configure the green screen color in the green screen model Shader Modifiers.
Fill in the "Adding" tool
Now onto adding the resource. If you haven't already, launch SED, and open the level
Content/SeriousSam4/Levels/132_NSKubersTestbed/01_DatabaseLevel.wld

Start the simulation on this level, wait for a second and exit simulation. This is needed so that scripts extract some required information and print some of it to the console.



Copy your Steam ID if this is your first time using the tool.

On the right side panel, navigate to the "Common" tab and launch the "Add Resource to NSKuber's Database" tool. Then on the bottom left, switch the panel to "Tools". You should see something like on the second screenshot (without the ID pasted in yet):



Now you just have to fill some fields in this tool.
Type of resource - select one of the three - "Weapon", "Upgrade" or "Gadget".
Author name - put your nickname you want to be saved in the entry.
Author Steam ID - paste the Steam ID the console have printed out for you earlier. Click "Remember my Steam ID" button above so you don't have to do this each time.
Entry icon - link the .tex file of your 256x512 icon.
Displayed name - enter the name under which your weapon will be displayed in the Manager menu. Limited to 22 characters.
Overwrite existing entry - check this if you have already created resources for this weapon/upgrade/gadget earlier and want to update the entry.

All other entries in this group you don't have to touch now.

If you are adding a weapon
Now, say, you have created a weapon resource. Then you need to link your weapon item and its ammo items into corresponding fields under the "WEAPON PARAMS" group. You don't need to fill them all, only those which your weapon has! So e.g. if my weapon has only one weapon item and one ammo item, you need to only fill those fields and leave others as they were. You also have to choose a weapon group for yor weapon, most likely it will be "Other weapons" right now since there are no weapon packs out there yet.

I created a modified Rainbow Lasergun, which I will be adding in this guide. Here is how the setup looks for it (on the left), and for the Croteam's Double Shotgun weapon (on the right). I have highlighted the fields which were filled by me.



First three ammo fields should be filled first, "extra" ammo fields should only be filled if there is more than one variant of certain ammo item's size, and "secondary mode" should only be filled if the weapon has a natural (NOT unlockable by an upgrade, but a native) secondary firing mode which uses ammo.

Note that if your weapon uses ammo, the "common" ammo box should always be filled first!
So for example, Double Shotgun has "Shells_Small", which corresponds to regular 10-shells pickup, "Shells_Clip" which gives 5 (so it's a "small" one), then "Shells_Big" with 20 ammo ("big") and then "Shells_Drop" with 10, so I put it into "common, extra".

If you are adding an upgrade/gadget
Make sure the Type of resource is set to proper value, and fill other fields, dedicated to upgrades/gadgets correspondingly! Here are some examples of CT's default stuff:

Create resources and send the request
After you have filled all fields, hit the "Create database resources" button above the fields.

The console should print out something like this:



Ignore the "Datapath..." errors if they are present. However, if it prints out some Lua error, or the text contains some warnings like "Recoil duration is wrong" or something, check that you placed everything correctly and filled all values in weapon params and try pressing the button again until you get a satisfactory message.

Next you should do what, well, that message tells you to do.
At this point, the field "Templates file" should be magically filled with a "WeaponTemplate.rsc" file, as well as the field "Resource internal name" should be filled with text.



What you must do now is click on this templates file, "Save as", navigate to "Content/WeaponDatabase/" folder and save your templates file under the name equal to the resource internal name. For example, for my Rainbow Lasergun it will be the file "Content/WeaponDatabase/w1640055.rsc".

After you did that, run the simulation on the level. Your new weapon should appear in the NRM menu (opened using "T", Voice Comm button, in SED), at the start of the list with an asterisk next to it, meaning it's not approved into the DB yet.



You should test your weapon spawning properly by clicking on it with LMB/RMB (holding Shift for Ammo). If everything is well, open the tool again, check that the "Resource internal name" field is filled properly, and hit the "Send request to the database" button.

Now, if you want to add more weapons, you should hit "Clear all fields" button and start the process again.

After you repeated the process with all weapons, close the SED, delete the files of my Database level if you have accidently resaved some of them in the process, (particularly, remove folders "Content/SeriousSam4/Levels/132_NSKubersTestbed/" and "Content/SeriousSam4/Scripts/NSKuberMenus/" if you have them overwritten) and check that you now have two (or more, if you added more than one weapon) files with same name (.lua and .rsc) in your Content/WeaponDatabase/ folder.



You can open and inspect the .lua file with any text editor to see if its contents (weapon stats automatically extracted by the script) are correct, and if not, you can change them manually (but be careful not to screw up the syntax if youre are not sure).

Pack this WeaponDatabase folder along with your weapon resource into the .gro of your mod and wait for me to confirm the addition to the main database. You can use your newly added weapon from NRM in the editor until I do that.

That's it! Good job!
Updating your entries
If you in some way changed and want to update an entry
Say your weapon is already in the database, but you changed some stats, or want to change the icon or the group.

Like when adding a new resource, start the database level, run a simulation on it for a second and open the tool. Up there there are a bunch of buttons which will help you with updating.

Find my resources button searches all entries of the database (even those which are not yet approved by me, but you have created resources for them previously) which "belong" to you - it finds them by the Steam ID.
After you have found all your resources, you can select one of them from the dropdown menu and use the Insert existing resource data button. This will fill all fields with what you have specified previously for this resource. At this point, if you have changed some files, you can link new ones, or if you just changed some stats, you can immediately press "Create database resources" (don't forget to check "Overwrite..." checkbox) to create the updated script. There are a couple important notes here:
  • Weapon "internal" name is based on the weapon/upgrade params (gadget item params) filepath, so if you change that, the script will consider it as a new resource and create a new entry. Please avoid changing the path of the params file if the resource already in the database, but if you have to, write me so that I remove the "old" entry from the database.
  • If you haven't changed the paths to items (weapon/upgrade/gadget/ammo), you don't need to save the templates file again, the old one will work. If you did, then you need to resave templates file.

If the format of the database was updated and you need to update script files for all your weapons/upgrades/gadgets
It may so happen that one day I will decide that the current format of the database needs an update. I hope this never, or rarely, happens. In this case you should receive a message when updating your database from the menu or when launching this script tool about that outdatedness of your script entries.

In this case, make sure you have all your own resources installed/enabled, launch the level/simulation, you know how it goes, and then in the tool use the one of the "Update all my weapon/upgrade/gadget resources" buttons, depending on which type of entries got changed.
This will re-create the scripts for all your resources of that type, and you just need to shove them into your mod archives containint corresponding weapons and update on the workshop.
1 Comments
Mike Uchiha 27 Oct, 2023 @ 8:36pm 
You don't have permission to add to this weapon group :steamsad: i got this