Difference between revisions of "DCS Class Weapon"

From DCS World Wiki - Hoggitworld.com
m (1 revision imported)
 
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:
 
|cName= Weapon
 
|cName= Weapon
  
|vNum= 1.2.0
+
|vNum= 1.2.4
  
 
|xVar=
 
|xVar=
Line 9: Line 9:
 
|desc= Represents a weapon object: shell, rocket, missile and bomb
 
|desc= Represents a weapon object: shell, rocket, missile and bomb
  
|type= [[DCS_enum_weapon|Weapon Flag]] is a complex enumerator used to describe the type of weapon. Information can be found on the linked page because it is a headache to summarize quickly.  
+
|type= [[DCS_enum_weapon|Weapon.flag]] is a complex enumerator used to describe the type of weapon. Information can be found on the linked page because it is a headache to summarize quickly.  
 
+
<br/>Note that Weapon.Category values are <u>not</u> obtained by calling ''weapon'':getCategory() - that calls Object.getCategory(''weapon'') and will <u>always</u> return the value Object.Category.WEAPON.  Instead you need to use ''weapon'':getDesc().category to find the Weapon.Category!
 
{{DCS_enum_weapon_category}}
 
{{DCS_enum_weapon_category}}
  
Line 84: Line 84:
  
 
}}
 
}}
 +
[[Category:Game Patch 1.2.4|Weapon Class]]

Latest revision as of 00:50, 4 January 2023

Scripting Root

Class Name: Weapon Added with: 1.2.4
Extends:
Inherits: Object, Coalition Object
Description: Represents a weapon object: shell, rocket, missile and bomb
Member Functions: getLauncher, getTarget, getCategoryEx

Inherited from Object Class: isExist, destroy, getCategory, getTypeName, getDesc, hasAttribute, getName, getPoint, getPosition, getVelocity, inAir

Inherited from Coalition Object Class: getCoalition, getCountry

Obtained Via: Static Functions Functions Events
shot, hit, shooting_start, shooting_end
Enumerator Types: Weapon.flag is a complex enumerator used to describe the type of weapon. Information can be found on the linked page because it is a headache to summarize quickly.


Note that Weapon.Category values are not obtained by calling weapon:getCategory() - that calls Object.getCategory(weapon) and will always return the value Object.Category.WEAPON. Instead you need to use weapon:getDesc().category to find the Weapon.Category!

Weapon.Category
  SHELL     0
  MISSILE   1
  ROCKET    2
  BOMB      3
Weapon.GuidanceType
  INS                  1
  IR                   2
  RADAR_ACTIVE         3
  RADAR_SEMI_ACTIVE    4
  RADAR_PASSIVE        5
  TV                   6
  LASER                7
  TELE                 8
Weapon.MissileCategory
  AAM          1
  SAM          2
  BM           3
  ANTI_SHIP    4
  CRUISE       5
  OTHER        6
Weapon.WarheadType
  AP                 0
  HE                 1
  SHAPED_EXPLOSIVE   2
Description Table Structure: Common Weapon description table shared by all weapons:
Weapon.Desc = extends Object.Desc {
  category = enum Weapon.Category,
  warhead = {
    type = enum Weapon.WarheadType,
    mass = Mass,
    caliber = Distance,
    explosiveMass = Mass or nil, --for HE and AP(+HE) warheads only
    shapedExplosiveMass = Mass or nil, --for shaped explosive warheads only
    shapedExplosiveArmorThickness = Distance or nil ----for shaped explosive warheads only
  }
}

Missile Description

Weapon.DescMissile = extends Weapon.Desc {    
  guidance = enum Weapon.GuidanceType,
  rangeMin = Distance,
  rangeMaxAltMin = Distance,
  rangeMaxAltMax = Distance,
  altMin = Distance,
  altMax = Distance,
  Nmax = number,
  fuseDist = Distance
}

Rocket Description

Weapon.DescRocket = extends Weapon.Desc {
  distMin = Distance,
  distMax = Distance
}

Bomb Description

Weapon.DescBomb = extends Weapon.Desc {    
  guidance = enum Weapon.GuidanceType,
  altMin = Distance,
  altMax = Distance,
Notes: Weapon objects can be gathered through the use of event handlers.