|ONWC : Oni Weapon Class|
- The xml code on this page is compatible with onisplit v0.9.61.0
- vanilla ONWC files are stored at/inside
- Edition/install/VanillaDats/level0_Final/level0_Final (AE v6)
- AE/AEInstaller/vanilla/level0_Final.dat (AE v7)
ONWC | +-- M3GM (embedded 3D mesh) | +-- PNTA <Points> +-- VCRA <VertexNormals> +-- VCRA <FaceNormals> +-- TXCA <TextureCoordinates> +-- IDXA <TriangleStrips> +-- IDXA <FaceNormalIndices> +-- TXMP <Texture> (link to external file)
ONWC: Oni Weapon Class
|<Geometry>||link||Weapon instance number (#N). For geometry import/exchange see HERE.|
|<Name>||char||ONWCfile.oni (don't use file prefix/suffix)|
|<MouseSensitivity>||float||weapon mouse sensitivity (applies on AI, too)|
|<RecoilAnimationType>||link||an recoil animation type|
|<ReloadAnimationType>||link||an reload animation type|
|<PauseAfterReload>||int16||pause after reload in 1/60 seconds|
|<MaxShots>||int16||amount of shots
Let's say a weapon has 4 emitters each with <UsedAmmo>1 and the weapon shall be able to fire 3 times. Then <MaxShots> has to be 12 = 4 * 1 * 3.
A mismatching <MaxShots> number creates an infinite ammunition bug.
|<ParticleCount>||int16||amount of particles|
|<FiringModeCount>||int16||amount of used firing modes (max = 2 ?)|
|<PauseBeforeReload>||int16||pause before reload in 1/60 seconds|
|<ReleaseDelay>||int16||release delay; delay between the moment the trigger is released and the moment the weapon stops firing|
|<FiringModes>||holds 2 <FiringModes> tags|
|<Particles>||holds 16 <ONWCParticle> tags|
|<EmptyWeaponSound>||link||OSBDfile.imp.oni (don't use file prefix/suffix)|
|<Glow>||link||TXMPfile.oni (don't use file suffix)|
|<GlowAmmo>||link||TXMPfile.oni (don't use file suffix)|
|<GlowTextureScale>||float||x z scale factor of glow textures|
|<PickupHandleOffset>||float||x y z offset of pickup handle|
|<HoveringHeight>||float||hovering height of unheld weapon|
- Glow textures
- They're applied to the lower face of the M3GM's bounding box. The factors above are the ratio between the x/z extent of that face and the half-length/width of the glow textures. So if both factors are 0.5, the glow textures fit the bounding box exactly.
- Pickup handle
- The tolerance is hardcoded. The offsets are not relative to the weapon's axes, but to the world axes (!).
- This is a rather nasty "feature" (actually, the offsets should be relative to the weapon's orientation)
- The way it's now, the pickup volume of a WMC is not necessarily next to the handle. That's why it's hard to pick up.
- Default crosshair appears where the laser sight hits environment, corpses, etc
- Locked crosshair appears when the laser sight hits characters (including the shooter)
- "Tunnel" is used by w8_mbo as a complement to the crosshair
- w2_sap, w5_sbg, w7_scc and w9_scr use it with no crosshair
|<Origin>||float||x y z|
|<Stiffness>||float||x-component of laser sight direction ?|
|<LaserMaxLength>||float||maximal length of laser sight vector|
|<LaserColor>||color||laser sight color: B G R A|
|<NormalTexture>||link||crosshair texture: TXMPfile.oni (don't use file suffix)|
|<NormalColor>||color||crosshair background color: B G R A|
|<NormalScale>||float||crosshair scale factor|
|<LockedTexture>||link||locked crosshair texture: TXMPfile.oni (don't use file suffix)|
|<LockedColor>||color||locked crosshair background color: B G R A|
|<LockedScale>||float||locked crosshair scale factor|
|<TunnelColor>||color||tunnel background color: R G B A|
|<TunnelScale>||float||tunnel scale factor|
|<TunnelCount>||int32||number of tunnel textures|
|<TunnelSpacing>||float||spacing of tunnel textures|
|<Icon>||link||TXMPfile.oni (don't use file suffix)|
|<Empty>||link||TXMPfile.oni (don't use file suffix)|
|<Fill>||link||TXMPfile.oni (don't use file suffix)|
|<Base>||float||recoil base (e.g. for w1_tap and w2_sap)|
|<ReturnSpeed>||float||recoil return speed|
|<FiringReturnSpeed>||float||recoil firing return speed|
w11_ba1 is the only original weapon that use also the second firing mode.
- Transform matrix
- Probably defines the orientation, scaling and position of the firing spread. It doesn't appear to be used.
|<InverseDirection>||matrix4x3||targeting inverse transform matrix - the inverse of the matrix that gives the targeting direction|
|<Direction>||vector3||targeting direction; sets orientation of firingspread|
|<Origin>||vector3||targeting origin; sets deviation of A.I.'s aim from target's origin (target's origin + this vector = direction where to aim and fire)|
|<PredictionSpeed>||float||prediction speed; numeric speed of the projectile A.I. prediction takes into account when calculating where to fire in order to hit moving target|
|<MaxInaccuracyAngle>||float||max. inaccurancy angle; sets max angle between weapon's aiming vector and target's position; when AI exceeds this angle (by recoil or target running away), AI stops shooting and aims weapon again straight to the target, then resume shooting|
|<AimRadius>||float||aim_radius; always the same; possible related to the inaccuracy angle above|
|<AISoundRadius>||float||weapon sound sphere radius; defines radius of the A.I. sound sphere (gunfire type, see HERE about A.I. sound spheres) which is created for a short moment when this weapon is fired|
|<MinShootingDistance>||float||minimal shooting distance; if target is closer than min.shoot.dist then A.I. ceases fire and moves away from the target till at least min.shoot.dis. is achieved; diameter, not a radius, so effective distance from A.I. to target is half of this value|
|<MaxShootingDistance>||float||maximal shooting distance; if target is further than max.shoot.dist then A.I. ceases fire and moves towards the target until at least max.shoot.dis. is achieved|
|<MaxStartleMisses>||float||maximum startle misses; probably the maximum number of shots an AI can miss when surprised before he starts aiming|
|<SkillIndex>||int16||ONCC skill index|
|<FightTimer>||int32||fight timer, 240 for w4_psm, 200 for v6_vdg|
|<ProjectileSpeed>||float||ballistic projectile speed (150 for SBG, 160 for WMC)|
|<ProjectileGravity>||float||ballistic projectile gravity, can be negative for firing at the enemy's feet (0.5 for SBG, 0.3 for WMC)|
|<FireSpreadLength>||float||length of a firingspread; A.I. can utilize gunfire dodge mechanics when it collides with some firingspread (read HERE); can be seen by *ai2_showfiringspreads=1* (180 for w1_tap, 150 for w2_sap, 120 for w4_psm)|
|<FireSpreadWidth>||float||length of the firingspread's base; can be seen by ai2_showfiringspreads=1|
|<FireSpreadSkew>||float||firingspread's skew; can be seen by ai2_showfiringspreads=1 (0.1 for w1_tap, 0.21 for w2_sap)|
- Fire spread
Note that the dodging fire spread set here is entirely separate from the weapon's actual fire spread, that is, the conical bullet fire that a weapon like the autopistol produces (see note at end of the PAR3 Emitters section). The dodging fire spread is separate in order to allow fine-tuning of the area from which the AI will attempt to escape, rather than simply relying on the calculated cone of weapons fire that is actually produced.
- Transformation matrix
- That's what defines orientation, stretching, etc.
- See CRSA for details.
|<Transform>||matrix4x3||transformation matrix xx xy xz yx yy yz zx zy zz + x y z offset of particle to weapon|
|<ParticleClass>||link||BINA3RAPfile.oni (don't use file prefix/suffix)|
|<UsedAmmo>||int16||ammo decrement (different for the 2 firing modes of w11_ba1)|
|<ShotDelay>||int16||normal delay between shots in frames|
|<RoughJusticeShotDelay>||int16||'roughjustice' delay between shots in frames|
|<ActiveFrames>||int16||number in frames for active firing mode (1st frame for activate); Used for w4_psm and w11_ba1|
|<DelayBeforeFiring>||int16||delay before firing|
When adding particles in <ONWCParticle> section then the last three values of <Transform> are the particle start location.
Inside the 3D editor any object can serve as a helpful reference: pick one point of it and move it to the location from where the particle should be spawned. Copy the value into the xml file. (Caution: Mod Tool uses a comma as decimal mark, onisplit's xml files use a point.)
- onisplit -extract:obj output_folder input_folder\ONWCfile.oni
- version hint:
- onisplit v0.9.86.0 and v0.9.94.0 can not extract obj or dae (using this method)
- onisplit v0.9.61.0 can extract M3GM only as obj
- onisplit v0.9.41.0 can extract M3GM as obj or dae
In your 3D editor the weapon must be positioned on XZ plane and pointing into +X (weapon rotation 0, 0, 0).
The center is located in 0, 0, 0 while the weapon grasp ends at approximate position: X=0,3 Y=# Z=-0,5 and X=0,8 Y=# Z=-0,5
Now you can create a M3GM file from the geometry.
To import or exchange weapon geometry simply insert the M3GM's file name into ONWC's <Geometry> tag. For example:
Don't use file suffix .oni
File prefix M3GM can be absent from the name, it's optional here.
M3GM files can be created with Vago.
When you convert the ONWC from xml back to oni be sure that the M3GM file is in the same folder.
There are some tags which make together the mesh but you basically need to know that you can replace that content with data from another M3GM.
You can create M3GM meshes from obj files.
- onisplit -create:m3gm output_folder -tex:weapon_tex input_folder/weapon.obj
- -tex is optional
- The TXMP file must created separately (if needed).
Then you can convert the file to xml and replace the ONWC's old M3GM xml code (in case you didn't start from scratch).
Remember to change the links (#N) and instance IDs of the new data.