Brutal Nature, The Multiplayer Voxel Sandbox game

How to create a new weapon mod:


Today we are going to create a weapon from scratch.


First we will create a new file in data\shared containing the following:

 

Filename: data\shared\BigGun.ini

// what directory the mod is stored in.
DataLocation=BigGun
DataFilename=BigGun.inf
Enabled=yes

 

Next, We create the directory data\shared\BigGun and create the following files in it:

Filename: data\shared\BigGun\BigGun.inf

Version=1.00
GameVersion=1.00
ModName=BigGun
ModLongName=Big Gun
InstallScript=BigGun.as
webpage=

 

Filename: data\shared\BigGun\BigGun.as

int InstallScript()
{
WeaponData tmpWeapon;

tmpWeapon.mName = "Big Gun";
tmpWeapon.mEditorName = "Big Gun";
tmpWeapon.mProjectileSpeed = 770; // Projectile speed in FPS
tmpWeapon.mFireRate = 0.2; // Time taken between rounds
tmpWeapon.mSpread = 0.003; // Degrees of spread, in radians
tmpWeapon.mAmmoEditorName = "30x90mm"; // Editor name of ammo type this weapon can fire
tmpWeapon.mClipSize = 0; // Clip size of weapon, or 0 for belt fed (Unlimited clip size)
tmpWeapon.mReloadTime = 2.0; // Reload time, Belt fed weapons reload when they change ammo.
tmpWeapon.mRecoil = 0.8; // Recoil amount
tmpWeapon.mEnduranceFired = 5; // Endurance used each time the weapon is fired.
tmpWeapon.mFireSound = "Gunshot"; // The sound played when fired
tmpWeapon.mReloadSound = "Reload"; // the sound played when reloading
tmpWeapon.mFireSound2D = "Gunshot2D"; // the sound the person who fires the gun hears when firing.
tmpWeapon.mReloadSound2D = "Reload2D"; // the sound the person who fires the gun hears when reloading
gWeapons.AddWeapon(tmpWeapon); // Adds weapon to game and resets tmpWeapon object.

// Next we add a recipe so we can craft this weapon
RecipeData recipe;
recipe.mName = "Big Gun"; // Name of recipe
recipe.mCategory = "Weapon>Special"; // Category to place recipe in
recipe.AddInputMaterial("Coal",1); // Input
recipe.AddInputProduct("Steel",30); // Input
recipe.AddOutputWeapon("Big Gun",1); // Output
gMaterials.AddRecipe(recipe); // Adds recipe to game and resets recipe object.

return 0;
}

 

And you are now done your first mod! Its just that simple. Click here to download the files for this tutorial.