Function; StartWeaponConfig - HWRM/KarosGraveyard GitHub Wiki

StartWeaponConfig(<sWeaponName>, <sWeaponType>, <sWeaponFireType>, <sWeaponFireName>, <sActivation>, <fWeaponFireSpeed>, <fWeaponFireRange>, <fWeaponFireRadius>, <fWeaponFireLifetime>, <fWeaponFireMisc1>, <iWeaponFireAxis>, <iMaxEffectsSpawned>, <iUseVelocityPred>, <iCheckLineOfFire>, <fFireTime>, <fBurstFireTime>, <fBurstWaitTime>, <iShootAtSecondaries>, <iShootAtSurroundings>, <fMaxAzimuthSpeed>, <fMaxDeclinationSpeed>, <fSpeedMultiplierWhenPointingAtTarget>, <sWeaponShieldPenetration>, <iTrackTargetsOutsideRange>, <fWaitUntillCodeRedState>, <iInstantHitThreshold>)

Description

This function is called within a ".wepn" file, and defines the characteristics of a weapon, such as projectile graphics, muzzle velocity, maximum range, and rate of fire. Call StartWeaponConfig only once per ".wepn" file.

Example

StartWeaponConfig(NewWeaponType, "Gimble", "Bullet", "Improved_Plasma_Bomb", "Special Attack", 1200, 1800, 0, 0, 0, 0, 1, 1, 0, 2.1, 0, 0, 0, 0, 260, 40, 0.1, "Normal", 0, 0, 0)

Arguments

  1. <sWeaponName>: Reference to the weapon. Generally, this will be NewWeaponType.
  2. <sWeaponType>: How the weapon tracks targets. Possible values are "Gimble", "AnimatedTurret", or "Fixed". "Gimble" indicates the weapon is not in a turret but can aim at targets within a certain cone. "AnimatedTurret" indicates that the weapon is mounted in a visible, moving turret. "Fixed" indicates the weapon can only fire in a fixed (unchanging) direction, such as the ion cannon on the Ion Cannon Frigate.
  3. <sWeaponFireType>: Type of projectile, possible values are "InstantHit", "Bullet", "Mine", "Missile", or "SphereBurst". "InstantHit" is generally used with beam weapons, and causes the weapon's damage or other effects to take place immediately upon firing. "Bullet" indicates an unguided projectile. "Mine" indicates the projectile is dropped where the ship is located, and waits to detonate when an enemy ship moves nearby. "Missile" indicates a guided projectile. "SphereBurst" indicates an area of effect weapon. "SphereBurst" weapons require two ".wepn" files to be defined. The first ".wepn" file defines how the weapon is fired, while the second ".wepn" file defines the effects of a hit or miss. See "hgn_smallemp.wepn" and "hgn_smallempburst.wepn" for an example.
  4. <sWeaponFireName>: The name of the weapon fire script (".wf" file) that specifies effects details.
  5. <sActivation>: Indicates the context in which the weapon is used. Possible values are "Normal", "Special Attack", "Normal Only", or "Dropped". "Normal" indicates the weapon is always used during any attack. "Special Attack" indicates the weapon is used only after being activated by research or by the special attack key, which is also active only after researching something. "Normal Only" indicates the weapon is used only if a special attack is not researched. "Dropped" indicates that the weapon fires only when the Deploy Mines key is used. This is used with mines, only.
  6. <fWeaponFireSpeed>: The velocity of the projectile. For "Missile" weapons, this is the initial velocity. For "InstantHit" and "SphereBurst" weapons, set this to 0.
  7. <fWeaponFireRange>: Maximum range at which the weapon may fire. Note that this does not indicate the maximum range of the projectile.
  8. <fWeaponFireRadius>: Only used for "SphereBurst". This determines the radius of the blast, within which all specified ships are affected by the weapon.
  9. <fWeaponFireLifetime>: Duration of the projectile, in seconds. Used for beam weapons, only.
  10. <fWeaponFireMisc1>: For beam weapons, this is the anticipation time. The time after the firing sequence starts until the beam appears.
  11. <iWeaponFireAxis>: For missiles only. The direction of ejection for the missile. Possible values: 0 (Forward), 1 (Left), and 2 (Up).
  12. <iMaxEffectsSpawned>: Maximum number of hit effects to spawn over the life-time of the weapon. If <fWeaponFireLifetime> is 0, then 1 effect will be spawned.
  13. <iUseVelocityPred>: If enabled, the weapon will lead the target. Otherwise, it fires directly at the target.
  14. <iCheckLineOfFire>: If enabled, the weapon checks for friendlies in the way before firing.
  15. <fFireTime>: Delay between shots, in seconds.
  16. <fBurstFireTime>: Duration of a burst, in seconds. Divide this value by <iFireTime> to determine how many shots are fired per burst.
  17. <fBurstWaitTime>: Delay between bursts, in seconds. Note: If <fFireTime>=0.2,<fBurstFireTime>=0.7, <fBurstWaitTime>=0.5, to calculate the DPS, we should multiple bulletDamage with (3/1.2) instead of (4/1.2) or (3.5/1.2), that's how "firepower" in UnitSelectionPanel calculated! - SutchAwson
  18. <iShootAtSecondaries>: If enabled, when the weapon cannot shoot the main target, it will try to shoot secondary targets. See mecha's "30th Sep 03" post here on Band Box/Drag Attack.
  19. <iShootAtSurroundings>: If enabled, when the weapon cannot shoot any of the given targets, it will scan for nearby enemies (SLOW!).
  20. <fMaxAzimuthSpeed>: Horizontal tracking speed of the weapon.
  21. <fMaxDeclinationSpeed>: Vertical tracking speed of the weapon.
  22. <fSpeedMultiplierWhenPointingAtTarget>: When the weapon is over the target ship, its speed is modified by this. Use a value smaller than 1 to make beams sweep slowly over the target.
  23. <sWeaponShieldPenetration>: Possible values are "Normal", "Enhanced", or "Bypass" ("None" may also be valid). Determines how the weapon interacts with ships that have a "Bullet" shield type. See scripts/armourandshields.lua for exact multipliers. For defense field penetration, see: setPenetration.
  24. <iTrackTargetsOutsideRange>: If enabled, the weapon tracks targets outside of its range.
  25. <fWaitUntillCodeRedState>: Animation hookup. With this set, the weapon cannot fire untill the Code Red Animation finishes. (See the Vaygr Missile Frigate.)
  26. <iInstantHitThreshold>: If the target has less than this health, the beam will go through the target ship.

Scope

Related Pages

Comments

Updated with mecha's descriptions (slightly modified) from this thread.

--Thought (2003-09-30 17:36:37)

Ranger: Added descriptions to iWeaponFireSpeed and iWeaponFireRange. Clarified the following argument descriptions: iWeaponFireRadius, iWeaponFireLifetime, iFireTime, iBurstFireTime, iBurstWaitTime, iMaxAzimuthSpeed, iMaxDeclinationSpeed, and iInstantHitThreshold. Fixed typo in sWeaponType description.

--bay-bridge.veritas.com (2003-10-06 18:06:47)

Ranger: Added sWeaponShieldPenetration values and possible descriptions of each value.

--bay-bridge.veritas.com (2003-10-06 18:21:55)

added http://hw2.tproc.org/wiki/SphereBurst

--MultiPlicity (2003-10-10 02:51:46)

Improved description, slightly.
Added example.

--RangerHW (2003-10-13 11:56:39)

Projectile velocity did affect missiles in Cataclysm. It was the velocity at which missiles were launced at, then accelerating to their max speed according to missile.shp stats (I think it was useful in Dreadnought so they wouldn't hit it). Maybe it is the same in HW2.

--ppp72-150.patras.access.acn.gr (2003-11-08 18:47:17)

The previous was posted by me komninosm but I didn't know how to put my name in lol

--ppp72-150.patras.access.acn.gr (2003-11-08 18:48:23)

I tested my theory and it proved correct as far as I could see...

--ppp72-157.patras.access.acn.gr (2003-11-09 21:58:16)

To whoever lsanca1-ar41-4-61-147-003.lsanca1.dsl-verizon.net is:

Please do not edit these pages if you are just going to screw up the values. You replaced part of the example with a bunch of garbage. That doesn't help the modding community. If you accidentally start editing page, *DO NOT* store the changes!!!! Just hit CANCEL!!!!! Or, just hit the "Back" button on your browser. Thank you.

--RangerHW (2003-11-30 17:04:08)

"Dropped" does have a use other than mines - see Vgr_InfiltrationPodLauncher.wepn. The infiltrator pods are treated as dropped, but seem to be treated as missiles. (Unverified - see Vgr_InfiltratorFrigate.ship: StartShipWeaponConfig(NewShipType,"Vgr_InfiltrationPodLauncher","Weapon_PodLauncher","Fire_Missile") )

-- Lurkily

--ip68-100-169-240.dc.dc.cox.net (2004-05-08 17:45:22)

Somebody forgot to include "<fMaxDeclinationSpeed>" in the syntax line at the top of the page (I took the liberty of adding it in.)

--ZaTcH

--dt065n88.san.rr.com (2005-01-04 17:35:45)

Question: where is the variable NewWeaponType defined? Is it really a string? Does the engine automatically insert the name of the weapon or something? This question applies to all the other StartConfig functions, as well.

--Mikali (2006-01-20 13:48:45)

Page Status

Updated Formatting? Initial
Updated for HWRM? Initial

⚠️ **GitHub.com Fallback** ⚠️