A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #
Home » Guides » Scrap Mechanic - How to Tweak Spudguns

Scrap Mechanic - How to Tweak Spudguns

Written by Khaoscraft   /   Jun 10, 2020    


In this guide, I will teach you the following:

  • Tweaking specs of spudgun (fire rate, range, damage).
  • Making/Registering custom textures (not models).
  • Adding your new spudgun as a seperate item (not in guide yet).

Tweak Spudguns Guide



Introduction



Welcome to my guide on tweaking the spudgun!

Here you will learn to modify the spudgun to do all sorts of useful (and wacky) things!

Basic information to get out of the way:

  • Section 4 is currently not available.
  • This guide explains how to change scripts in the game files.
  • This may or may not affect multiplayer. Crashes and/or items not functioning properly is not my responsibility.
  • You can always revert back to the default game files using "verify integrity of game files".
  • It is helpful if you have basic code reading and formatting skills.

I will try to keep this guide as up-to-date as possible as new information is found.

Section 1: Acessing Spudgun Scripts



This section is for editing existing spudguns. If you would like to make your tweaked spudgun a separate item, read section 4 first.

So you want to make your own spudgun?

The very first thing you need to do is go to:

  • C:\Program Files (x86)\Steam\steamapps\common\Scrap Mechanic\Survival\Scripts\game\tools

In that folder, you will find three .lua files: PotatoGatling, PotatoRifle, and PotatoShotgun. You can just open these with notepad.

If you would like to make your spudgun a seperate item, simply make a copy (will be explained in section 4 once it is done).

Great! Now that we know how to access the scripts, lets move on to editing them.

Section 2: Modifying Spudgun Scripts



Ok. Now that we can open the scripts, we can now get to editing them.

You can do a lot of things inside the .lua file, including the following:

  • Changing what textures to use.
  • Changing what animations to use.
  • Changing which modules to use (currently only barrels).
  • Changing what projectile to use.
  • Changing stats such as fire rate, damage, projectile range/velocity and accuracy.

As for actually editing the file, it is pretty straightforward.

Textures and animations are mostly located at the top of the file (except for a few).

Damage can be found on line 5 under the name "local damage".

Stats can be found starting at line 97 with self.normalFireMode and self.aimFireMode

  • fireCooldown= Fire rate.
  • spreadCooldown=I have no idea.
  • spreadIncrement=Accuracy/spread, measured by angle.
  • spreadMinAngle=Minimum spread angle for accuracy.
  • spreadMaxAngle=Maximum spread angle for accuracy.
  • fireVelocity=Speed at which projectile is fired, indirectly affects bullet drop and range.

Projectile can be found on line 574, and the following can be used (remember to lowercase):

  • potato.
  • smallpotato.
  • fries.
  • tomato.
  • carrot.
  • redbeet.
  • broccoli.
  • pineapple.
  • orange.
  • blueberry.
  • banana.
  • tape.
  • explosivetape.
  • water.
  • fertilizer.
  • chemical.
  • pesticide.
  • seed.
  • glowstick.
  • loot (particle effect only).
  • epicloot (particle effect only).

Each projectile automatically takes the appropriate item out of your inventory except tape, explosivetape, pesticide, and loot.

Section 3: Adding Custom Textures



Now that we have our fancy new spudgun, now I will teach you how to apply your own textures to your new spudgun

Making a texture

To create a custom texture, head over to:

  • C:\Program Files (x86)\Steam\steamapps\common\Scrap Mechanic\Data\Character\Char_Tools\Char_spudgun

There you can access the textures of every module of the spudgun. I would recommend recoloring the barrel for starters. If you want to recolor a texture, make sure you are editing the "dif" texture, and not "asg" or "nor".

For more advanced users, you can model your own module, however I cannot teach you how to do that because I have no idea.

If you would like to keep your texture separate from the default textures, we will go over that in section 4 once it is done.

Written by Khaoscraft.