SRIV SDK Release B: Creating new weapon tutorial

We have already had tutorial how to replace existed weapon, but knowledge how create new weapon for workshop is very fragmented, so I decided to create full tutorial for most common cases and I am going to update it. Thanks to Flow754 and Donhok this article mainly based on their works

You need this tools:

Python 2.6.6
Wx Python
FBX Python SDK 2014 for Python 2.6
3d editor that support FBX import-export
Minimaul's Saints Row IV Tools
Flow754's Weapon Clone Tool

SECTION 1: DOWNLOAD AND INSTALL TOOLS

SRIV SDK Release B: Clothing Item Tools

Download the latest SDK Release B and the latest version of the FBX converter from the release thread.
For the following items, I haven't tested it personally, but if you are on a 32 bit operating system, download the 32 bit versions of each program if applicable.

Python 2.6.6

Download the 64 bit version named Windows X86-64 MSI Installer

Wx Python

Grab the one named "wxPython3.0-win64-py26"

FBX 2014.1 SDK

Install all 3 programs
, with Python 2.6 being installed first.

Finally you need to copy some files from the FBX 2014.1 SDK directory to your Python 2.6 directory. This link from Autodesk explains it pretty well.

If you properly installed everything your python/lib/site-packages should look at the least like the following:

1) Notice the Wx folder and local files that should have been installed here.
wx-3.0-msw/
wx.pth
wxversion.py

2) The fbx files that you should have copied over to this folder.
fbx.pyd
fbxcommon.py
sip.pyd

upload_2014-9-5_20-49-3-png.7637
Flow754's Weapon Clone Tool
Download and unpack to any folder with quick access

Minimaul's Saints Row IV Tools*

*This download is technically optional. This is for those of you that would like to merge few weapons\skins to one pack or edit weapon's name and description.

SECTION 2PLANNING AHEAD
This is very important step, in fact we coping weapon which exist and tweak its setting some tweak is easy some don't. So please select weapon to copy which have similar behavior as yours, the most important questions are
- is it melee?
- is it has clip?
- is it has special bullet(like mines, rocket, etc)?

Melee is simplest has only one mesh and one bone, weapon with clip is actually has two mesh (weapon and clip) and special weapon has several meshes(weapon and projectile) this all information is prescribed in asm_pc files you can edit them with Minimaul's Saints Row IV Tools but it can be little tedious.

After this choose what you wanna to create: a new weapon, new mesh as style for existed weapon or simply new material as skin

SECTION 3: CREATING A NEW WEAPON BY CLONING

If you choose which weapon you want to copy, you also need to find its "real" name in game files. To find it run SR4, open weapon in friendly fire and look on Style name( HOMER in my case)
20180417211857_1.jpg

Download this file weapon_string.zip and open reference_strings file with your language (us in my case) in any text editor( I use notepad++) then press Ctrl+F and find string that has this data
Untitled-16.png

We need "Name" parameter, so I copy CUST_WPN_COSTUME_DESC_BASEBALLBAT_0 and open
weapon_costumes.xtbl from archive with the same text editor and find costume block that has this string
Untitled-17.png

Copy name parameter (baseball_bat-0-Bat) then run windows command line: press Win+R and type cmd in the "Open" field and press Ok

Navigate to your Flow754's Weapon Clone Tool folder by typing the following command.

Code:
cd “YourDisk:\yourPathTo\Flow754'sWeaponCloneToolFolder”

In my case
Untitled-19.png


After this run Flow.WeaponClone and copy weapon

Code:
Flow.WeaponClone SourceWeaponName NewWeaponName weapon [output]

I my case it looks like this
upload_2018-4-19_16-20-42.png


More info about clone tool you will found here

Tool will create inside its folder new with your new weapon name and it will has all weapon files
upload_2018-4-19_16-48-36.png


SECTION 4: CREATING NEW WEAPON IN MAYA
For maya set this settings
Up axis Z
Lineat unit centimeters
upload_2018-4-19_16-49-23.png

Create mod folder in any folder and copy there textures for your weapon in .tga format

In Saints row 4 there are two pack with textures, one low-res within weapon archive and one hi-res in separate _high archive. Hi-res textures has _lg suffix, low-res has _sm suffix. To prevent some glitches please crete low-res textures.

upload_2018-4-18_9-12-27.png


Note: There are some quirks in SR4 exporting tool linked the to scale, there is few ways to get around them, I will show one that seems to me as easiest.
You can create or import any weapon with real-life scale in centimeters and place it to the coordinate center. For example average sword in SR has height around 100 cm
After this
1) Freeze transform: Modify>Freeze Transform
upload_2018-4-18_8-7-52.png

2) Select your model and scale it down to 0.394 that is the same quirk as I mentioned before and freeze transform again
upload_2018-4-19_17-0-47.png

3) Create phong material: Windows>Rendering Editor>Hypershade
upload_2018-4-18_8-8-46.png

In the Hypershade: Create>Materials>Phong
upload_2018-4-18_8-10-45.png

Name material as you wish(my_melee_weapon_material in my case) and set an least one color texture

Full material guide is here

Choose low-res textures
upload_2018-4-18_9-19-36.png


Select your weapon and apply created material
upload_2018-4-19_17-6-27.png

In my case I need another one material so I create it in the same way, named it as my_melee_weapon_material1 and applied to selected faces

Creating bone chain
For melee weapon you need only one bone
Untitled-5.png

Create it, rename it to bone_root and place to zero coordinate, after this freeze transform with this settings
Untitled-6.png


Saints row has some specific bone mapping, so for proper exporting we need to add some extra data to the bone

Add extra attributes
Select your bone, Modify>Add Attribute
upload_2018-4-19_18-1-28.png


First attribute

Long name - p_bone_name
Nice name - P Bone Name
Make attribute - Hidden
Data Type - String

upload_2018-4-19_18-2-56.png


Then add second attribute

Long name - p_bone_order
Nice name - P Bone Order
Make attribute - Keyable
Data Type - Integer
upload_2018-4-19_18-13-27.png


After this in attribute editor set in the extra attributes section
P Bone Name - root
P Bone Order - 1
upload_2018-4-19_18-18-39.png


Add tags
Game engine need to know where to place character's hands, impact point and other effect, empty groups are using for this purposes in Maya. To create empty group deselect anything and press Ctrl+G
Untitled-9.png

Melee weapon has three main groups with the names

tag_weapon_handle - place for the right hand
tag_weapon_impact

You can create your own with uniq name, for example for placing some effect, they only need to have tag_ prefix

For example

tag_my_vfx

Untitled-10.png

After creating all tags, select them all in the
upload_2018-4-19_17-15-41.png
,
Press middle mouse and drag and drop them to bone_root
Untitled-11.png

One problem with empty group because they are invisible in viewport, only when you select them in Outliner with enabled move tool. Select and move empty group to place where you want to place it
Skinning
Select your weapon mesh then add bone_ root to selecton then F2>Skin>Bind skin
As we have only one bone there is no need to tweak automatic skinning

After this there is time for some Volition's magic. Select bone_root and scale it to 2.540
Untitled-12.png
Note: The process of creating firearm without clip is the same, you only skip steps with clip, also you don't need tag_gunmag_handle. Pistols don't have tag_attach
There is not so much firearms with clip i SR4 there are pistols, Heavy SMG, Automatic Rifle and Burst Rifle for creating G36K I decided to copy Heavy SMG because currently Flow.CloneWeapon tool has some trouble to copy clip for the rifles
upload_2018-4-25_23-55-20.png

Then I look CUST_WPN_COSTUME_DESC_SMGLG_0 in weapon_costumes.xtbl
upload_2018-4-25_23-56-32.png

This is string belongs to SMGLarge-0-SWAT costume so I'll clone it
upload_2018-4-25_23-44-9.png

Create or import weapon mesh to Maya scale to real size in centimeters and place it like the middle of the handle should be near centre of coordinate
upload_2018-4-21_14-49-26.png

Also axis orientation should be like this
Untitled-3.png

Freeze transform: Modify>Freeze Transform
Extract clip to separate object
Look to your cloned weapon and find cloned archive with clip, in my case
upload_2018-4-26_0-8-44.png


Copy its name and past it to your clip
upload_2018-4-26_0-10-0.png

As you see there is some problem. Maya replace all "-" to "_" in names. There are few ways to fix, the easiest one is rename file after exporting. I will show it later.

Create new Phong material and apply to your meshes. Your weapon can has few materials up to 10 but material for clip should be first.
upload_2018-4-26_0-12-6.png

upload_2018-4-26_0-12-39.png

upload_2018-4-26_0-13-21.png

Select your weapon mesh, activate move tool and press edit pivot
upload_2018-4-26_6-56-13.png

Set zero to x y z fields and press Enter
upload_2018-4-26_7-9-15.png

Scale mesh to 0.394
upload_2018-4-26_6-59-57.png

Freeze transform:Modify>Freeze Transform
Scale clip to 0.394 too
Move clip to the center of coordinate, part of clip that should be inside of the rifle need to be above zero coordinate
clip.png

Freeze clip transform:Modify>Freeze Transform

Creating joints
Activate Snap to grid and create two bone\joints first is for main part, the second is for slide.
Place first joint to the center of the coordinates
upload_2018-4-26_0-21-41.png

Freeze transform for first joint with this settings
upload_2018-4-26_7-5-5.png

Rename first bone to bone_root and second to bone_slide
upload_2018-4-26_0-23-30.png


Add extra attributes
Select your bone, Modify>Add Attribute
upload_2018-4-19_18-1-28.png


First attribute

Long name - p_bone_name
Nice name - P Bone Name
Make attribute - Hidden
Data Type - String

upload_2018-4-19_18-2-56.png


Then add second attribute

Long name - p_bone_order
Nice name - P Bone Order
Make attribute - Keyable
Data Type - Integer

upload_2018-4-19_18-13-27.png

Select bone_root and expand extra attribute in the attribute editor, set
P Bone Name - bone_root
P Bone Order - 1
upload_2018-4-26_7-43-36.png


Select bone_slide and expand extra attribute in the attribute editor, set
P Bone Name - Slide
P Bone Order - 3
upload_2018-4-26_7-46-17.png


Skinning
Select rifle mesh, add bone_root to selection then F3>Skin>Bind Skin
Select rifle mesh F3>Skin>Paint Skin Weights
All moving parts should have max bone_slide weights, all fixed parts should have bone_root max weights
upload_2018-4-26_1-16-13.png


Add tags(empty groups)
Deselect anything and press Ctrl+G to create empty group
You need to add this tags:
tag_weapon_handle - place for character right hand
tag_secondary_handle - place for character left hand
tag_shell_eject - place for ejecting shells
tag_muzzle_flash - place for muzzle flash effect
tag_gunmag_handle - place for clip
tag_attach - place on the back when player is running
tag_vfx1 - optional place for effect, digital cross-hair in my case
tag_vfx2 - optional place for effect, digital cross-hair in my case

Select all of them in Outliner, press middle mouse button and drag drop them on bone_root
upload_2018-4-26_8-9-58.png

After this you can move them to the points where them should be on your weapon.

Then select your bone_root and scale it to 2.54
upload_2018-4-26_9-14-53.png


Export
Fbx export settings
Select rifle mesh add bones and tags to selection and File>Export Selection>Fbx to your_rifle.fbx
Deselect all, select clip and File>Export Selection>Fbx your_clip.fbx
upload_2018-4-26_1-20-24.png

upload_2018-4-26_0-47-5.png

For the rifle you can go to the step 5, but clip need some fixes

Fixing problem with clip name
Open your clip FBX with SDK converter and convert it
upload_2018-4-26_6-29-15.png

Go to output folder and find clip related files
upload_2018-4-26_6-37-39.png

Rename all of them with package name
upload_2018-4-26_6-31-24.png

Set folder to you cloned weapon folder
Then press Package button in SDK converter
That all but SMG template have some problem as two-handed shooting, pistol shells and wrong slot. I will show how to fix it in Step 6
That all you can export all to Fbx to the mod folder with your textures with this settings

SECTION 5: EXPORTING WEAPON TO THE GAME

Run sdk converter SaintsRow_FBX_Converter.py
NVJVb2T.jpg

Now launch the FBX converter. I'll lay out what it does.

1. This one’s pretty obvious, navigate to your FBX and select it.
2. This dropdown menu lets you select between each mesh in your FBX, in this case we can select the main weapon mesh and the clip mesh of the Police Pistol.
3. Select 'ir_at_bsimple1' as your shader. The rest of the shaders aren't supported / documented.
4. These toggles enable export / converting of various file types. You want to enable all of these for your main mesh.

Press Import and choose your FBX file
Set shaders to your material
Press Rigx, Cmesh and Matlib buttons then press Convert
upload_2018-4-19_19-40-3.png


After converting press Folder button and set path to folder with your cloned weapon and press Package

That almost all you need only to pack files to vpp_pc, I use for this Saints Row IV workshop tool from steam
Run tool, select all files in the cloned weapon folder
upload_2018-4-19_19-42-39.png

drag and drop them to the tool window
upload_2018-4-19_19-54-58.png

File>Save to file>PathToYourSR4\mods folder.
Run the game to check out is it works. Yeah it's works
20180419003636_1.jpg

20180426064358_1.jpg

SECTION 6: TWEAKING AND HOW TO

How to change weapon's icon and cost
1)First you need Flow754's Peg Assembler and any bitmap editor that supports DDS format like paint.net
2)Create your own icon with size around 128x96, dds plugin for photoshop has limitation, width and height of the icon should be divided on 4 without the remainder
3) Сreate alpha channel for this image, black background should be transparent.
4) Save icon as DDS DXT5 with the name ui_hud_inv_your_weapon_name.tga.dds
5) Open Flow754's Peg Assembler and drag and drop icon to here
Name - always_loaded
Output URL -path to folder with your cloned weapon
upload_2018-4-19_21-34-45.png

Press create and two file always_loaded.cpeg_pc and always_loaded.gpeg_pc should be created
7) Open items_inventory.xtbl and find <Bitmap> section
upload_2018-4-19_21-27-53.png

and past there your icon name without .tga.dds
upload_2018-4-19_21-31-13.png

8) Cost of weapon is in the <Cost> section change it as you wish an save changes after
9) Drag and drop all files from clone weapon folder to Saints Row IV workshop tool and save them to mods folder or to the Steam Workshop
20180419214434_1.jpg
How to add special effect for the weapon
Open weapon_costumes.xtbl and find <Constant_Effects> section
and add construction like this
Code:
                <Constant_Effect>
                    <Effect>VFX_LaserSight</Effect>
                    <Weapon_Prop_Point>my_vfx</Weapon_Prop_Point>
                    <Condition>always on</Condition>
                </Constant_Effect>
Where VFX_LaserSight - effect from misc_tables.vpp_pc\effects.xtbl
my_vfx - tag that I have created in Maya before without tag_ prefix
always on - condition that starts effect
always on
during melee swing
fine aim
weapon raised
during reload
weapon not firing
upload_2018-4-19_23-51-26.png

20180419235606_1.jpg
How to change weapon's name and description
In folder with cloned weapon you can see stringxml folder, there are a language files in xml format
upload_2018-4-20_9-50-57.png

open them with any text editor, edit them then after saving and open them with ThomasJepp.SaintsRow.BuildStrings.exe
upload_2018-4-20_9-53-49.png

from Minimaul's Saints Row IV Tools, it will create le_strings files, copy them and replace in the weapon clone folder
More info is here
How to change shooting aiming, etc character animation for the weapon
Open weapon_costumes.xtbl in your cloned weapon folder and find <Animation Group>
View attachment 18697

You can past here this values but some of them may not work because was cutterd from previous game:
Bow
Brute
Chainsaw
Default
Drunk
DualPistol
Dubstep
Flamethrower
Genki
GrenadeLauncher
Hunting
KB_Gloves
Laser Shotgun
Lever
Luchador
Melee
Melee 1h
Melee 2h
Minigun
Nightstick
PepperSpray
PimpSlap
Pistol
Predator Drone
Revolver
Rifle
Riot
RPG
SatchelCharge
SawedOff
Shot Gun
SidescrollBike
Sledge
SMG
Sniper
StagRifle
Stun Gun
Sword_1h
Thrown
How to change weapon slot
Open weapons.xtbl in your cloned weapon folder and find <Inv_Slot> section you can put there:
unarmed
single_use
rifle
explosive
special
grenade
vehicle
melee
pistol
smg
shotgun
How to make possible to shoot with your weapon from each hand
Open weapons.xtbl in your cloned weapon folder and find <Flags> section and put there <Flag>dual wieldable</Flag> or delete it if you want to remove this possibility
<Flag>allow offhand grenade</Flag>
<Flag>alt unlimited ammo</Flag>
<Flag>always play melee vfx</Flag>
<Flag>always wear on back</Flag>
<Flag>apply force to live ragdolls</Flag>
<Flag>armor piercing override</Flag>
<Flag>attach to forearm</Flag>
<Flag>attaches</Flag>
<Flag>brass during reload only</Flag>
<Flag>bullets can hit multiple humans</Flag>
<Flag>bullets damage tanks</Flag>
<Flag>can zoom</Flag>
<Flag>causes convulsions</Flag>
<Flag>constant vfx on combat ready only</Flag>
<Flag>constant vfx only at night</Flag>
<Flag>cutscene only</Flag>
<Flag>disallow crouching</Flag>
<Flag>disallow forward throw in vehicle</Flag>
<Flag>disallow jumping</Flag>
<Flag>disallow reload</Flag>
<Flag>disallowed in demos</Flag>
<Flag>do not hide when sprinting</Flag>
<Flag>dual wieldable</Flag>
<Flag>explosions damage tanks</Flag>
<Flag>gibs victims</Flag>
<Flag>has alt fire</Flag>
<Flag>heavy weapon move speed</Flag>
<Flag>incendiary shots</Flag>
<Flag>infinite magazine capacity</Flag>
<Flag>instant ragdoll</Flag>
<Flag>left hand</Flag>
<Flag>other hand ik during attack only</Flag>
<Flag>lethal melee</Flag>
<Flag>looping muzzle flash</Flag>
<Flag>manually detonates</Flag>
<Flag>melee can dislodge movers</Flag>
<Flag>melee continue on world collide</Flag>
<Flag>no blood splat</Flag>
<Flag>no combat ready</Flag>
<Flag>no random give</Flag>
<Flag>no vehicle combat ready</Flag>
<Flag>not allowed in vehicle</Flag>
<Flag>not allowed with human shield</Flag>
<Flag>on selection</Flag>
<Flag>on trigger</Flag>
<Flag>one shot shatter</Flag>
<Flag>revives humans</Flag>
<Flag>secondary trigger fires grenades</Flag>
<Flag>secondary weapon</Flag>
<Flag>unlimited ammo</Flag>
<Flag>unlockable</Flag>
<Flag>use block flinch anims</Flag>
<Flag>use box shape for melee casts</Flag>
<Flag>use mission srid for effects</Flag>
<Flag>use modified bullet direction</Flag>
<Flag>zoom allows fine aim</Flag>
<Flag>show reserve in hud</Flag>
<Flag>drops with full reserve</Flag>
<Flag>player instant reload</Flag>
<Flag>melee always dislodge</Flag>
<Flag>no bullet decal</Flag>
<Flag>manned turret</Flag>
<Flag>force combat ready</Flag>
<Flag>explosion ignores owner</Flag>
<Flag>continuous burst</Flag>
<Flag>alien weapon</Flag>
<Flag>superpower blast</Flag>
<Flag>create_endpoint_exp_on_miss</Flag>
<Flag>use extra aim assist</Flag>
<Flag>fire audio only on burst start</Flag>
<Flag>hit effect on tracer impact</Flag>
<Flag>acid shots</Flag>
<Flag>anal probe ultimate</Flag>
<Flag>scale damage up by dist</Flag>
Archive with the all SR\SR4 weapons in FBX format which you can use as template you can download HERE
 

Attachments

  • weapon_stings.zip
    401.9 KB · Views: 541
Last edited:
This tutorial will be updated and fixed also I can add 3ds max version. Also if someone will show me how to add extra attributes to the Blender I will add tutorial for it too.
 
Last edited:
This tutorial will be updated and fixed also I can add 3ds max version. Also if someone will show me how to add extra attributes to the Blender I will add tutorial for it too.
Yeah,a Blender version would be cool.My 3ds max will stop working in 10 days but it'll be enough time to export a lot of .fbx files.Btw. Would it be possible to clone the GOOH Sloth Gun made/ported idk by bigbang and simply replace the sloth mesh by one simple one bone mesh?
 
Yeah,a Blender version would be cool.My 3ds max will stop working in 10 days but it'll be enough time to export a lot of .fbx files.Btw. Would it be possible to clone the GOOH Sloth Gun made/ported idk by bigbang and simply replace the sloth mesh by one simple one bone mesh?
Yeah, I think it's possible if this weapon doesn't use some additional animation but not so sure about particle effect, i have never edited it.

Jeez, I though that Blender community are mature now, but it's looks like only programmers and Unity enthusiasts are here. Google found three unanswered questions about extra attributes on forums, anyway after some experiments I added extra attributes. No sure are they work but it's looks promising,
upload_2018-4-20_9-30-17.png
 
Last edited:
Wow,that is pretty cool man.:eek:And yes the sloth gun uses animation and effects as far i could see.The sloth gun acts somehow like a vehicle and i would like to replace the sloth mesh with a (Silver)Surfboard and let the player character stand on it.It would be cool if the board could use the gun but it would also be enough to me if it's just the board.
 
Wow,that is pretty cool man.:eek:And yes the sloth gun uses animation and effects as far i could see.The sloth gun acts somehow like a vehicle and i would like to replace the sloth mesh with a (Silver)Surfboard and let the player character stand on it.It would be cool if the board could use the gun but it would also be enough to me if it's just the board.
Sloth gun is't actually a vehicle, it's gun with very specific animation set for the character, IDK how bigbang make it but from my point of view it's a huge amount of work to port animation and add new strings to the tables, I guess it will be much easy to set some costume and animation through lua script.
 
Sloth gun is't actually a vehicle, it's gun with very specific animation set for the character, IDK how bigbang make it but from my point of view it's a huge amount of work to port animation and add new strings to the tables, I guess it will be much easy to set some costume and animation through lua script.
Ok.I thought that replacing the mesh is the only thing to do but if its that difficult then i can't do it because my knowledge is unlikely much to low about all that stuff and i also don't know enough about lua scripting im on the early start with it right now.But maybe some day someone will read my request and creates a cool silversurfer board. :rolleyes:
 
Ok.I thought that replacing the mesh is the only thing to do but if its that difficult then i can't do it because my knowledge is unlikely much to low about all that stuff and i also don't know enough about lua scripting im on the early start with it right now.But maybe some day someone will read my request and creates a cool silversurfer board. :rolleyes:
It theory you can create your own Animation group in anim_groups.xtbl then map to this group in anim_default.xtbl some animation as surfing on the roof of the car and set this group to your weapon.
 
It theory you can create your own Animation group in anim_groups.xtbl then map to this group in anim_default.xtbl some animation as surfing on the roof of the car and set this group to your weapon.
I know how to do animations in Poser 7 but my knowledge on put that to the game is to low.What kind of animation .bvh or whatever.I' am not a programmer or game dev.At sample it starts with "What is an animation group?How are movements of whatever object are handeld by the game engine? I think i'd better stop modding games i don't understand and simply go back modding Skyrim,Oblivion,or fo3/4.But i want to say that you are the most cool guy here in the community.Thank you very very much for all the information you gave and your patience with my stupid nerd questions.Thank's a lot.
 
I know how to do animations in Poser 7 but my knowledge on put that to the game is to low.What kind of animation .bvh or whatever.I' am not a programmer or game dev.At sample it starts with "What is an animation group?How are movements of whatever object are handeld by the game engine? I think i'd better stop modding games i don't understand and simply go back modding Skyrim,Oblivion,or fo3/4.But i want to say that you are the most cool guy here in the community.Thank you very very much for all the information you gave and your patience with my stupid nerd questions.Thank's a lot.
You think too much, we don't have possibility to create new animation in SR4, that is only text work in anim_default.xtbl where you prescribe what the name of existed animation should play when you aiming, running, etc.
 
Last edited:
Back
Top