Skip to main content

Attaching Static Models to Animated Models

Hiding Animated Models:

Find material2 decls for what parts of a model to hide. Replace everything in the decl with the following.

{
	inherit = "template/editor/worldeditor";
	edit = {
		Parms = {
			texturemap = {
				filePath = "art/tile/common/nodraw.tga";
				options = {
					type = "TT_2D";
					filter = "TF_DEFAULT";
					repeat = "TR_REPEAT";
					format = "FMT_RGBA8";
					atlasPadding = 0;
					fullScaleBias = false;
					noMips = false;
					fftBloom = false;
				}
			}
		}
		EditorData = {
			editorImagePath = "art/tile/common/nodraw.tga";
		}
	}
}

This decl can be found in various .resources files at art/tile/common/nodraw.decl. It makes the textures assigned to it unable to see in game.

Attaching Static Models:

It is important to make sure your custom model replaces an existing model that doesn't interfere with gameplay and hasn't been used in a different mod before. Using various mods together that replace the same model for different uses can cause several problems.

When publishing a mod that replaces a static model, you should indicate which static model you replaced. This can help diagnose or avoid compatibility issues with other mods.

Find the FX decl used for the certain model. An easy way to find most of them is to check the fxDecl parameter in most entitydef decls.

In the FX decl, add a new item that uses this example as a base:

			item[11] = { // Change the item number when needed
				name = "assault_rifle";
				group = "fire";
				type = "FX_MODEL";
				looping = true;
				originType = "FX_ORG_TRACK_POS";
				rotationType = "FX_ROT_TRACK_AXIS";
				modelParms = {
					staticModel = "art/kit/hub/prop/pizzabox.lwo"; // The model that will be replaced. When changing the filepath, make sure to add any extra parameters in the .lwo extension if necessary
				}
			}

After adding the new item to the FX decl go to the top of the decl and change "num = <number of items>;" by how many items you added.

Optional Parameters:

  • renderWithGunFov - Keeps the custom weapon model at the same position as the FOV. This parameter will have to be added in the ModelParms section of the FX item.

renderWithGunFov = true;

  • size - Changes the size of the model.

size = 0.165000007;

  • offset - Changes where the model is located.
offset = {
	x = 0;                
	y = 0;
	z = 0;
}
  • rotOffsetAngles - Rotates the model.
rotOffsetAngles = {
	yaw = 0;
	pitch = 0;
	roll = 0;
}
  • tagNames - Moves the model to a specific body part. Most tags can be found in the FX decl.
tagNames = {
	num = 1;
	item[0] = "muzzle";
}
  • startCondition and stopCondition - Changes the condition of when the model shows and stops. A full list of conditions can be found in the FX CONDITIONALS page.
startCondition = {
	num = 1;
	item[0] = "FX_WEAPON_BEGIN_RAISE";
}
stopCondition = {
	num = 2;
	item[0] = "FX_WEAPON_BEGIN_LOWER";
	item[1] = "FX_WEAPON_BEGIN_RAISE";
}

Adding Rain FX:

Find the material2 decl for the weapon model you replaced earlier and add the following to the first line of the decl.

inherit = "template/pbr_gun";

Next, you'll have to add the following to the Parms section of the decl.

wetnessdroptiling = 4;

Your material2 decl should look something like this.

{
	inherit = "template/pbr_gun";
	edit = {
		RenderLayers = {
			item[0] = {
				parms = {
					bloommaskmap = {
						options = {
							format = "FMT_BC4";
						}
					}
					colormask = {
						filePath = "textures/system/constant_color/black_noalpha.tga";
						options = {
							type = "TT_2D";
							filter = "TF_DEFAULT";
							repeat = "TR_REPEAT";
							format = "FMT_BC1";
							atlasPadding = 0;
							fullScaleBias = false;
							noMips = false;
							fftBloom = false;
						}
					}
					smoothness = {
						filePath = "textures/system/constant_color/grey_dk.tga";
					}
					normal = {
						filePath = "art/kit/hub/prop/pizzabox_n.tga";
					}
					specular = {
						filePath = "textures/system/specular/flatspec_35.tga";
					}
					albedo = {
						filePath = "art/kit/hub/prop/pizzabox.tga";
					}
				}
			}
		}
		Parms = {
			wetnessdroptiling = 4;
			surfaceemissivecolor = {
				y = 0.690196097;
				z = 0.160784304;
			}
			blendheightmapscale = 4;
		}
	}
}