XML:ONWC: Difference between revisions

From OniGalore
Jump to navigation Jump to search
mNo edit summary
m (link fix)
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{XML_File_Header | type=ONWC | prev=ONVL | next=OPge | name=Oni Weapon Class }}
__TOC__
__TOC__
{{Template:XMLModdingHints}}
{| border=0 cellspacing=20 cellpadding=0 align=center
| The xml code on this page is compatible with onisplit '''v0.9.61.0'''
|}


'''general information'''
'''general information'''
* ONWC files are stored at Edition\install\VanillaDats\level0_Final\level0_Final (AE 2010-05a)
* 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)'''




Line 15: Line 14:
  ONWC
  ONWC
   |  
   |  
   +-- M3GM (the 3D mesh)
   +-- M3GM (embedded 3D mesh)
         |
         |
         +-- PNTA <Points>
         +-- PNTA <Points>
Line 26: Line 25:




 
==ONWC: Oni Weapon Class==
=ONWC: Oni Weapon Class=


{|class="wikitable" width=100%
{|class="wikitable" width=100%
Line 44: Line 42:
| <Geometry>
| <Geometry>
| link
| link
| [[#M3GM|weapon instance]] number (#N)
| [[#M3GM|Weapon instance]] number (#N). For geometry import/exchange see [[#new_method|HERE]].
|-
|-
| <Name>
| <Name>
Line 60: Line 58:
| <RecoilAnimationType>
| <RecoilAnimationType>
| link
| link
| an recoil [[OBD_talk:StNA#animation_types|animation type]]
| an recoil [[XML:StNA#animation_types|animation type]]
|-
|-
| <ReloadAnimationType>
| <ReloadAnimationType>
| link
| link
| an reload [[OBD_talk:StNA#animation_types|animation type]]
| an reload [[XML:StNA#animation_types|animation type]]
|-
|-
| <PauseAfterReload>
| <PauseAfterReload>
Line 70: Line 68:
| pause after reload in 1/60 seconds
| pause after reload in 1/60 seconds
|-
|-
| <MaxShots>
|valign=top| <MaxShots>
| int16
|valign=top| int16
| amount of shots
| 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>
| <ParticleCount>
Line 97: Line 99:
: TwoHanded
: TwoHanded
: RecoilAffectsAiming
: RecoilAffectsAiming
:: Without this flag there will be still recoil. In any case the recoil makes the aim go upwards.
:: If flag is set: the aiming will stay the same after firing the gun.
:: If flag isn't set: the upward movement stops earlier and when the fire ended the arm will fall to the previous aiming position. ([http://youtu.be/eq91flq6YkU w1_tap observation])
: Automatic
: Automatic
: StunSwitcher
: StunSwitcher
:: if enemy is inside shooting distance (between min and max) and is knockdowned/stuned or blownupped, AI with this weapon switches to melee for a time specified in a *fight timer* field
:: if enemy is inside shooting distance (between min and max) and is knockdowned/stunned or blownupped, AI with this weapon switches to melee for a time specified in a *fight timer* field
: KnockdownSwitcher
: KnockdownSwitcher
:: if enemy is inside shooting distance (between min and max) and is knockdowned or blownupped, AI with this weapon switches to melee for a time specified in a *fight timer* field
:: if enemy is inside shooting distance (between min and max) and is knockdowned or blownupped, AI with this weapon switches to melee for a time specified in a *fight timer* field
Line 163: Line 168:




==<LaserSight>==
===<LaserSight>===
; Crosshair
; Crosshair
: Default crosshair appears where the laser sight hits environment, corpses, etc
: Default crosshair appears where the laser sight hits environment, corpses, etc
Line 245: Line 250:




==<AmmoMeter>==
===<AmmoMeter>===
{|class="wikitable" width=100%
{|class="wikitable" width=100%
|width=120px| '''XML tag'''
|width=120px| '''XML tag'''
Line 265: Line 270:




==<Recoil>==
===<Recoil>===
{|class="wikitable" width=100%
{|class="wikitable" width=100%
|width=120px| '''XML tag'''
|width=120px| '''XML tag'''
Line 293: Line 298:




 
===<AIFiringMode>===
 
==<AIFiringMode>==
w11_ba1 is the only original weapon that use also the second firing mode.
w11_ba1 is the only original weapon that use also the second firing mode.


Line 336: Line 339:
| <AISoundRadius>
| <AISoundRadius>
| float
| float
| weapon sound sphere radius; defines radius of the A.I. sound sphere (gunfire type, see [[Tricks_behind_Oni_A.I.#Congitive_possiblities_of_A.I._characters_..._.22COME_TO_YOUR_SENSES.21.22|HERE]] about A.I. sound spheres) which is created for a short moment when this weapon is fired
| weapon sound sphere radius; defines radius of the A.I. sound sphere (gunfire type, see [[AI#Vision and hearing|HERE]] about A.I. sound spheres) which is created for a short moment when this weapon is fired
|-
|-
| <MinShootingDistance>
| <MinShootingDistance>
Line 348: Line 351:
| <MaxStartleMisses>
| <MaxStartleMisses>
| float
| float
| maximum startle misses; probably the maximum number of shots an ai can miss when suprised before he starts aiming
| maximum startle misses; probably the maximum number of shots an AI can miss when surprised before he starts aiming
|-
|-
| <SkillIndex>
| <SkillIndex>
| int16
| int16
| [[OBD_talk:ONCC#.3CWeaponSkills.3E|ONCC skill index]]
| [[XML:ONCC#.3CWeaponSkills.3E|ONCC skill index]]
|-
|-
| <FightTimer>
| <FightTimer>
Line 368: Line 371:
| <FireSpreadLength>
| <FireSpreadLength>
| float
| float
| length of a firingspread; A.I. can utilize gunfire dodge mechanics when it collides with some firingspread (read [[Tricks_behind_Oni_A.I.#Combat_behavior_part_3:_.22They_see_me_shootin.27.2C_they_hatin.27....22|HERE]]); can be seen by *ai2_showfiringspreads=1* (180 for w1_tap, 150 for w2_sap, 120 for w4_psm)
| length of a firingspread; A.I. can utilize gunfire dodge mechanics when it collides with some firingspread (read [[AI#Basic combat behaviors|HERE]]); can be seen by *ai2_showfiringspreads=1* (180 for w1_tap, 150 for w2_sap, 120 for w4_psm)
|-
|-
| <FireSpreadWidth>
| <FireSpreadWidth>
Line 378: Line 381:
| firingspread's skew; can be seen by ai2_showfiringspreads=1 (0.1 for w1_tap, 0.21 for w2_sap)
| 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 <u>actual</u> fire spread, that is, the conical bullet fire that a weapon like the autopistol produces (see note at end of the [[OBD:BINA/PAR3#Emitters|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.




==<ONWCParticle>==
===<ONWCParticle>===
; Transformation matrix
; Transformation matrix
: That's what defines orientation, stretching, etc.
: That's what defines orientation, stretching, etc.
Line 414: Line 420:
| number in frames for active firing mode (1st frame for activate); Used for w4_psm and w11_ba1
| number in frames for active firing mode (1st frame for activate); Used for w4_psm and w11_ba1
|-
|-
| <TriggeredBy>
|valign=top| <TriggeredBy>
| int16
|valign=top| int16
|
|
: 0 (particle is triggered by fire1)
: 0 (particle is triggered by fire1)
Line 427: Line 433:




===particle adjustment===
====particle adjustment====
When adding particles in <ONWCParticle> section then the last three values of <Transform> are the particle start location.  
When adding particles in <ONWCParticle> section then the last three values of <Transform> are the particle start location.  


Line 433: Line 439:




=M3GM=
==M3GM==
'''export'''
===export===
: ''onisplit -extract:obj output_folder input_folder\ONWCfile.oni''
: ''onisplit -extract:obj output_folder input_folder\ONWCfile.oni''
: version hint:
: 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.61.0 can extract M3GM only as obj
:: onisplit v0.9.41.0 can extract M3GM as obj or dae
:: onisplit v0.9.41.0 can extract M3GM as obj or dae


===import===
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.


'''import'''


The weapon must be positioned on XZ plane and pointing into +X (weapon rotation 0, 0, 0).
====new method====
To import or exchange weapon geometry simply insert the M3GM's file name into ONWC's <Geometry> tag. For example:
 
<Geometry>M3GMw1_tap_new</Geometry>
 
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_(tool)|Vago]].
 
When you convert the ONWC from xml back to oni be sure that the M3GM file is in the same folder.


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


====old method====
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.
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.


Line 457: Line 480:


Remember to change the links (#N) and instance IDs of the new data.
Remember to change the links (#N) and instance IDs of the new data.
{{XML}}

Revision as of 05:58, 17 December 2015

ONWC : Oni Weapon Class
XML modding tips
  • See HERE to start learning about XML modding.
  • See HERE if you are searching for information on how to handle object coordinates.
  • See HERE for some typical modding errors and their causes.
XML.png
XML

ONVL << Other file types >> OPge

switch to OBD page

general information

  • 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)


file structure

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

XML tag type description
<LaserSight> see HERE
<AmmoMeter> see HERE
<Geometry> link Weapon instance number (#N). For geometry import/exchange see HERE.
<Name> char[32] ONWCfile.oni (don't use file prefix/suffix)
<MouseSensitivity> float weapon mouse sensitivity (applies on AI, too)
<Recoil> see HERE
<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
<Flags> flag weapon options
NoHolster
UsesCells
TwoHanded
RecoilAffectsAiming
Without this flag there will be still recoil. In any case the recoil makes the aim go upwards.
If flag is set: the aiming will stay the same after firing the gun.
If flag isn't set: the upward movement stops earlier and when the fire ended the arm will fall to the previous aiming position. (w1_tap observation)
Automatic
StunSwitcher
if enemy is inside shooting distance (between min and max) and is knockdowned/stunned or blownupped, AI with this weapon switches to melee for a time specified in a *fight timer* field
KnockdownSwitcher
if enemy is inside shooting distance (between min and max) and is knockdowned or blownupped, AI with this weapon switches to melee for a time specified in a *fight timer* field
Explosive
SecondaryFire
BarabbasWeapon
if enemy is inside shooting distance (between min and max) and is knockdowned or blownupped, AI with this weapon switches to melee for a time specified in a *fight timer* field
Heavy
AutoRelease
HasReleaseDelay
HasLaserSight
ScaleCrosshair
NoFade
DrainAmmo
<FiringModes> holds 2 <FiringModes> tags
<AIFiringMode> see HERE
<Particles> holds 16 <ONWCParticle> tags
<ONWCParticle> see HERE
<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.


<LaserSight>

Crosshair
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
XML tag type description
<Origin> float x y z
<Stiffness> float x-component of laser sight direction ?
<AdditionalAzimuth> float wikipedia:Azimuth
<AdditionalElevation> float wikipedia:Elevation
<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
<TunnelTexture> link tunnel texture
<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


<AmmoMeter>

XML tag type description
<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)


<Recoil>

XML tag type description
<Base> float recoil base (e.g. for w1_tap and w2_sap)
<Max> float recoil max
<Factor> float recoil factor
<ReturnSpeed> float recoil return speed
<FiringReturnSpeed> float recoil firing return speed


<AIFiringMode>

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.
XML tag type description
<Flags> flag NoWildShots
<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.


<ONWCParticle>

Transformation matrix
That's what defines orientation, stretching, etc.
See CRSA for details.
XML tag type description
<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
<TriggeredBy> int16
0 (particle is triggered by fire1)
1 (particle is triggered by fire2)
-1 (particle is triggered by both firing modes)
<DelayBeforeFiring> int16 delay before firing


particle adjustment

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.)


M3GM

export

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

import

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.


new method

To import or exchange weapon geometry simply insert the M3GM's file name into ONWC's <Geometry> tag. For example:

<Geometry>M3GMw1_tap_new</Geometry>

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.


old method

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.