In Game: The Punisher
Joined: May 04, 2012
Last Visit: Aug 25, 2017
Medals: 2 (View more...)
|Posted: Sat Sep 26, 2015 2:52 pm
Post subject: SOF2 .WPN file Tutorial
| 1.0 Introduction
To find the sof2.wpn file look in the folder where sof2.exe is installed (the default installation puts it in C:\Program Files\Soldier of Fortune II - Double Helix). Now look in the “base” folder there. You’ll find several .pk3 files, one of which is named “therest.pk3”. You can open this file with any program that handles .zip files. Inside therest.pk3 you’ll see sof2.wpn. If you want to edit this for yourself create a folder called “ext_data” in your base folder and extract sof2.wpn. Using the default installation as an example, this would create C:\Program Files\Soldier of Fortune II - Double Helix\base\ext_data\sof2.wpn.
Now when you run the game it will use this file instead of the one in therest.pk3. BE CAREFUL! If you accidentally introduce any errors into this new .wpn file the weapons won’t work in the game. If this happens you can always delete C:\Program Files\Soldier of Fortune II - Double Helix\base\ext_data\sof2.wpn and the game will go back to using the original in therest.pk3.
Here’s a weapon from SoF2 – the M4 rifle. This is the entire definition for the behavior of the weapon, copied straight out of the SOF2.wpn file. The animations, firing sounds, and any optional surfaces like silencers are defined in the SOF2.inview file (see SoF2_Weapons_InviewFile for details)
category 5 // assault rifle
// new school
kickAngles "1 4 -2 1"
mp_kickAngles "1 3 -2 1"
ammoType "40mm HE grenade"
kickAngles "1 6 -2 1"
mp_ammoType "40mm grenade"
The basic format of this file is the same as almost all of the external text data for SOF2 – a key followed by its corresponding value (e.g. name “M4”). Key names are case sensitive (use “name” not “Name”). The following is a breakdown of the keys and what they mean. Each key will be followed in italized parentheses by the name of the block or blocks in which you’ll find the key.
2.1 Singleplayer Keys
• 3rdPersonMuzzleFlash (attack, altattack) – this optional effect is used instead of muzzleFlash when this weapon is fired by an NPC
• action (altattack) – an action is a special, non-firing event that occurs when a weapon’s altfire is used. There can be only one per weapon. Here are the legal values:
o toggleZoom – used by the MSG90A1 sniper rifle
o toggleBinocs – used by the binoculars
o toggleThermal – used by the thermal goggles
o toggleNight – used by the nightvision goggles
• ammoType (attack, altattack) – this is the type of ammunition used by the weapon’s attack
• armorPiercing (attack, altattack) – a number from 0 to 1 (default is 0) indicating what percentage of the damage ignores armor.
• cameraOffset (weapon) – this is used by emplaced weapons to indicate where the camera should be in relation to the gun when the player “uses” the emplaced gun. In the case of the RPD, the offset is "21.39 -8.98 4" which puts the camera 21.39 units behind, -8.98 units to the right, and 4 units above the origin of the gun.
• canFireWhileProne (attack, altattack) – legal values are “true” and “false”. a half-way implemented feature in SOF2 is the ability to fire a weapon while prone. You can see this in the game when you type “set g_pronefire 1” at the console and try to fire the M4 while prone. Nothing much to say since I never got around to finishing it.
• category (weapon) – weapons appear in the weapon selection hud grouped by their categories. Here’s a list of the categories available to the player:
o 1 -- knife
o 2 – pistol (e.g. M1911A1, US SOCOM)
o 3 – shotgun (e.g. M590, USAS12)
o 4 – submachine gun (e.g. micro uzi, M3A1)
o 5 – assault rifle (e.g. M4, AK-74, OICW)
o 6 – sniper rifle (e.g. MSG90A1)
o 7 – heavy weapons (e.g. M60, MM1, RPG7)
o 8 – grenades (e.g. M67, ANM-14)
o 9 – equipment (e.g. binoculars, nightvision goggles)
o 10 – bodies (probably won’t need to add anything here)
o 11 – emplaced weapons (e.g. emplaced M60, RPD)
• clipSize (attack, altattack) – how many pieces of ammo fit in the clip for this attack
• cvar (weapon) – short for “console variable”, this indicates where the game will store information about this weapon when the player saves or loads a game. It is also used by the outfitting menu at the beginning of a mission.
• damage (attack, altattack) – how much damage this attack does when it hits
• damageType (attack, altattack) – what type of damage is done by this attack. The default value is regular old damage, but the other legal values that have slightly different effects in the game are “flash”, “incendiary”, and “phosphorous”.
• detonation (projectile) – describes when the projectile will explode. “impact” means the projectile will explode when it hits anything, including water. “timer” means it will explode a certain number of seconds after it’s fired. “sticky” means it’ll stick where it lands, ignoring water (the thrown knife uses this type). The default value is “impact”.
• displayName (weapon) – this is the ID of a StripEd token which is the actual name of the weapon that shows up in the game.
• effect (projectile) – this filename is the effect that is played on the projectile as it travels. This effect is optional. This filename is assumed to start in the game’s base folder and it should contain forward slashes, not backslashes.
• EjectBone (attack, altattack) – this is the name of a bone found in the weapon’s buffer model and indicates where the shell ejection effect will be played.
• explosionEffect (projectile) – this optional effect is played when the projectile detonates anywhere except in water.
• gravity (projectile) – a value from 0 to 1 indicating how much gravity will effect a projectile. Things that ignore gravity, like rockets, use 0 while grenades generally use 0.5.
• hud (altattack) – name of a .hud file in the base/huds folder. This hud is displayed when the weapon is zoomed in and contains information describing where to place information such as wind indicator and ammo count.
• hudIcon (altattack) – filename of a graphic that is drawn to represent each bullet in the rifle’s clip. This is displayed when the weapon is zoomed in so it only applies to weapons like sniper rifles. This filename is assumed to start in the gfx\menus folder in the game’s base folder and it should contain forward slashes, not backslashes.
• inaccuracy (attack, altattack) – a number from 0 to 1 indicating how much inaccuracy is added to each subsequent shot when the weapon is fired. Valid numbers are pretty small (e.g. .05 for the M4)
• kickAngles (attack, altattack) – these four numbers represent the minimum up-and-down kick, maximum up-and-down kick, minimum left-to-right kick, and maximum left-to-right kick applied to the camera when the weapon is fired. Actually, the code only uses the maximum value right now so the first and third values really don’t mean anything at the moment.
• lockFlashToBarrel (attack, altattack) – should the muzzleflash effect be attached to the muzzle for the duration of the effect or should it just appear at the end of the barrel when the weapon is fired. Makes a big difference for flashes that last more than a tenth of a second. The legal values for this key are “true” and “false”, defaulting to “true”.
• loopsound (projectile) – this optional sound is looped and played on the projectile as it travels.
• maxInaccuracy (attack, altattack) – this number is the cap for the inaccuracy added to subsequent bullets. Should be 0 to 1.
• melee (attack, altattack) – the legal values here are “knife”, “bayonet”, and “blunt”. The first two aren’t terribly different, they just create different sounds and produce different impact effects when attacking. The “blunt” value indicates something like a pistolwhip or a riflebutt – an attack that breaks glass or knocks out unsuspecting enemies.
• menuImage (weapon) – this is the filename of the piece of art that represents a given weapon in the weapon selection hud. This filename is assumed to start in the gfx\menus folder in the game’s base folder and it should contain forward slashes, not backslashes.
• menuImageDual (weapon) – very similar to menuImage only it’s used in the weapon selection hud to indicate you can wield two instances of a type of weapon simultaneously.
• model (projectile) – this filename is the model that will represent the projectile. It’s optional…hand grenades have models but M203 grenades (the M4 altfire) don’t.
• model (weapon) – this is the model used in the world, not the inview model used by the player. This model is bolted to NPCs and is also used to represent weapon pickups. This filename is assumed to start in the game’s base folder and it should contain forward slashes, not backslashes.
• muzzleFlash (attack, altattack) – this filename is the effect that is played at the end of the inview model’s muzzle when the player fires the weapon. This effect is optional. This filename is assumed to start in the game’s base folder and it should contain forward slashes, not backslashes.
• muzzleSmoke (attack, altattack) – this effect is played at the same time and in the same location as the muzzleFlash. By definition these effects are never locked to the barrel. MuzzleSmoke is totally optional.
• name (weapon) – this name is used to uniquely identify the weapon. It’s used in the level editor to specify a type of pickup.
• oneHanded (weapon) – the legal values here are “true” and “false” with “false” being the default value. If a weapon is one-handed you can wield two of them at once. When the user wields dual weapons they are both forced into “auto” firemode so make sure that mode is listed in the weapon’s definition (see the “fireModes” block in the “blocks” section).
• pellets (attack, altattack) – number of pellets fired per shot. Shotguns use this. There are some minor rules in the code pertaining to how many pellets can hit at once, where they hit, etc. just to make the process more efficient.
• radius (attack, altattack) – how far from the point of impact the attack does damage. Used for grenades and similar explosives.
• range (attack, altattack) – range of the weapon in world units. Past this range targets will take no damage from the weapon.
• rank (weapon) – this is a number between 0 and 1 that indicates if a weapon is preferred to another weapon. Generally, weaker weapons (like the knife) will be at the bottom of this scale and the mightier weapons (like the RPG7) will be at the top. This is used when the user employs “best” or “best safe” weapon switching.
• safe (weapon) – the legal values here are “true” and “false”. If a weapon is safe it will be available when the user employs “safe” or “best safe” weapon-switching. If you don’t have this key in your weapon definition the default value of “true” will be used.
• ShellCasingEject (attack, altattack) – this effect is played when the weapon fires. It represents a spent shell casing flying out of the weapon’s breach. This is optional and will only play at the location specified by the EjectBone (see below).
• speed (projectile) – any number greater than 0. This value indicates how many units per second the projectile will move when it’s fired.
• spread (attack, altattack) – how far apart shotgun pellets (see the “pellets” key) will spread when fired. A spread of 1.0 is a 90-degree cone (45 degrees to either side of wpn) and a standard value would be about 0.05.
• timer (projectile) – used in conjunction with the “timer” value in the “detonation” key, this is the number of seconds before the projectile explodes.
• TracerEffect (attack, altattack) – this optional effect is played at the same time and position as the muzzle flash to indicate a tracer round being fired.
• underwaterEffect (projectile) – this optional effect is played at the point of impact when the projectile detonates in water.
• volume (attack, altattack) – how loud this attack is. Used by enemy AI to determine if it hears the player.
• waterExplosionEffect (projectile) – this optional effect is played on the surface when the projectile detonates in water.
2.2 Multiplayer Keys
Most of the single player keys also work in multiplayer and can be overridden in multiplayer by making a copy of the key and prefacing it with “mp_”. For example if you wanted to put a multiplayer specific speed for a weapon you would make a mp_speed key.
• mp_muzzleFlashBone – bone the muzzle flash is attached to
• mp_animRaise – 3rd person torso animation to play when the weapon is being taken out
• mp_animDrop – 3rd person torso animation to play when the weapon is being put away
• mp_animIdle – 3rd person torso animation to play when the weapon is in an idle position
• mp_animIdleZoomed – 3rd person torso animation to play when the weapon is an idle position when zoomed
• mp_animFire – 3rd person torso animation to play when weapon is fired
• mp_animFireZoomed – 3rd person torso animation to play when weapon is fired when zoomed
• mp_animReload – 3rd person torso animation to play when weapon is reloading
• mp_animReloadStart – 3rd person torso animation played at the start of a repeating reload sequence
• mp_animReloadEnd – 3rd person torso animation played at the end of a repeating reload sequence
• mp_gore – when set to ‘no’ will disable dismemberment for an attack, default is ‘yes’
• mp_extraClips – number of clips (magazines) to give a player. This is used to set the initial ammo when using the outfitting system.
• mp_fireAmount – amount of ammo used when the weapon is fired
• mp_fireDelay – amount of time in milliseconds to wait after a shot is fired before you can fire again (this is added to the time it takes the animation to play).
• mp_bounce – how much a projectile will bounce when it hits a solid surface
Keys are occasionally grouped together within a “block”. Blocks will have a name (e.g. “weapon”) and contain any number of key/value pairs within a set of matching braces. Like keys, block names are case sensitive (use “weapon” not “Weapon”). The following is a list of the block names found within weapon definitions.
• altattack – same as “attack” only this defines the altfire for the weapon
• attack – this is the information relating to a weapon’s main attack and contains things like the attack’s ammo type, clip size, and muzzleflash effects. These are all explained in the “keys” section.
• fireModes – a list of the firing modes available for the attack. The only options supported in the game are single, burst, and auto. You can have any combination of these in the fireModes block. The keys in this block don’t really matter…you can call them mode1, mode2, mode3, or red, yellow, blue. All that matters are the values, each of which must be either “single”, “burst”, or “auto”.
• optionalAnims – the USAS12 uses a different firing animation when it’s fired in auto versus single firemode. That’s determined by the key “auto” and the value “fire2”, indicating that the animation named fire2 (found in the sof2.inview file) will be used instead of the standard anim when the weapon is in auto firemode.
• projectile – something like the M203 grenade launcher (the M4’s altfire) launches grenades, not bullets. The definition of the grenade’s behavior is found in the altfire’s “projectile” block. All of the keys used in the projectile block are explained in the “keys” section.
• scopeAbilities – this is a list of the abilities of the weapon that are available to the user when zoomed in. They’re only used by the OICW in singleplayer but you can add any or all of them to a weapon with the “toggleZoom” value for the “action” key in the “altattack” block. The location and appearance of information on the screen is dependent not only on the inclusion of certain scope abilities but also on the type of hud used for the weapon (see the “hud” key). Each key should be followed by the filename of a sound to be played when that ability is used. A null sound (“sound/misc/nullsound.wav”) can be used if you don’t want a sound to be played for a particular ability.
o threatBracket – draws red brackets around the ten nearest, visible, armed NPCs within 1800 units of the player.
o rangeFinder – displays the range of current grenade fuse
o incFuseRange – this is a selectable menu entry on the screen that allows the user to increment the current grenade fuse range by 0.5meters
o decFuseRange – this is a selectable menu entry on the screen that allows the user to decrement the current grenade fuse range by 0.5meters
o toggleAltFire – this is a selectable menu entry on the screen that allows the user to toggle between the use of mainfire and altfire when the fire button is pressed and the weapon is zoomed in. It allows the OICW to fire bullets or launch grenades while zoomed in.
o windSensor – displays the current windspeed and direction
o reticleCorrect – this is a selectable menu entry on the screen that allows the user to “lase” whatever is under the crosshairs. Lasing determines the range to the target and calculates the necessary fuse timer for grenades. It also displays a red dot above the crosshairs indicating how much elevation is required for the grenade to land where the laser hit.
o nightVision – this is a selectable menu entry on the screen that allows the user to toggle on/off the use of nightvision in the weapon’s scope.
• weapon – designates the beginning of a weapon definition
• zoomFactors – this lists the magnification steps for rifles with scopes (e.g. MSG90A1 sniper rifle) and binoculars.
o For discrete steps like those in a sniper rifle you’d use a list of key/value pairs like “5x 20” (where “5x” is the label you’ll see in the sniper scope and “20” is the fov setting that the game will use when that zoom factor is selected). You can have however many zoom factors you’d like in this block when defining a sniper rifle’s behavior.
o For a continuous zoom like you’d find in a set of binoculars you’d use a list containing two key/value pairs, the minimum zoom and the maximum zoom. Here the keys need to be “min” and “max” and the values will be fov values like they are for a sniper rifle.
Website: House of Pain Server - Website
Serverlist: House of Pain Server - Serverlist
In Game: The Punisher
Joined: May 04, 2012
Last Visit: Aug 25, 2017
Medals: 2 (View more...)
|You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum