Make a gun - wizzomafizzo/starcheat GitHub Wiki
(credit to Lolazaurus on reddit) This has been modified by plmanith17 be a lot more in-depth; it would be great if others could contribute from your findings whilst creating your own guns c:
A lot of modding for guns is simply changing numbers. You can see them when you double click on any gun. If you want to make a new gun, spawn in any generated gun like "avianblaster" or "commonassaultrifle" the same way you would spawn in the cape or any other item on StarCheat. Remember, make sure it's generatedgun and not a static one. Some important values you can change are:
-
classMultiplier: How much energy your gun takes to shoot. 0 = no energy
-
fireTime: How fast your gun shoots
-
fireOnRelease: true/false; Whether or not your gun will be automatic by holding down your mouse button or if it requires you to release it to fire. Default is false, as it is generally only used for charge-based guns, such as the buster.
-
firePosition: Where your gun spawns its muzzle flash and projectiles
-
drawables: How your gun looks. You can use any image file in the game! The position of the image is determined by x and y coordinates. Feel free to open up other guns and see how they're drawn. (Note: It is possible to modify certain colors of the sprites by adding ?replace;=; after the .png file. Use http://html-color-codes.info/colors-from-image/ to get the hex code for certain colors to replace, and then use http://www.colorpicker.com/ to choose and find the hex code of colors you want. An Example would be like this:/items/guns/randomgenerated/standard/rocketlauncher/butt/14.png?replace;E35F5D=AEA7FF;B22042=5144E2;871132=1306A4", The first hex color code is the original color of the sprite that you want to replace, and the second is the color you actually do want.
-
fireSound: Self-explanatory (If ya still don't get it, it's the sound ya gun makes when you shoot)
-
handPosition: How your character holds the gun and where their hand goes on it using x and y coordinates.
-
inventoryIcon: Basically the same thing as drawables, only it's what the icon in your inventory looks like.
-
muzzleEffect: The little poof your gun gives off when it fires. You can use any .animation file in the assets. Here is also where what sound your gun makes is. You can use any .wav or .ogg sound effect file in your assets.
-
projectileType: Your gun can shoot just about anything! Anything that has a .projectile file can be shot out of your gun. Look in your asset files for some cool stuff. Warning: there's a lot of evil stuff you can shoot out of your gun. Please respect servers and other players.
-
shortDescription: Your gun's name. (Note: Colors of letters can be modified for anything that has text. this is done by adding ^color; before whatever you want to type. Ex. ^red;Uber Sniper would print Uber Sniper in full red or maybe ^red;X^green;M^red;A^green;S, which would print XMAS with alternating red and green. So far, colors that work that I know of are white,red,orange,yellow,green,blue,purple,violet,gray, and black.)
-
weaponType: Doesn't exactly have to "be" the actual weapon type. This is the description under the actual gun's name. You can have a sniper and type in something like "potato" and it'll work; there's really no static values
-
projectileCount: How many projectiles your gun fires at once. Don't go too crazy or your computer will hate you.
-
inaccuracy: Pretty literal. 0 = 100% accurate shots.
-
projectileSeparation: Determines the base spread between multiple bullets. When accuracy is at 100%, the spread pattern will ALWAYS be the same.
-
twoHanded: True or False, pretty self-explanatory. Want to shoot two rapid-firing shotguns at once? Well now you can!
-
rarity: Again, pretty self-explanatory; this modifies the border of the item. white = common, green = uncommon, blue = rare, purple = legendary.
-
toolTipKind: Not necessarily just for guns, but basically this affects what stats pop up when you hover over the item. The base for all guns is of course, "gun", but the reason why I put this is because you can remove toolTipKind to replace with description, which replaces the shown stats with whatever description you want it to have (the two can't be used simultaneously)
-
recoilTime: Completely aesthetic, this affects how long it takes for your gun to revert back to it's orginal position after firing.
-
walkWhileFiring: Basically if whether or not you walk whilst you hold down the mouse button.
-
projectile: Here is where all your projectile properties go. I moved this to the bottom because it's probably the longest part. Under this, there will be stats such as "level" and "power". (Normally I wouldn't touch the "level" stat and leave it at 1) "power" will affect, of course, the actual gun's damage. Other values such as "timeToLive" (how long the projectile lasts) and "speed" (projectile speed) can also be added to overwrite the base projectile stats. Now, there is a LOT more than meets the eye when dealing with projectiles in weapons. It is actually possible to modify the damage type of a projectile. For example, I modded a sniper to fire piercing bullets, but green acid damage will popup. This is possible by adding "damageKind", with possible types being slash, default, acid, electricplasma, fireplasma, iceplasma, poisonplasma, and capture (Note: some may be duplicates, but have different names, such as poisonplasma/acid and slash/default). Another thing to add is "statusEffects" []. This is pretty self-explanatory. Notable status effects are burning, paralysis, frozenburning, weakPoison, melting, freeze, shortdamagefreeze, frostslow, sandstorm, stunned, slimeslow, mudslow, vulnerability, and tarslow. Now for the good stuff. You can add "actionOnReap". This makes the projectile spawn something when it breaks. This is commonly used in rockets, to spawn the explosion particle (Note: I suggest using notepad++ to find specific properties for projectiles). However, multiple things can be added to an explosion. For example, the pill grenade projectile will explode into flames. You can modify the pill to instead explode into a firework of more pills which explode into flames (Unfortunately, I haven't found a way to modify secondary projectiles while keeping the game vanilla). I won't go too in-depth about what is possible with these, since it would be easier to find out how it works for yourself. (I mostly copy-paste things, and replace projectiles, etc.) Use notepad++ to open up the actual .projectile files and search for the "actionOnReap" stat on any projectiles with interesting effects. (Notable projectiles to look at and understand would be pill, acidgrenade, supergiant, chargedlightarrow, and many more I probably haven't looked at.)
To create a charge based weapon
Add these values:
- drawPowerCurve: "busterTimeMultiplier", (I currently don't know the true function, but it is necessary)
- fireOnRelease: true, (Must be on or you won't be able to charge your gun)
- powerProjectileType: this is basically the same as projectileType, but this is projectile when you charge your gun. It is important to note that this will inherit any modifications made in projectile.
- powerProjectileTime: [0.7,50] (I believe the first number is the charge time, but I don't know what the second number is, so I'd just leave it)
There is also another way to create a charge based weapon, but rather than having two projectiles, one uncharged and one charge, it is possible to create a "charge THEN shoot" type of weapon. This is possible by utilizing the code from staves.
Here are values you need to add:
- fireOnRelease: true
- level1ChargeTime: indicates the first portion of the charge
- level2ChargeTime: Includes the first charge time. This is basically the FULL charge time required and is generally double level 1's time as level1ChargeTime would be used signify the halfway mark.
Example gun which uses most of the added content: Thor, HGB
Now if you create errors by using incorrect formatting or spelling file names wrong you will either crash the game or cause your item to turn into a useless "Perfectly Generic Item" so make sure you spell things right and look at other guns to see how their formatting works.