HowTo:Edit Unit Files

From VsWiki
Revision as of 01:08, 4 March 2005 by Pirx (talk | contribs)
Jump to: navigation, search

Examples taken from the wayfarer ship (now named the llama), for full description see below.

<Unit Scale="1">
  <Cockpit  file="heavy-cockpit.cpt" x="0" y="0" z="0" />
  <Meshfile file="rescue-hull-e.xmesh" />
  <Mount weapon="Ion" size="Light Medium Heavy" x="9.8108" y="1.757" z="11.8091" />
  <Sound>    </Sound>
  <Defense HudImage="wayfarer-hud.spr" >
    <Armor front="250" right="225" left="225" back="240" />
    <Shields front="150.000000" back="150.000000" recharge="30.000000" />
    <Hull strength="200.000000" />
  </Defense>
  <Stats mass="1096" momentofinertia="1096" fuel="40000000" />
  <Thrust >
    <Engine Afterburner="117007" Forward="22523" Retro="27935" Left="22231" Right="22231" Top="22231" Bottom="22231"  />
    <Maneuver yaw="289943" pitch="239988" roll="399637" />
  </Thrust>   <Computer yaw="60.400002" pitch="50.600006" roll="80.400002" afterburner="85" maxspeed="30" />
  <Energy >
    <Reactor recharge="60" limit="400" />
  </Energy>
  <Jump delay="2" jumpenergy="150" />
  <description combatRole="SHUTTLE" >
  Some cool description of the ship.
  </description>
  <Hold volume="125" >
    <Category file="Natural_Products/Natural_Resources" >
      <import price=".8" pricestddev=".2" quantity="0" quantitystddev="5"  />
    </Category>
  </Hold>
  <Light file="supernova.bmp" x="-10.24" y="-2.759" z="-18.302" size="6" />
  <Dock x="0" y="-4.7" z="6" size="10" />
</Unit>


The original desciption of the xunit syntax from hellcatv is located in cvs under units/description/xunit (VSD = 5400 kJ (kilojoules).

<Unit ...> </Unit> - Marks the begin and the end of the unit(file)

  • Scale - Sets the scaling of the unit in the game
  • <Cockpit .../> - Defines a cockpit for the ship.
    • file - Points to a cockpit file. Extension .cpt
    • x,y,z - Coordinates where the Cockpit should be in the Unit/Ship (in meters)
    • See also HowTo:Edit HUDs.
  • <Meshfile .../>
  • <__~ShieldMesh__> - (__optional__) xmesh-file to use for the shield instead of a sphere. Extension __.xmesh__
  • <__~RapidMesh__> - (__optional__) xmesh-file to load and use for collisions with other units/ships/... instead of the Meshfile from above (not drawn) Extension __.xmesh__
  • <__~BspMesh__> - (__optional__) xmesh-file to use for beam and bolt collisions (not drawn) Extension __.xmesh__
  • <__Mount__ .../> - (__optional__)(repeatable) Specifies a weapon mount
    • __weapon__ - Type of weapon (see [weapon_list.xml|http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/vegastrike/data/weapon_list.xml] in your vs-data directory or to not alway up to date VsManualDbShipWeapons)
    • __size__ - size class (which sizes it can hold) and if it's autotracking (goes inside the long string e.g: size="LIGHT MEDIUM AUTOTRACKING")
      • LIGHT
      • MEDIUM
      • HEAVY
      • SPECIAL
      • CAPSHIP-LIGHT
      • CAPSHIP-MEDIUM
      • CAPSHIP-HEAVY
      • AUTOTRACKING
      • SPECIAL-MISSLE
      • LIGHT-MISSLE
      • MEDIUM-MISSLE
      • HEAVY-MISSLE
      • LIGHT-CAPSHIP-MISSLE
      • MEDIUM-CAPSHIP-MISSLE
      • HEAVY-CAPSHIP-MISSLE
    • __ammo__ - how much ammo the gun holds (only needed for ammo needing weapons e.g. missles,torpedos,...)
    • __volume__: (__optional__ see "ammo") how much ammo the gun can hold if you refill
    • __x__,__y__,__z__ - location of weapon (in meters ;-))
    • __ri__,__rj__,__rk__ - (__optional__) R-vector forward vector) of gun (assume 0,0,1)
    • __qi__,__qj__,__qk__ - (__optional__) Q-vector (up vector) of gun (assume 0,1,0)
  • <__Sound__> </Sound> - __nothing yet ???__
  • <__Defense__ ...> </Defense> -
    • __~HudImage__ - sprite file to use when targetted
    • __~ExplosionAni__ - (__optional__) special explosion to use
    • __~RepairDroid__ - (__optional__) strength of repair system (0-6)
    • __ECM__ - (__optional__) type of ECM (Electronic Counter Measure)
    • <__Armor__ .../> - Specifies the ships physical armor
      • __front__ - Forward max armor in VSD
      • __right__ - Right armor in VSD
      • __left__ - Left armor in VSD
      • __back__ - Back armor in VSD
    • <__Shields__ .../> - Specifies the ships Shield (electric armor)
      • __front__ - Forward max shields in VSD
      • __back__ - Back shields in VSD
      • __recharge__ - Shield regeneration if not violating speed limit in VSD/s
      • __leak__ - (__optional__) how much leak these shields have (usually 0%) between 0 and 100
      • __left__ - (__optional__) Left shields in VSD
      • __right__ - (__optional__) Right shields in VSD
      • __top__ - (__optional__) Top shields) in VSD
      • __bottom__ - (__optional__)bottom shields in VSD
    • <__Hull__ .../> - Specifies the ships Hull
      • __strength__ - Max hull in VSD
    • <__Cloak__ .../> - (__optional__) Specifies the ships cloak device
      • __missing__ - if 1, then no cloak is here. also missing in abserce of optional tag
      • __cloakmin__ - minimum percentage of cloakedness
      • __cloakglass__ - boolean whether or not effect 2 is used
      • __cloakrate__ - time per second to cloak in decimal per second
      • __cloakenergy__ - how much energy this takes in 100kJ
  • <__Stats__ .../> - Specifies the statics of the ship
    • __mass__ - mass in metric tonnes (kkg)
    • __momentofinertia__ - mass*m*m in (metric tonnes * meter * meter)
    • __fuel__ - amount of fuel
  • <__Thrust__>...</Thrust> - Specifies the ships thrust
    • <__Engine__ /> - Specifies the ships engine
      • __Afterburner__ - Thrust with afterburners in metric tonnes meters per second squared
      • __Forward__ - Thrust without afterburners in kkg*m/s^2
      • __Retro__ - Reverse thrust in kkg*m/s^2
      • __Left__ - Left thrust in kkg*m/s^2
      • __Right__ - Right thrust in kkg*m/s^2
      • __Top__ - Top thrust in kkg*m/s^2
      • __Bottom__ - Bottom thrust in kkg*m/s^2
    • <__Maneuver__ .../> - Specifies the ships maneuver data
      • __yaw__ - Right yaw in metric tonnes degrees per second squared
      • __pitch__ - Right pitch in kkg*deg/s^2
      • __roll__ - Right roll in kkg*deg/s^2
  • <__Computer__ ...> ... </Computer>-
    • __yaw__ - max yaw in degrees per second
    • __pitch__ - max pitch in dps
    • __roll__ - max roll in dps
    • __afterburner__ - Max safe speed with afterburners in m/s
    • __maxspeed__ - Max safe speed without afterburner in m/s
    • __slidestart__ - (__optional__) number of tenths of seconds before fully reacting to keyboard (smoothing)
    • __slideend__ - (__optional__) number of tenths of seconds to stop
    • <__Radar__ .../> - Specifies the ships radar system
      • __itts__ - if the unit has ability to target track with lead
      • __color__ - if unit has color radar
      • __range__ - maximum range of radar
      • __error__ - (__optional__) currently unused
      • __trackingCone__ - cosine of cone at which guns may track
      • __lockcone__ - cosine of cone at which missiles gain locking time
      • __mintargetsize__ - unused...but supposedly minimum target this can do
  • <__Energy__> ... </Energy> -
    • <__Reactor__ .../> - Specifies the ships poer unit (reactor)
      • __recharge__ - recharging of reactor in 100 MJ/s
      • __limit__ - max storage of reactor in 100 MJ/s
  • <__Jump__ .../> - (__optional__)
    • __delay__ - seconds before jump drive initiates
      • __jumpenergy__ - energy to jump
    • __wormhole__ - forces units to teleport upon touching this one
    • __missing__ - boolean whether the jump drive is missing (assumed missing in absence of tag)
  • <__description__ ...>... </description> - (repeatable)
  • <__Hold__ ...> ... </Hold>
    • __volume__ - volume in cargo units
    • <__Category__ ...> ... </Category> - (__optional__)(repeatable) A category to use from the Vs-~MasterPartList'.
      • __file__ -
        • e.g. file="Natural_Products/Natural_Resources"
      • <__import__ .../> (__optional__)
        • __price__ - price scale (multiplied by price in list)
        • __pricestddev__ - price scale variation (above adjusted by this)
        • __quantity__ - quantity of this sort of cargo
        • __quantitystddev__ - quantity variation
      • <__Cargo__ .../> (__optional__)(repeatable)
        • __file__ - name of cargo
        • __price__ - price of cargo
        • __quantity__ - ammount of cargo
        • __mass__ - mass in tonnes
        • __volume__ - size of cargo in cargo units
        • __description__ - (__optional/unused__)
  • <__Light__ .../> - (__optional__)(repeatable) Specifies an engine-flame/light/glow/whatever on your ship
    • __file__ - meshfile (sans .xmesh) for this engine model
      • e.g. "supernova.bmp" it's actually a xmesh file
    • __x__,__y__,__z__ - location of light (in meters ;-))
    • __size__ - size of engine (radius, in meters ;-))
    • __red__,__blue__,__green__ - (__optional__)red/blue/green dye of engine
  • <__Dock__ .../> - (__optional__)(repeatable) A place where another unit can dock.
    • __x__,__y__,__z__ - location of dock (in meters ;-))
    • __size__ - size of dock port (radius, in meters ;-))
    • __dockinternal__: (__optional/unused__) whether the dock port makes the ship disappeared. The ship must be smaller than the size of the dock, otherwise it will remain in open space.
  • <__~SubUnit__ .../> - (__optional__)(repeatable) A Subunt is a (not necessarily) small independant part of your unit. In fact the main unit and the subunit are two different ships (units) patched together at a certain point (x,y,z see below). If a subunit is destroyed the remaining parts will fly into space like the remainings of any other ship ... e.g turrets
    • __file__: unit file that can be referenced frmo toplevel units
    • __size__: size class (which sizes it can hold)
    • __x__,__y__,__z__ - location of subunit (in meters ;-))
    • __ri__,__rj__,__rk__ - (__optional__) R-vector (forward vector) of subunit (assume 0,0,1)
    • __qi__,__qj__,__qk__ - (__optional__) Q-vector (up vector) of subunit (assume 0,1,0)
    • __restricted__ - (__optional__) minimum dot with rj that the turret can have so it can't turn inside itself
  • <__~CockpitDamage__ .../> - (__optional__)(repeatable up to 1+NUMGAUGES+MAXVDUS or 29)
    • NOTE: If you have more, strange things may happen, as it will probably overrun the cockpitdamage buffer.
    • __damage__ - float between 0 and 1 depending on the amount of static the vdu has.
  • <__Upgrade__ .../> - (__optional__)(repeatable) an upgrade unit that adds its stats onto this unit (as if you had bought it from the shop).
    • __file__ - the file to upgrade it with.

! #[Turret-Directions] - [Link|#Turret-Directions]

There are 2 vectors for turrets: __r__ and __q__


__r__ is the __forward vector__:

  • x component = ri
  • y component = rj
  • z component = rk

When forward is pointing in the +z direction then rk is 1 and ri and rj are zero hence ri*ri+rj*rj+rk*rk = 0*0+0*0+1*1=1

__q__ is the __up vector__:

  • x component = qi
  • y component = qj
  • z component = qk

When forward is pointing in the +z direction then qj is 1 and qi and qj are zero hence qi*qi+qj*qj+qk*qk = 0*0+1*1+0*0=1


! #[Unit-Differences] between the various unit files - [Link|#Unit-Differences] See also [this|http://vegastrike.sourceforge.net/forums/viewtopic.php?t=1811] thread.

  • __<file without extension>__
    • default unit file
  • __.blank__ file
    • As the name already says, this is the 'blank' unit file. This ship doesn't have any weapons or upgrades on it.
  • __.template__ file
    • The template basically defines the maximum values for a ship/unit. e.g:
      • max speed
      • max yaw
      • max power
      • ...
    • The upgrades available to a ship are also located in this file.
      • The actual upgrades and how they behave are defined by unit files located in the units/factions/upgrades directory. Just look at a few of the files in there and it should be pretty straightforward. There need to be a section in the wiki for the description of this :-)
      • A (not always up to date) list of upgrades is under VsManualDbShipUpgrades.
      • Example:

<verbatim> <Upgrade file="reactor_level_3"/> <Upgrade file="mult_gun_cooler"/> <upgrade file="add_reactor_capacitance"/> </verbatim>

  • __.<factionname>__
    • unit file for the named faction ... e.g dodo.confed

Last updated: Pontiac 2004.01.21 %%%Created: Pontiac 2003.04.27


Back to VegastrikeHowtos