Skip to content

Instantly share code, notes, and snippets.

@david-wm-sanders
Created January 22, 2026 01:54
Show Gist options
  • Select an option

  • Save david-wm-sanders/3cb22693f8f0efc34f6b04cbdf0b7ae6 to your computer and use it in GitHub Desktop.

Select an option

Save david-wm-sanders/3cb22693f8f0efc34f6b04cbdf0b7ae6 to your computer and use it in GitHub Desktop.
Script to remove screenshake for RWR vanilla package
import xml.etree.ElementTree as XmlET
from pathlib import Path
STEAMLIB_DIR = "C:/Program Files (x86)/Steam"
RWR_INSTALL_DIR = Path(STEAMLIB_DIR) / "steamapps/common/RunningWithRifles"
VANILLA_PKG_DIR = RWR_INSTALL_DIR / f"media/packages/vanilla"
VANILLA_PKG_WEAPONS_DIR = VANILLA_PKG_DIR / "weapons"
if __name__ == "__main__":
print(f"Processing projectiles in '{VANILLA_PKG_WEAPONS_DIR}'...")
# find all projectiles in the package weapons dir
projectile_paths = list(VANILLA_PKG_WEAPONS_DIR.glob("*.projectile"))
for i, projectile_path in enumerate(projectile_paths, 1):
with projectile_path.open(mode="r", encoding="utf8") as projectile_file:
try:
projectile_elem = XmlET.fromstring(projectile_file.read())
except XmlET.ParseError as e:
# skip projectile if the xml file is not well-formed
print(f"[{i}/{len(projectile_paths)}] Error parsing '{projectile_path.stem}': {e.msg}")
continue
result_elem = projectile_elem.find("result")
# skip projectile if it doesn't have a result element
if result_elem is None:
print(f"[{i}/{len(projectile_paths)}] Skipping '{projectile_path.stem}': no result element")
continue
# skip projectile if the result class is not "blast"
if (rc := result_elem.get("class")) != "blast":
print(f"[{i}/{len(projectile_paths)}] Skipping '{projectile_path.stem}': result class is '{rc}', not 'blast'")
continue
# skip projectile if the blast push is already 0
if result_elem.get("push") == "0.0":
print(f"[{i}/{len(projectile_paths)}] Skipping '{projectile_path.stem}': blast push already zero")
continue
# modify the blast push attribute and overwrite the original file
print(f"[{i}/{len(projectile_paths)}] Fixing '{projectile_path.stem}' with push of {result_elem.get('push')}...")
result_elem.set("push", "0.0")
with projectile_path.open(mode="wb") as projectile_file:
XmlET.ElementTree(projectile_elem).write(projectile_file, encoding="utf-8", xml_declaration=True)
import xml.etree.ElementTree as XmlET
from pathlib import Path
STEAMLIB_DIR = "C:/Program Files (x86)/Steam"
RWR_INSTALL_DIR = Path(STEAMLIB_DIR) / "steamapps/common/RunningWithRifles"
VANILLA_PKG_DIR = RWR_INSTALL_DIR / f"media/packages/vanilla"
VANILLA_PKG_WEAPONS_DIR = VANILLA_PKG_DIR / "weapons"
if __name__ == "__main__":
print(f"Processing projectiles in '{VANILLA_PKG_WEAPONS_DIR}'...")
# find all projectiles in the package weapons dir
projectile_paths = list(VANILLA_PKG_WEAPONS_DIR.glob("*.projectile"))
for i, projectile_path in enumerate(projectile_paths, 1):
with projectile_path.open(mode="r", encoding="utf8") as projectile_file:
try:
projectile_elem = XmlET.fromstring(projectile_file.read())
except XmlET.ParseError as e:
# skip projectile if the xml file is not well-formed
print(f"[{i}/{len(projectile_paths)}] Error parsing '{projectile_path.stem}': {e.msg}")
continue
result_elem = projectile_elem.find("result")
# skip projectile if it doesn't have a result element
if result_elem is None:
print(f"[{i}/{len(projectile_paths)}] Skipping '{projectile_path.stem}': no result element")
continue
# skip projectile if the result class is not "blast"
if (rc := result_elem.get("class")) != "blast":
print(f"[{i}/{len(projectile_paths)}] Skipping '{projectile_path.stem}': result class is '{rc}', not 'blast'")
continue
# skip projectile if the blast push is 0
if result_elem.get("push") == "0.0":
print(f"[{i}/{len(projectile_paths)}] Skipping '{projectile_path.stem}': blast push is zero")
continue
# modify the blast push attribute and overwrite the original file
print(f"[{i}/{len(projectile_paths)}] Fixing '{projectile_path.stem}' with push of {result_elem.get('push')}...")
result_elem.attrib["push"] = str(float(result_elem.attrib["push"]) * 2)
with projectile_path.open(mode="wb") as projectile_file:
XmlET.ElementTree(projectile_elem).write(projectile_file, encoding="utf-8", xml_declaration=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment